// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
divergencePRICE = (close < lowest[6](close[1]))
divergenceRSI = (RSI[2](RSI[4](close)) > lowest[6](RSI[2](RSI[4](close))[1]))
div = divergenceRSI and divergenceprice
downFAST = (RSI[2](RSI[4](close)) CROSSES UNDER Average[10](RSI[4](close)))
downMID = (RSI[4](close) CROSSES UNDER Average[10](RSI[4](close)))
downSLOW = (RSI[6](RSI[4](close)) CROSSES UNDER Average[10](RSI[4](close)))
down = downfast and downmid and downslow
div = divergenceRSI and divergenceprice
buytime = div and down
IF buytime THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator9 = Average[20](close)
c6 = (close CROSSES UNDER indicator9)
IF c6 THEN
SELL AT MARKET
ENDIF
Buggy code or my bad?
Wall st 1h.
edit: first yellow arrow is pointing to the wrong rsi dip but same goes for the actual dip. Its below the lowest low of last 6 rsi and my condition is that the current RSI is ABOVE the last 6 rsi lowest lows. Not sure if its buggy stuff or just me thats thinking wrong somehow.
edit2: this is a shit code, im just playing around.
Did you “graph” variables to compare with the indicator?