• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Loading a day background data series

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

    Loading a day background data series

    I'm trying to write an indicator that gives the point of control on a daily basis and I need to load a daily background data series.

    Code:
     AddDataSeries( BarsPeriodType.Day, 1 );
    The problem is no matter how many days I load on the chart with this indicator I'm trying to write running, the value for CurrentBars[1] is always -1, which means that

    [CODE]
    if (CurrentBars[0] < BarsRequiredToPlot
    || CurrentBars[1] < BarsRequiredToPlot) return;
    [/CODE

    OnBarUpdate gets bounced out of at the beginning.

    Why in the world wouldn't I be able to load a daily background data series?

    #2
    Hello traderpards,

    Your code checks if either CurrentBars[0] is greater than BarsRequiredToPlot OR CurrentBars[1] is greater than BarsRequiredToPlot.

    Since you are using an or '||' either can be true. Both don't have to be true because you are not using an and '&&'.

    If CurrentBars[0] is greater than BarsRequiredToPlot and CurrentBars[0] is -1, the condition is still going to evaluate as true since CurrentBars[0] is greater than BarsRequiredToPlot.


    My guess is that it is loading a 1 day series, but your script is hitting an error before getting to the data of that series.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by victorsmith, Today, 06:00 AM
    0 responses
    3 views
    0 likes
    Last Post victorsmith  
    Started by sohailashraf, Yesterday, 10:18 PM
    0 responses
    6 views
    0 likes
    Last Post sohailashraf  
    Started by jjnc2006, Yesterday, 07:36 PM
    0 responses
    15 views
    0 likes
    Last Post jjnc2006  
    Started by futurenick, Yesterday, 06:26 AM
    1 response
    15 views
    0 likes
    Last Post nkhoi
    by nkhoi
     
    Started by NinjaCustomer, Yesterday, 12:29 PM
    2 responses
    16 views
    0 likes
    Last Post NinjaCustomer  
    Working...
    X