Hi all, I would really appreciate some help on a little issue im having.. I need a “check back ” to confirm if a condition had happened prior to a new signal being generated by a different indicator..
i.e.
Step 1:
When the Stochastic crosses above the oversold line (20),
Step 2:
Check back the Bollinger bands over 20 periods to see if the Price broke below the down band.
Step 3:
Take the trade based on both conditions
JSParticipant
Senior
Hi @normbeef
DefParam CumulateOrders = False
N=20
UnSet($BackCheck)
Sto = Stochastic[14,3](close)
LowerBB = Average[20](Close) - 2 * Std[20](Close)
If Sto Crosses Over 20 then
StoCheck = 1
else
StoCheck = 0
EndIf
If StoCheck = 1 then
For i = 0 to N-1
$BackCheck[LastSet($BackCheck)+1] = (LowerBB[i]/Close[i])
If $BackCheck[i] > 1 then
Buy 1 contract at Market
EndIf
Next
EndIf
If Sto Crosses Under 80 then
Sell at Market
EndIf
Try this version:
DefParam CumulateOrders = False
N=20
Sto = Stochastic[14,3](close)
LowerBB = Average[20](Close) - 2 * Std[20](Close)
If Sto Crosses Over 20 then
StoCheck = 1
EndIf
IF OnMarket THEN
StoCheck = 0
ENDIF
If StoCheck = 1 then
BBcheck = 0
IF Summation[N](close < LowerBB) THEN
BBcheck = 1
EndIf
ENDIF
If StoCheck AND BBcheck AND Not OnMarket then
BUY 1 Contract at Market
EndIf
set target pprofit 600
set stop ploss 200