Hi all
I’m looking to integrate pivot points as a trend filter in my algo trading and I haven’t yet managed to find out best take advantage of this.
looking at Vonasi’s sentiment analysis:
Pivot Line Analysis Market Sentiment of Every Candle
Anyone got any ideas on how to successfully implement this in an automatic strategy in order to filter our bullish / bearish trends and avoid ranging markets? I’ve tried Vonasis code but struggling to get good results.
I’m hoping it could work as a universal trend indicator along different markets without needing to optimise parameters which may cause further overfitting. Is that a viable approach?
My idea is to use this on a higher timeframe (e.I. 1h or 4h) and use lower time for entry points based on momentum indicators, in the direction of the trend and to avoid ranging markets.
This one will enter when the indicator (embedded into the strategy, instead of calling it and using only the Trending code, UP and DOWN) signals an UP or DOWN condition + CLOSE crosses a SMA (either UPwards or DOWNwards) and it may reverse:
DEFPARAM CumulateOrders = FALSE
H1 = High[0]//High
L1 = Low[0]//Low
C = Close[0]//Close
HH1 = High[1]//High
LL1 = Low[1]//Low
CC = Close[1]//Close
Pivot1 = (HH1 + LL1 + CC) / 3
R11 = 2*((HH1 + LL1 + CC) / 3)- LL1
S11 = 2*((HH1 + LL1 + CC) / 3)- HH1
Pivot = (H1 + L1 + C) / 3
R1 = 2*((H1 + L1 + C) / 3)- L1
S1 = 2*((H1 + L1 + C) / 3)- H1
Flag = 0
//Up Pivot
IF R1 > R11 and S1 > S11 THEN
Flag = 1
ENDIF
//Down Pivot
IF R1 < R11 and S1 < S11 THEN
Flag = -1
ENDIF
////////////////////////////////////////////////////
LongCond = close > average[200,0](close) AND Not LongOnMarket AND Flag = 1
ShortCond = close < average[200,0](close) AND Not ShortOnMarket AND Flag = -1
////////////////////////////////////////////////////
IF LongCond THEN
BUY AT Market
ELSIF ShortCond THEN
SELLSHORT AT Market
ENDIF
SET STOP pLOSS 100
SET TARGET pPROFIT 300