robertogozzi

SHI - Simple Harmonic Index

Category: Indicators By: robertogozzi Created: March 15, 2019, 10:38 AM
March 15, 2019, 10:38 AM
Indicators
12 Comments
SHI - Simple Harmonic Index

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"

Download
Filename: SHI-Simple-Harmonic-Index.itf
Downloads: 147
Download
Filename: SHI-Simple-Harmonic-Index.txt
Downloads: 49
robertogozzi
robertogozzi Legend
Roberto https://www.ots-onlinetradingsoftware.com
Author’s Profile

Comments

luxrun
6 years ago
#

Now is ok! Thanks a lot

robertogozzi
6 years ago
#

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.

luxrun
6 years ago
#

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

robertogozzi
8 years ago
#

//Ti = ((close > Cy) * Tt) OR (((close Cy) THEN Ti = Tt ELSE Ti = -Tt ENDIF

robertogozzi
8 years ago
#

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:

luxrun
8 years ago
#

Ok, thank you

robertogozzi
8 years ago
#

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.

luxrun
8 years ago
#

Roberto, another request concerning the code: is it possible to change the ema 14 with another period (10 or 20 for example)?. Thank you

robertogozzi
8 years ago
#

Bigger than needs to be replacec by the symbol >

luxrun
8 years ago
#

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

robertogozzi
8 years ago
#

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.

swapping
8 years ago
#

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"

ProRealCode ProRealCode
Loading...