Moxie indicator conversion
Forums › ProRealTime English forum › ProBuilder support › Moxie indicator conversion
- This topic has 5 replies, 2 voices, and was last updated 3 years ago by Nicolas.
Tagged: moxie
Viewing 6 posts - 1 through 6 (of 6 total)
-
-
04/22/2021 at 4:57 AM #167742
I am just wandering if anyone could help to convert moxie indicator and scanner from TOS (think of swim) to PRT.
Code as below
indicator
123# ST_Moxie_Hourly Indicatordeclare lower;DefineGlobalColor("UpTrend", Color.GREEN);DefineGlobalColor("DownTrend", Color.RED);DefineGlobalColor("NoTrend", Color.LIGHT_GRAY);def hP1a = AggregationPeriod.Day;def s5v = 12;def ul = Average( High * (1 + 4 * (High - Low) / (High + Low)), length = 14);def s5r = 26;def s5g = 9;def vc1 = ExpAverage(close(period = hP1a) , s5v) - ExpAverage(close(period = hP1a) , s5r);def m2 = AbsValue((close - Lowest(low, s5r)) - (Highest(high, s5g) - close)) / (Highest(high, s5g) - Lowest(low, s5g));def va1 = ExpAverage(vc1, s5g);plot Moxie = (vc1 - va1) * 3; def g1 = Cos(1.32 * 2 * Double.Pi / (s5g / 0.1));Moxie.SetStyle(Curve.FIRM);Moxie.SetLineWeight(2);Moxie.HideTitle();def l1 = Moxie < Moxie[1];def h1 = Moxie > Moxie[1];def sig = if l1 then yes else if sig[1] == yes and h1 == no then yes else no;Moxie.AssignValueColor(if sig then Color.RED else Color.UPTICK);plot zeroLine = if close[-1] > 0 then 0 else Double.NaN;zeroLine.setDefaultColor(Color.gray);zeroLine.SetStyle(Curve.FIRM);zeroLine.SetLineWeight(2);zeroLine.HideBubble();zeroLine.HideTitle();Trade Signal
123# ST_MoxiePriceSignal_Hourlydef hP1a = AggregationPeriod.Day;def s5v = 12;def ul = Average( High * (1 + 4 * (High - Low) / (High + Low)), length = 14);def s5r = 26;def s5g = 9;def vc1 = ExpAverage(close(period = hP1a) , s5v) - ExpAverage(close(period = hP1a) , s5r);def m2 = AbsValue((close - Lowest(low, s5r)) - (Highest(high, s5g) - close)) / (Highest(high, s5g) - Lowest(low, s5g));def va1 = ExpAverage(vc1, s5g);def Moxie = (vc1 - va1); plot crossingAbove = if Moxie[1] < 0 and Moxie > 0 then low(period = AggregationPeriod.DAY) else Double.NaN;plot crossingBelow = if Moxie[1] > 0 and Moxie < 0 then high(period = AggregationPeriod.DAY) else Double.NaN;crossingAbove.SetDefaultColor(Color.GREEN);crossingAbove.SetPaintingStrategy(PaintingStrategy.ARROW_UP);crossingBelow.SetDefaultColor(Color.RED);crossingBelow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);Scanner
123# ST_Moxie_Scan Scannerdeclare lower;def s5v = 12;def ul = Average( High * (1 + 4 * (High - Low) / (High + Low)), length = 14);def s5r = 26;def s5g = 9;def vc1 = ExpAverage(close , s5v) - ExpAverage(close , s5r);def m2 = AbsValue((close - Lowest(low, s5r)) - (Highest(high, s5g) - close)) / (Highest(high, s5g) - Lowest(low, s5g));def g1 = Cos(1.32 * 2 * Double.Pi / (s5g / 0.1));def va1 = ExpAverage(vc1, s5g);plot MoxieScan = ((vc1 - va1) * 3) > 0;04/22/2021 at 9:47 AM #16777104/23/2021 at 2:40 PM #16790004/23/2021 at 3:47 PM #167906Here is the translated code of Moxie indicator. Apply it twice, on the price chart in order to see the arrows of the trading signals and separated as an oscillator. Lot of useless code have been wiped out. This indicator seems to be a daily normalized MACD.
12345678910111213141516171819202122232425262728293031//# ST_Moxie_Hourly Indicators5v = 12s5r = 26s5g = 9timeframe(daily,updateonclose)vc1 = ExponentialAverage[s5v](close) - ExponentialAverage[s5r](close)m2 = Abs((close - Lowest[s5r](low)) - (Highest[s5g](high) - close)) / (Highest[s5g](high) - Lowest[s5g](low))va1 = ExponentialAverage[s5g](vc1)Moxie = (vc1 - va1) * 3l1 = Moxie < Moxie[1]h1 = Moxie > Moxie[1]//sig =if l1 thenr=255g=0elsif h1 thenr=0g=255endiftimeframe(default)if moxie crosses over 0 thendrawarrowup(barindex,low) coloured(r,g,0)elsif moxie crosses under 0 thendrawarrowdown(barindex,high) coloured(r,g,0)endifreturn Moxie coloured(r,g,0) style(line,2),0 coloured(168,168,168) style(line,2)04/23/2021 at 7:09 PM #16791404/26/2021 at 1:29 PM #168066Apply it twice, on the price chart in order to see the arrows of the trading signals and separated as an oscillator.
Just follow the instruction ^^ 🙄
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
Find exclusive trading pro-tools on
Similar topics: