Hello,
I’m looking for a code to back test this strategy based on these conditions:
Buy script:
-
trading range is -1 day chart- Heiken Ashi giving a “BUY” signal
-
If above condition is successful, then look for 15 Min Heiken Ashi Chart, and check if CCI(20 period) is above “0”, and RSI(10 period) is less than 30.
sell script:
whichever comes first:
-
if 15 minute heiken ashi gives a sell signal
-
or if RSI(10 period) is above 60, and CCI (20 period) is above 250
Thanks,
Vamsi
hElLO tRaDeR,
Comparing candles from different timeframes with Tradescript language is not possible.
Heiken Ashi codes are available for you to use with Pi, but you can use them only for Pi backtest and not on the Scanner.
However, if you still need the tradescript ( with certain modifications to your main strategy) let me know, I can compile it.
****************FOLLOW UP*****************
BUY SCRIPT:
SET HC = (OPEN+HIGH+LOW+CLOSE)/4
SET HO = (REF(OPEN,1) + REF(CLOSE,1))/2
SET HH = MAXOF(HIGH, MAXOF(HC, HO))
SET HW = MINOF(LOW, HO, HC)
HO = HW AND
CCI(20,SIMPLE) > 0
SELL SCRIPT:
SET HC = (OPEN+HIGH+LOW+CLOSE)/4
SET HO = (REF(OPEN,1) + REF(CLOSE,1))/2
SET HH = MAXOF(HIGH, MAXOF(HC, HO))
SET HW = MINOF(LOW, HO, HC)
HH = HO OR
CCI(20,SIMPLE) > 170
The RSI function not included, The backtest engine generating error when adding the RSI
As said earlier, this will work only on the backtest engine, since the Pi scanner as of now is not accepting more than one set function on its SCRIPT TAB.
Try it and let me know, How it goes.
If we cannot compare between two timeframes, can we do this ?
- look for 15 Min Heiken Ashi Chart, and check if CCI(20 period) is above “0”, and RSI(10 period) is less than 30.
sell script:
whichever comes first:
- if 15 minute heiken ashi gives a sell signal
- or if RSI(10 period) is above 60, and CCI (20 period) is above 170
The answer has been updated with your request.
this code did not work and threw an error.