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

Ema Std dev

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

    Ema Std dev

    Hi

    Ive copied the bollinger code and changed the sma to ema but get loads of errors

    This is my code

    #region Variables
    // Wizard generated variables
    // User defined variables (add any user defined variables below)
    private double numStdDev = 3.5;
    private int period = 55;
    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Add(new Plot(Color.Black, "Upper band"));
    Add(new Plot(Color.Blue, "Middle band"));
    Add(new Plot(Color.Black, "Lower band"));
    Overlay = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {

    double emaValue = EMA(Period)[0];
    double stdDevValue = StdDev(EMA,Period)[0];
    Upper.Set(emaValue + NumStdDev * stdDevValue);
    Middle.Set(emaValue);
    Lower.Set(emaValue - NumStdDev * stdDevValue);

    i seem to get errors for the last 5 line of code with cs1503,0118,1502 and NT1503 errors.
    Anyone show me where im going wrong?
    Thanks

    #2
    Hello Dyversity,

    Thanks for your post and welcome to the forums.

    When you copied the code, did you also copy the information in the area of #region Properties?
    The information would be between #region Properties and #endregion.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Problem solved!!
      Thanks for the reply

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ScottW, Today, 06:09 PM
      0 responses
      2 views
      0 likes
      Last Post ScottW
      by ScottW
       
      Started by Board game geek, 10-29-2023, 12:00 PM
      14 responses
      244 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      4 responses
      56 views
      0 likes
      Last Post sonia0101  
      Started by cmtjoancolmenero, Today, 03:58 PM
      0 responses
      9 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by Segwin, 05-07-2018, 02:15 PM
      11 responses
      1,778 views
      0 likes
      Last Post aligator  
      Working...
      X