Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can someone tell me why this Strategy code is not working?

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

    Can someone tell me why this Strategy code is not working?

    I have a variable:

    double limitprice



    After OnBarUpdate I have:

    limitprice=Bollinger(0.50, 28).Lower[0] - 3* TickSize;

    after my if statement:

    {AtmStrategyCreate(OrderAction.Sell, OrderType.Limit, limitprice, 0,
    TimeInForce.Day, GetAtmStrategyUniqueId(), "Trade1",
    GetAtmStrategyUniqueId());}

    I get no error messages but the order does not fire...

    If I change the OrderType to Market and the limitprice to 0 the code works. But I don't want a market order...I want a limit order 3 ticks below the Lower Bollinger Band.

    What am I missing? The only coded example in Ninja Help was for a market order...so, please don't refer me there. Thanks in advance.

    #2
    Hello Sarasotavince,

    Thank you for your post.

    Can you please provide the code that you are using to submit these orders, so I can investigate this further?

    Are there no errors in the Log Tab of the Control Center after trying to run it?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Actually, the error log says:
      ATM Strategies can't be created on historical data

      Here's what I have figured out...please confirm if I am right or wrong.

      I saw these lines in the code and I turned them off:

      // Make sure this strategy does not execute against historical data
      if (Historical)
      return;

      like this:
      //if (Historical)
      //return;

      That used to be called REMing them out. REM = Remarks, not sure what it is called now.

      When I un-REM them ... the code worked.

      Since I was testing on historical data (market replay) I turned off the lines...

      Seems a little backwards..but it works for Market Replay. Next test is LIVE data on SIM.

      I appreciate your efforts to help me.

      Comment


        #4
        Hello Sarasotavince,

        ATM strategies from automated scripts only work in real time.

        Market replay is technically considered real time as it replays the market, and why you saw the error message when commenting or REMing them out, since the script then included historical data.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Got it. Much Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          19 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          45 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          20 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          181 views
          0 likes
          Last Post jeronymite  
          Working...
          X