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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      57 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      19 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      9 views
      0 likes
      Last Post cre8able  
      Working...
      X