Optuma Forums › Optuma Scripting › Pring’s Trend Deviation Script › Reply To: Pring’s Trend Deviation Script
April 17, 2022 at 8:34 pm
#67965
- Topics: 148
- Replies: 403
- Posts: 551
Hi Louis,
See if this code results in what you are looking for:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//Calculate Moving Averages MA1 = MA(BARS=21, STYLE=Exponential, CALC=Close); MA2 = MA(BARS=63, CALC=Close, STYLE=Exponential); //Calculate Output Plots //Plot1 = (MA1 / MA2); Plot1 = (MA1 / MA2) - 1; Plot2 = MA(Plot1, BARS=9, CALC=Close, STYLE=Exponential); //Plot3 = (Plot1 - Plot2); Plot3 = ((MA1 / MA2 ) - 1) - (MA(Plot1, BARS=9, CALC=Close, STYLE=Exponential)); //Define Output Plots Plot1.Linestyle = Solid; Plot1.Color = Black; Plot1.LineWidth = 2; Plot2.Linestyle = Dash; Plot2.Color = Red; Plot3.Plotstyle = Histogram; Plot3.Color = Gray; |
This is what is gives me:
Cheers
Trevor