Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

problem with dataseries... I think

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

    problem with dataseries... I think

    Hello,

    I"m not at all a "good" coder, but have had some success using dataseries in the past. The script code below doesn't work (doesn't paint anything in pane, just blank). I did some debugging (commenting out things one at a time) and it seems that the problem stems from when the code tries to access myDataSeries[1]. When the code calls for myDataSeries[0], it seems ok.

    Here is the code:

    myValue = EMA(Typical,period)[0];
    myDataSeries.Set(myValue);

    myValue1 = 2*(myDataSeries[0]-myDataSeries[1])/(myDataSeries[0]+myDataSeries[1]);
    myDataSeries2.Set(myValue1);
    Plot0.Set(100*EMA(myDataSeries2,3)[0]);

    And yes, I have the proper variables declared and the dataseries initialized in the proper place. Any ideas? I'm hoping I've done something really stupid

    Thanks much for any help!

    #2
    Isn't this what you want as the last statement

    Value.Set(100*EMA(myDataSeries2,3)[0]);
    whitmark
    NinjaTrader Ecosystem Vendor - Whitmark Development

    Comment


      #3
      Hello and thanks for your help.

      I don't think that's what I want, but I can tell you during debugging, I just commented out my last line (with the Plot0) in it and instead just had Plot0.Set(High[0]). Even that didn't work. If I remove all reference to myDataSeries[1] and replace it with something trivial, then the indicator will plot.

      Comment


        #4
        Do you have on top of BarUpdate() something like:
        if (CurrentBar < Period) return; ?

        Comment


          #5
          no I do not, I'll give that a try, thanks.

          Comment


            #6
            S W E E T!!!

            Thank you both for your help. Testing for enough bars present seems to have done the trick.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            155 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            90 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            137 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            130 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            107 views
            0 likes
            Last Post CarlTrading  
            Working...
            X