Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Multi Instrument Time Delay

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

    Multi Instrument Time Delay

    Hi NT-Supportteam,

    is there a workable solution for time time delay problem in strategies with multiple instruments? If not, will the delay problem still be in NT8? I have searched and tried a lot, but still haven't found a good solution for this problem.

    My Code:

    protectedoverridevoid Initialize()
    {

    Add(Instrument2, PeriodType.Minute, 5); // Index [1]

    }


    protectedoverridevoid OnBarUpdate()
    {

    if ( BarsInProgress == 1 )

    {
    if (Closes[1][0] > Opens[1][0]) Signal = true;
    // Signal Condition Ok at 10:00
    }


    if ( BarsInProgress == 0 && if (Signal == true) )
    SubmitOrder(
    0 , ... ) ;
    // Order has to be submitted at 10:00

    }


    Instrument1 has Index0, Intrument2 has Index1.
    The Signal comes from Instrument2(index1) at 10:00 and the Order in Instrument1(Index0) has to be submitted at 10:00.
    Since my Instrument1 hast Minute period 5, the orders is submitted at 10:05.

    How can I also submit the order in Instrument1 at 10:00 ?
    Please help me.

    Last edited by Redmoon22; 05-26-2015, 02:09 PM.

    #2
    Hello Redmoon22,

    Thank you for your inquiry.

    Please ensure that you have set "CalculateOnBarClose" to false. The reason why the order is being submitted at 10:05 rather than 10:00 is because of your period being set to 5. After five minutes, the bar closes and your calculations are run. With "CalculateOnBarClose" set to false, the calculations will be run on each incoming tick. This can be CPU intensive, but this will allow your order to be submitted before the bar closes.

    For more information about CalculateOnBarClose, please take a look at the NinjaTrader help guide at this link: http://www.ninjatrader.com/support/h...onbarclose.htm

    The NinjaTrader help guide has a very helpful reference guide for NinjaScript. You can find an alphabetical reference here: http://www.ninjatrader.com/support/h..._reference.htm

    Please, let us know if we can be of further assistance!
    Last edited by NinjaTrader_ZacharyG; 05-27-2015, 06:40 AM.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by George21, Today, 10:07 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by geddyisodin, Yesterday, 05:20 AM
    8 responses
    50 views
    0 likes
    Last Post geddyisodin  
    Started by DayTradingDEMON, Today, 09:28 AM
    3 responses
    20 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Stanfillirenfro, Today, 07:23 AM
    9 responses
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by navyguy06, Today, 09:28 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X