SHI – Simple Harmonic Index
A Time Cycle Oscillator – Published on IFTA Journal 2018 by Akram El Sherbini (pages 78-80)
(http://www.ftaa.org.hk/Files/2018130101754DGQ1JB2OUG.pdf)
Bullish signals are generated when SHI crosses over 0
Bearish signals are generated when SHI crosses under 0
DEFPARAM CalculateOnLastBars = 1000
//EmaPeriods = 14 //Number of Periods of the EMA
EmaPeriods = max(2,min(999,EmaPeriods)) //range 2-999
Cy = close[1]
Vt = close - Cy
Vy = Vt[1]
Att = Vt - Vy
Ema = average[EmaPeriods,1](Att)
Tt = sqrt(abs(Vt/Ema))
Ti = ((close > Cy) * Tt) OR (((close <= Cy) * Tt) * -1)
Shi = average[EmaPeriods,1](Ti)
RETURN Shi AS "Shi",0 AS "0"
You must be logged in to post a comment.
WPO should work as posted at https://www.prorealcode.com/prorealtime-indicators/wpo-wave-period-oscillator/. Copy lines 16-20 to SHI replacing line 10. The five lines are the same in both indicators. PRT said they had worked out math with boolean values, but it doesn't seem so.
Roberto, I tried again to use both the SHI indicator and the WPO oscillator but they don't work on version 11 of Prorealtime. Graphically you see a solid line and nothing changes if the periods of Ema and Sma vary. Sorry, but having read the pdf you indicated I find this kind of cyclic indicators interesting, thanks
//Ti = ((close > Cy) * Tt) OR (((close Cy) THEN Ti = Tt ELSE Ti = -Tt ENDIF
I just discovered that ProOrder (for automated strategies) does not evaluate the expression in line 10 correctly (as Probuilder does), so if you want to embed the code in your strategy you need to replace that line with:
If you import the .ITF file you may use the indicator properties to set periods. If you Copied & Pasted it then you'll have to define that variable yourself.
Bigger than needs to be replacec by the symbol >
Thank you swapping, much appreciated. I usually do not hard code graphic styles and colours within my code, as this makes it impossible for users to change settings from the indicator's properties, though, unless they change the code.
Now is ok! Thanks a lot