I saw this code on tradingview that I am trying to ode in prorealcode without luck. Please help
//@version=4
study(“Chart Traders: PivotBoss – Oscillator”, overlay=false)
shortPEMA = input(8)
medPEMA = input(13)
longPEMA = input(21)
smaPeriods = input(1)
fPivot = hlc3
fPEMADiff1 = (ema(fPivot, shortPEMA) – ema(fPivot, longPEMA))
fPEMADiff2 = (ema(fPivot, medPEMA) – ema(fPivot, longPEMA))
fPEMADiff3 = (ema(fPivot, shortPEMA) – ema(fPivot, medPEMA))
fPEMASep = ((fPEMADiff1 + fPEMADiff2 + fPEMADiff3) / fPivot) * 5
fPSepSMA = sma(fPEMASep, smaPeriods)
col = if fPEMASep > 0 and fPEMASep > fPEMASep[1]
color.gray
else
if (fPEMASep < fPEMASep[1]) or (fPEMASep < 0 and fPEMASep < fPEMASep[1])
color.red
else
if fPEMASep > fPEMASep[1]
color.gray
else
color.new(color.black, 100)
plot(fPEMASep, title=”PEMASep”, color=col, linewidth=3, style=plot.style_columns)
plot(fPSepSMA, title=”PSepSMA”, color=color.gray, linewidth=2)
plot(0, title=”ZERO”)
Based on the above, this is the original code for the EMA of pivots on Price. Now I want to create an oscillator based the elements used in the code shown below.
// Daily Pivot
Timeframe(Daily,UpdateOnClose)
MyPivot = (high + low + close) /3 //Daily Pivot
//MyEma = Average[ave,1](MyPivot) //Ema8 of Daily Pivot
Pema13 = Average[13,1](MyPivot)
Pema34 = Average[34,1](MyPivot)
Pema55 = Average[55,1](MyPivot)
Timeframe(default)
Oscilator wil be smilr to the attaced below
RETURN Pema13 AS “Pema13”, Pema34 as “Pema34” , Pema55 as “Pema55”