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

Why do I lose my plots?

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

    Why do I lose my plots?

    Although I've worked with Tradestation's Easy Language for more than 10 years, I'm having difficulty grasping some of the nuance of NinjaScript.

    Can anyone tell me why the following will work fine and I get the appropriate plot:


    fastEma.Set(SMA(Input, Fast)[0]);
    slowEma.Set(SMA(Input, Slow)[0]);

    double macd = fastEma[0] - slowEma[0];
    double Ymacd = fastEma[1] - slowEma[1];
    double macdAvg = (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];

    Value.Set(macd);
    Avg.Set(macdAvg)
    Diff.Set(macd);


    But after I make the following change the indicator compiles just fine but all plots disappear (line #5 is new):



    fastEma.Set(SMA(Input, Fast)[0]);
    slowEma.Set(SMA(Input, Slow)[0]);

    double macd = fastEma[0] - slowEma[0];
    double Ymacd = fastEma[1] - slowEma[1];
    double YYmacd = fastEma[2] - slowEma[2];
    double macdAvg = (2.0 / (1 + Smooth)) * macd + (1 - (2.0 / (1 + Smooth))) * Avg[1];

    Value.Set(macd);
    Avg.Set(macdAvg);
    Diff.Set(macd);

    Thanks in advance.

    Bob

    #2
    Please see the Control Center logs for errors. You likely do not have enough bars loaded. Please see this tip for how to address: http://www.ninjatrader-support2.com/...ead.php?t=3170
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Yep - that was it. Thank you very much for the quick response.

      Bob

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by f.saeidi, Today, 11:02 AM
      0 responses
      0 views
      0 likes
      Last Post f.saeidi  
      Started by geotrades1, Today, 10:02 AM
      3 responses
      10 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by rajendrasubedi2023, Today, 09:50 AM
      3 responses
      15 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by lorem, Today, 09:18 AM
      2 responses
      11 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by geddyisodin, Today, 05:20 AM
      4 responses
      30 views
      0 likes
      Last Post geddyisodin  
      Working...
      X