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

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 arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            61 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            9 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            48 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X