Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot Set Stop Loss on Market Replay

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

    Cannot Set Stop Loss on Market Replay

    Hello,

    I'm having sever problems running strategies on market replay.

    Sometimes it execute orders, sometimes not. Sometimes I can set stop loss, sometimes not. Sometimes i can add an ask data series, sometimes not.
    Sometimes restarting the computer/NT or changing the script name helps, sometimes not.

    I attached a simple script which opens a long position and set a stop loss. it works well online but not on MR. On MR it opens a position but doesn't set SL.
    The data is downloaded from MBTrading. Personally I don't think it's a code problem but something with the settings or corrupted data/account or something like that....

    Please, please, please help me with this one. I'm new with NT development, struggling to understand it and those kind of things make it even harder.

    Thanks
    Attached Files

    #2
    Hello,
    You are submitting the order in historical bars and thus the stop orders are behaving erratically as they are being evaluated as historical orders.

    If you append the below code then can you get the correct orders.

    Code:
    protected override void OnBarUpdate()
    {
    	if (Historical) return;
          //rest of the codes
    }



    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      THanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      65 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      149 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      99 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      286 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X