Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaScript ATM Multiple instruments

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

    NinjaScript ATM Multiple instruments

    Hi all..

    With my code below, it keeps submitting the order on the ^TICK instead of the ES contract. Any idea why?

    // Add a 100 tick Bars object for the ^TICK - BarsInProgress index = 1
    Add("^TICK", PeriodType.Minute, 1);
    Add(PeriodType.Minute, 1);

    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {

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


    // check if TICK closed above 'X' for short trades
    if (Closes[1][0]>shorttickvalue
    && Position.MarketPosition == MarketPosition.Flat
    && tradeshort == true && orderId.Length == 0 && atmStrategyId.Length == 0)

    {
    // Enter SHORT if true
    atmStrategyId = GetAtmStrategyUniqueId();
    orderId = GetAtmStrategyUniqueId();
    AtmStrategyCreate(Action.Sell, OrderType.Limit, Closes[0][0], 0, TimeInForce.Day, orderId, "ESTICKATM", atmStrategyId);
    }

    #2
    Hi heyligerb, so your BarsInProgess 0 is the ES chart? Have you tried entering just Close[0] as the ATM limit price?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      yes... and yes. Would you like to see the whole script?

      Comment


        #4
        I've even tried to put ES on bip=2, and use closes[2][0]... that didn't work either.

        Comment


          #5
          heyligerb, sure, if you don't want to post it, just contact me at support at ninjatrader dot com and attach the cs / zip - thanks
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Post the answer

            Bertrand - I'm interested in what the problem was. I don't need to see the script, but would like to know what the issue was if possible.

            Thanks.

            Comment


              #7
              Sorry don't remember exactly how it was resolved - which issue do you have? If possible please post the code so we can have a look, thanks
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by alifarahani, Today, 09:40 AM
              6 responses
              38 views
              0 likes
              Last Post alifarahani  
              Started by Waxavi, Today, 02:10 AM
              1 response
              18 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by Kaledus, Today, 01:29 PM
              5 responses
              15 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by Waxavi, Today, 02:00 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by gentlebenthebear, Today, 01:30 AM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X