Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order rejected

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

    Order rejected

    Hello Ninja Team!

    My strategy was on today for ES and M6E, and i got few errors, it might not be an issue(or I might need to change my code) but I wanted to confirm. Please see attachment.

    Thanks in advance!
    Attached Files

    #2
    Hello Bobisam,

    Thanks for your post.

    Can you clarify if you are using a ATM strategy or a Ninjascript/strategy builder strategy?

    Comment


      #3
      Hi, Paul!

      I am using NinjaScript itself. So, once entry conditions are met, strategy executing a long position M6E at 1.1263

      My stop loss:

      Code:
      if (Position.MarketPosition == MarketPosition.Long)
      {
      SetStopLoss(CalculationMode.Price, execution.Order.AverageFillPrice - (2*ATR(100)[0]));
      }
      Looking at logs, it seems that the strategy set stop loss above long position's average price. Can you tell me what is wrong here please?

      Comment


        #4
        Hello Bobisam,

        Thanks for your post.

        I would recommend that you add code to ensure that the current price is greater than execution.Order.AverageFillPrice - (2*ATR(100)[0] before actually placing the stop order.

        Comment


          #5
          Thanks Paul,

          Just wanted to make sure I implemented correctly to avoid order rejection issue(stop loss)

          Code:
          if (Position.MarketPosition == MarketPosition.Long && Close[0]>execution.Order.AverageFillPrice - (2*ATR(100)[0]))
                              {
                              SetStopLoss(CalculationMode.Price, execution.Order.AverageFillPrice - (2*ATR(100)[0]));
                              }
          
                          if (Position.MarketPosition == MarketPosition.Short && Close[0]<execution.Order.AverageFillPrice + (2*ATR(100)[0]))
                              {
                              SetStopLoss(CalculationMode.Price, execution.Order.AverageFillPrice + (2*ATR(100)[0]));
                              }

          I have another question, what should I do if I want to backtest stocks using strategy analyzer, my ninja only comes with cme data, but stocks were separate subscription, do I need to subscribe for stocks data to backtest or is it free for backtesting?

          Comment


            #6
            Hello Bobisam,

            Thanks for your reply.

            Please make sure you always confirm with a test using the Sim101 account.

            Backtesting would require access to historical data. If your data provider offers stock data you would need to check with them regarding their historical data.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            44 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            54 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            34 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            94 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            56 views
            0 likes
            Last Post PaulMohn  
            Working...
            X