Thank You
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Trying to find Laguerre RSI code
Collapse
X
-
Trying to find Laguerre RSI code
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
4hello0%0confused on these polls100.00%4Tags: None
-
Trying to find the same. Attached I think is the code for NT7 LguerreRSI, would appreciate if someone can help converting it to NT8. Thanks.Attached Files
-
Oh thanks man. If anyone is willing to pay for it futures.io has it if you buy there elite membership.
Comment
-
So I tried coding the indicator but when I try to display it on the chart it comes up blank. Any help would be 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]; 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) { } } 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 + Close[1])/2; double h; if(High > close[1]){ h = High; } else{ h = Close[1]; } double l; if(Low < close[1]){ l = Low; } else{ l = Close[1]; } double c = (Close[0] + h + l + o)/4; double a = SUM(Math.Max(High, Close[0])-Math.Min(Low, Close[0]),8)[0]; double b = Math.Max(High, NFE)- Math.Min(Low, 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 } }
Comment
-
Hello adaeiqendqw,
Do any errors appear on the Log tab of the Control Center when loading or reloading the script?
Add prints to the script to debug the code.
Start by printing the time of the bar outside of all conditions.
Below is a link to a forum post that demonstrates using prints to understand behavior.
Does the print of the time appear in the output window?
Print the calculated value that is going to be set to the plot (not the plot value, but the calculated value).
Is this value what you expect?Chelsea B.NinjaTrader Customer Service
Comment
-
Oh thanks for pointing out the log.I get a "error on calling CalculateMinMax method on bar 846 the calculation results in unrenderable value"
I dont override the CalculateMinMax method.
What does this mean?
Comment
-
Thanks so I think I narrowed the issue down. Plotting Gamma, gamma = alpha, with the alpha in the LRSI calculation as a static .5 is fine. Only issues is that Gamma comes out as negative. When I set the alpha in LRSI calculation to my dynamic calculation then the indicator does not show. I believe the issue is in this line:
I believe CU and CD are coming out negative.HTML Code:LRSI[0] = (cu / (cu + cd));
My question is why alpha is coming out as a negative number?
Thanks!
Comment
-
So I was right with the issue is cu and cd being 0 or Nan, this seems to stem form the fact that gamma is negative.HTML Code:protected override void OnBarUpdate() { if (IsFirstTickOfBar) { L0[1] = L0[0]; L1[1] = L1[0]; L2[1] = L2[0]; L3[1] = L3[0]; } if (CurrentBar < 8) return; if (!IsFirstTickOfBar) { // If the high or low does not change then do not calculate every bar event. // Range bound intrabar if (Close[0] <= High[0] && Close[0] >= Low[0]) return; } 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(8); Print(alpha); 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; } Print("CU and CD"); Print(cd); Print(cu); Print("RSI"); Print(LRSI[0]); }
HTML Code:NaN -2.79993731977524 CU and CD NaN 0 RSI NaN -2.86410149202079 CU and CD NaN 0 RSI NaN -2.91598802476986 CU and CD NaN 0 RSI NaN Indicator 'LaguerreRSIFE': Error on calling 'CalculateMinMax' method on bar 858: The calculation results in unrenderable values.
It seems that gamma/alpha are negative because math.log10(NFE) is equal to a negative number, -2.91. However log base 10 of 8 should be a positive number. Am I using a wrong log function?
Comment
-
adaeiqendqw,Originally posted by adaeiqendqw View PostSo I was right with the issue is cu and cd being 0 or Nan, this seems to stem form the fact that gamma is negative.HTML Code:protected override void OnBarUpdate() { if (IsFirstTickOfBar) { L0[1] = L0[0]; L1[1] = L1[0]; L2[1] = L2[0]; L3[1] = L3[0]; } if (CurrentBar < 8) return; if (!IsFirstTickOfBar) { // If the high or low does not change then do not calculate every bar event. // Range bound intrabar if (Close[0] <= High[0] && Close[0] >= Low[0]) return; } 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(8); Print(alpha); 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; } Print("CU and CD"); Print(cd); Print(cu); Print("RSI"); Print(LRSI[0]); }
HTML Code:NaN -2.79993731977524 CU and CD NaN 0 RSI NaN -2.86410149202079 CU and CD NaN 0 RSI NaN -2.91598802476986 CU and CD NaN 0 RSI NaN Indicator 'LaguerreRSIFE': Error on calling 'CalculateMinMax' method on bar 858: The calculation results in unrenderable values.
It seems that gamma/alpha are negative because math.log10(NFE) is equal to a negative number, -2.91. However log base 10 of 8 should be a positive number. Am I using a wrong log function?
Please, how and where do you define gammaVar[0] in gammaVar[0] = Math.Max(High[0], Close[0])-Math.Min(Low[0], Close[0]); ?
omololu
Comment
-
Hello adaeiqendqw,
I am not able to assist with your custom calculations, however this thread will remain open for any community members that would like to assist you with these calculations.
Below is a link to the microsoft documentation on Math.Log().
You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our NinjaTrader Ecosystem team follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by adaeiqendqw View PostHey! 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
adaeiqendqw and victorNT,
I converted the Laguerre NT7 version provided in post #2 by victorNT and which works quite well.
I note that adaeiqendqw seems to be doing a new NT8 version with some new features. It would be great if he can build his NT8 version based on mine ?
Omololu
LaguerreRSI.zip
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
602 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
559 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
559 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment