Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Indicator not displaying on chart

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

    Custom Indicator not displaying on chart

    Hey! so I coded the RSI Laguerre FE indicator for NT 8 but it is not displaying on the chart. Any help is appreciated.


    HTML Code:
    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.DrawingTools;
    #endregion
    
    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class LaguerreRSIFE : Indicator
    {
    
    private double[] L0 = new double[2];
    private double[] L1 = new double[2];
    private double[] L2 = new double[2];
    private double[] L3 = new double[2];
    private Series<double> gammaVar;
    
    
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"RSI laguerre with FE";
    Name = "LaguerreRSIFE";
    Calculate = Calculate.OnPriceChange;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = false;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    NFE = 8;
    AddPlot(Brushes.Aqua, "LRSI");
    AddPlot(Brushes.Orange, "Gamma");
    AddLine(Brushes.Gray, 1, "FEH");
    AddLine(Brushes.Gray, 1, "FEL");
    AddLine(Brushes.Snow, 1, "OB");
    AddLine(Brushes.Snow, 1, "OS");
    }
    else if (State == State.Configure){}
    if (State == State.DataLoaded){
    gammaVar = new Series<double>(this, MaximumBarsLookBack.Infinite);
    }
    }
    
    protected override void OnBarUpdate()
    {
    if (IsFirstTickOfBar)
    {
    L0[1] = L0[0];
    L1[1] = L1[0];
    L2[1] = L2[0];
    L3[1] = L3[0];
    }
    double o = (Open[0] + Close[1])/2;
    double h = Math.Max(High[0], Close[1]);
    double l = Math.Min(Low[0], Close[1]);
    double c = (Close[0] + h + l + o)/4;
    double z = Math.Max(High[0], Close[0])-Math.Min(Low[0], Close[0]);
    gammaVar[0] = Math.Max(High[0], Close[0])-Math.Min(Low[0], Close[0]);
    double a = SUM(gammaVar,8)[0];
    double b = Math.Max(High[0], NFE)- Math.Min(Low[0], NFE);
    double alpha = Math.Log10(a/b)/Math.Log10(NFE);
    Gamma[0] = alpha;
    L0[0] = (1-alpha) * c + alpha * L0[1];
    L1[0] = - (1 - alpha) * L0[0] + L0[1] +(1 - alpha) * L1[1];
    L2[0] = - (1 - alpha) * L1[0] + L1[1] +(1 - alpha) * L2[1];
    L3[0] = - (1 - alpha) * L2[0] + L2[1] +(1 - alpha) * L3[1];
    double cu = 0;
    double cd = 0;
    if (L0[0] >= L1[0])
    cu = L0[0] - L1[0];
    else
    cd = L1[0] - L0[0];
    
    if (L1[0] >= L2[0])
    cu += L1[0] - L2[0];
    else
    cd += L2[0] - L1[0];
    
    if (L2[0] >= L3[0])
    cu += L2[0] - L3[0];
    else
    cd += L3[0] - L2[0];
    if (cu + cd != 0){
    LRSI[0] = (cu / (cu + cd));
    }
    else{
    LRSI[0] = 0;
    }
    }
    
    #region Properties
    [NinjaScriptProperty]
    [Range(1, double.MaxValue)]
    [Display(Name="NFE", Description="Value for gamma calculation", Order=1, GroupName="Parameters")]
    public double NFE
    { get; set; }
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> LRSI
    {
    get { return Values[0]; }
    }
    
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> Gamma
    {
    get { return Values[1]; }
    }
    
    
    
    
    #endregion
    
    }
    }
    Last edited by adaeiqendqw; 12-27-2020, 04:48 PM.

    #2
    Hello adaeiqendqw,

    May I confirm that you are not creating duplicate posts and that this is a new unique inquiry that is not related to the post linked below?
    Hey! So I was trying to use the NT8 Laguerre RSI indicator posted in the other threads but all the links seem to be broken. If someone could send/post the code for the RSI Laguerre for NT8 that would be great. Thank You
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Oh my aplogies for making a duplicate post, new to the forum

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      600 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      347 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      558 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X