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
1 2 3 4 5 6 7 8 9 10 11 12 |
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" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
excellent robert, here are two lines to enhance this code with color histograms
just after line 11
if Shi “bigger than” 0 then
r = 220
g = 20
else
r = 20
g = 220
endif
return Shi coloured(r,g,0) style(histogram) as “Shi”, 0 coloured by 0 as “0”
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.
Dear swapping I tried to insert your instructions to color the histograms but I have an error on “bigger than”. In fact I have already modified the SHI with the color zones that it offers prorealtime to improve the visualization. Thank you
Bigger than needs to be replacec by the symbol >
Roberto, another request concerning the code: is it possible to change the ema 14 with another period (10 or 20 for example)?. Thank you
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.
Ok, thank you
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:
//Ti = ((close > Cy) * Tt) OR (((close Cy) THEN
Ti = Tt
ELSE
Ti = -Tt
ENDIF
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
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.
Now is ok! Thanks a lot