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 PaulMohn, Today, 03:49 AM
              0 responses
              7 views
              0 likes
              Last Post PaulMohn  
              Started by inanazsocial, Today, 01:15 AM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by rocketman7, Today, 02:12 AM
              0 responses
              10 views
              0 likes
              Last Post rocketman7  
              Started by dustydbayer, Today, 01:59 AM
              0 responses
              4 views
              0 likes
              Last Post dustydbayer  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              5 responses
              23 views
              0 likes
              Last Post trilliantrader  
              Working...
              X