Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with Add migrating strategy

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

    Help with Add migrating strategy

    Hello,

    I've an NT7 strategy that works with week and day levels, in the initzialize funcion I do:

    Code:
    Add(PeriodType.Day,1);
    Add(PeriodType.Week,1);
    An later I do:

    Code:
    if((magia(1,Highs[2][0], separator) || magia(1,Lows[2][0], separator)) || ( (magia(1,Highs[1][0], separator) || magia(1,Lows[1][0], separator))))
    Everything is happiness until I try to migrate it to NT8, when I get an index error. If I use an alternative way to get the daily levels, no problem, but I can get an alternative way to get the weekly ones.

    I change Add for the NT8 function, so the first code looks like:

    Code:
    AddDataSeries(BarsPeriodType.Day,1);
    AddDataSeries(BarsPeriodType.Week,1);

    #2
    Hello Barrenas, and thank you for your question. I recommend the following at the beginning of your OnBarUpdate. Please let us know if it does not resolve your query or if there are any other questions we may answer.

    Code:
    [FONT=Courier New]protected override void OnBarUpdate()
    {
        foreach(int CurrentBarI in CurrentBars)
        {
            if (CurrentBarI < 1)
            {
                return;
            }
        }
    
    ...[/FONT]
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    72 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    39 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X