AbzParticipant
Veteran
Hello
anyone that can help with a code for delaying before enter the market. If all conditions meet then delay x candles before entering the market.
Save BARINDEX when all conditions are met and start counting each bar while conditions are still valid.
After the number of bars you like let the code enter a trade.
AbzParticipant
Veteran
Hello
Do you have any examples on the code below?
IF not onmarket AND c1 AND c2 AND c3 AND c4 AND c5 THEN
Buy pos AT MARKET
ENDIF
Do you need the conditions to be met and then just wait a certain number of bars or do you need the conditions to be met and then met again at each bar for a certain number of bars?
AbzParticipant
Veteran
just need the conditions to be met once and then wait certain amount of bars.
BarsToWait = 6
pos = 1
IF not onmarket and c1 and c2 and c3 and c4 and c5 then
flag = 1
startindex = barindex
ENDIF
if flag and (barindex - startindex) = BarsToWait
Buy pos at market
Flag = 0
endif
Not tested.