Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using setProfitTarget in an automated strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using setProfitTarget in an automated strategy

    I'm using setProfitTarget in a Ninjascript. I call it after my buy or sell order is filled (e.g., I override onOrderUpdate, and call setProfitTarget using the same position name used when I opened the buy/sell order).

    My order is for 5000 units of AUDJPY.

    I'm backtesting with the Market Replay Connection. When the profit target is hit, I get 4999 orders that look like the attached image. These are slowly closed over the next few minutes as the price moves (e.g., the order the partially filled for a few minutes until it's fully filled).

    Not sure what's happening here, but shouldn't the profit target be for one price? Should all 5000 units close at the same profit target price? Or is there something that I need to set? Thanks in advance.
    Attached Files

    #2
    Hello micprice,
    Thanks for posting today.

    This behavior is expected. You placing a large number of orders. It will take a while to fill all these orders.

    The delay you see if you are using a sim account is to mimic the live market environment. This delay is from the signal being sent and the order working at the market.

    The simulator engine uses a scientific approach to determine fill probability by including a number of variables including: ask/bid volume, trade volume, time (to simulate order queue position), and random time delays for switching between order states

    Orders in a live market will not fill instantaneously. The order has to travel to the market, be accepted by the broker and then filled at the market. This delay will allow the market to move so that all 5,000 orders will not fill at the set profit target.

    Please let us know if we may be of further assistance for anything NinjaTrader.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      Makes sense -- that's what I suspected. Thanks for the clarification!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by f.saeidi, Today, 10:19 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by kujista, Today, 06:23 AM
      5 responses
      15 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by traderqz, Yesterday, 09:06 AM
      2 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by traderqz, Today, 12:06 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X