NinjaTrader Mama/Fama indicator
NinjaTrader Mama/Fama indicator
03 Apr 2019, 04:36
HI everyone:
I would like to convert the following NinjaTrader indicator to cTrader (if it is already converted, please let me know where I can find it! :-) ) :
https://github.com/redrhinofx/NinjaTrader.Base/blob/master/NTBase/Indicator/%40MAMA.cs
While it seems pretty straight forward, the issue/problem I'm having is converting the private DataSeries variables into a cTrader equivalent.
For example, this code:
//HOW WOULD THESE BE DECLARED IN CTRADER? private Series<double> detrender; private Series<double> smooth; protected override void OnStateChange() { if (State == State.SetDefaults) { FastLimit = 0.5; IsOverlay = true; IsSuspendedWhileInactive = true; SlowLimit = 0.05; AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorDefault); } else if (State == State.DataLoaded) { //HOW WOULD THESE GET INITIALIZED IN CTRADER? detrender = new Series<double>(this); smooth = new Series<double>(this); } } protected override void OnBarUpdate() { if (CurrentBar < 6) return; if (CurrentBar == 6) { Default[0] = (High[0] + Low[0]) / 2; Fama[0] = Input[0]; return; } double period1 = period[1]; smooth[0] = (4 * Median[0] + 3 * Median[1] + 2 * Median[2] + Median[3]) / 10; //HOW IS "DETRENDER[0]" assigned when it doesn't appear that "SMOOTH[2]" has been set? //I don't know how "smooth[2]", "smooth[4]", etc, are set, or initialized. Can anyone help? detrender[0] = (0.0962 * smooth[0] + 0.5769 * smooth[2] - 0.5769 * smooth[4] - 0.0962 * smooth[6]) * (0.075 * period1 + 0.54);
How is "smooth[2]" set and where is its value coming from? Is it just the closing price of the 2nd bar for any given time frame?
Thank you,
Replies
firemyst
03 Apr 2019, 10:42
RE:
ClickAlgo said:
Try this FRAMA indicator.
https://clickalgo.com/ctrader-fractal-adaptive-moving-average-indicator
Paul Hayes
Sales & Marketing
Email: contact@clickalgo.com
Phone: (44) 203 289 6573
Website: https://clickalgo.comTwitter | Facebook | Google+ | YouTube | Pinterest | LinkedIn
Thank you for the suggestion! After having had a look at it, it doesn't quite do the same thing or what I'm looking for from the Ninja Trader MAMA indicator.
So still hoping some of the brilliant minds on here are able to answer my questions?
@firemyst
ClickAlgo
03 Apr 2019, 09:29
Try this FRAMA indicator.
https://clickalgo.com/ctrader-fractal-adaptive-moving-average-indicator
Paul Hayes
Sales & Marketing
Email: contact@clickalgo.com
Phone: (44) 203 289 6573
Website: https://clickalgo.com
Twitter | Facebook | Google+ | YouTube | Pinterest | LinkedIn
@ClickAlgo