Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop loss and take profit for orders with OIF files

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

  • NinjaTrader_ChelseaB
    replied
    Hello spondishy,

    This would be without using an Atm template? (An Atm template created in the SuperDOM or Chart Trader where be where you would set a number of ticks from entry for a stop and target)

    It would not be possible to specify a number of ticks for a stop order and limit order when placing these with OIF. You would need to calculate this first and supply the exact prices for the stop price and limit price.

    For example:
    Code:
    PLACE;Sim101;AAPL;BUY;1;MARKET;;;GTC;;MYORDERID1;;
    PLACE;Sim101;AAPL;SELL;1;STOPMARKET;;191.31;GTC;MYOCOID1;MYORDERID2;;
    PLACE;Sim101;AAPL;SELL;1;LIMIT;192.81;0;GTC;MYOCOID1;MYORDERID3;;​

    Leave a comment:


  • spondishy
    replied
    Any chance you can just give me the example of oif entries that take an order at market and set the stop loss at 50 ticks and profit at 100?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello spondishy,

    This would be the entry market order with the ID '7c656f58-83dc-40e2-87e4-fff6ccc59c7f'. The entry market order is not a stop order and cannot be modified.

    The order ID of the entry is not the order ID of any stops or targets that get submitted from an Atm Strategy.

    You would need the ID of the stop order to modify that stop order.

    You can get this ID from the Orders tab of the Control Center.

    Leave a comment:


  • spondishy
    replied
    OK thanks. I don't see how this can work so can you help with the OIF files as I'm getting errors.

    1) I create a market order. All good:

    PLACE;Sim101;MNQ SEP23;BUY;1;MARKET;;5;DAY;7c656f58-83dc-40e2-87e4-fff6ccc59c7f;7c656f58-83dc-40e2-87e4-fff6ccc59c7f;;

    2) I attempt to change the stop (with a new file)

    CHANGE;;;;1;;;15200;;;7c656f58-83dc-40e2-87e4-fff6ccc59c7f;;


    This gives an error in the logs. Order is in a terminated state so cannot be changed. And a file in the outgoing folder with contents of REJECTED;0;0

    3) What would the OIF file look like to set the target profit? Thanks
    Last edited by spondishy; 07-06-2023, 01:37 PM.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello spondishy,

    The profit target would be defined in the Atm Strategy template, if one was used.

    The alternative is to just place a limit order and stop order with the PLACE command, and modify those orders directly.

    Leave a comment:


  • spondishy
    replied
    Thanks for the response. Unfortunately my stop changes depending on certain parameters, so I have a moving contract size and stop. So can I do this somehow.

    1) Place order for x contracts (PLACE command)
    2) Change order for stop loss (CHANGE command)
    3) How would I set take profit?

    Or am I missing something? I don't see how ATM strategies would work.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello spondishy,

    An Atm could be applied to the entry by specifying an Atm Strategy Template name and ID.
    PLACE;<ACCOUNT>;<INSTRUMENT>;<ACTION>;<QTY>;<ORDER TYPE>;[LIMIT PRICE];[STOP PRICE];<TIF>;[OCO ID];[ORDER ID];[STRATEGY];[STRATEGY ID]


    The quantity can be changed by supplying that same strategy ID.
    CHANGE;;;;<QUANTITY>;;<LIMIT PRICE>;<STOP PRICE>;;;<ORDER ID>;;[STRATEGY ID]

    However, a market order cannot be modified. You would need to place an additional order to change the position quantity.

    Leave a comment:


  • Stop loss and take profit for orders with OIF files

    Hi there, I'm creating orders using OIF files and have no issues creating market orders. I'm wondering how I go about setting a stop and take profit on the market order. I would prefer to apply an ATM strategy but the quantity of the order will change so that won't work.

Latest Posts

Collapse

Topics Statistics Last Post
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
81 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
42 views
0 likes
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
64 views
2 likes
Last Post CaptainJack  
Started by CarlTrading, 03-30-2026, 11:51 AM
0 responses
68 views
0 likes
Last Post CarlTrading  
Started by CarlTrading, 03-30-2026, 11:48 AM
0 responses
56 views
0 likes
Last Post CarlTrading  
Working...
X