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

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 helpwanted, Today, 03:06 AM
    1 response
    10 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    8 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    5 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    242 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    386 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X