Hi All,
I written a program for automated trading and use this below indicator logic as a condition to put the trade. It used to work fine till last week but from today onwards its not working. In other words, it is not returning 1 when the last ten candles close price consistently above EMA20.
When i tested it further, until i check last four candles(including the current one) it works perfectly but when i increase it to last five candles it is giving abnormal results.. attached some screenshots related to this.
Lost quite a bit of money because of abnormal trades system put in. So, Any insight into this will be much appreciated.
EXPA20 = ExponentialAverage[20](close)
EXPA50 = ExponentialAverage[50](close)
i = 0
CloseABoveEXP20 = 1
While i <> 10 DO
if EXPA20 > close[i] then
CloseABoveEXP20 = 0
Endif
i = i+1
WEND
return (CloseABoveEXP20 and open > EXPA20 and close > EXPA20)
JSParticipant
Veteran
Hi @VarmaRudra
Try this one…
ExpA20 = ExponentialAverage[20](close)
ExpA50 = ExponentialAverage[50](close)
N=5 //Number of bars to check
C1=Summation[N](Close>ExpA20)=N
If C1 then
Signal=1
Else
Signal=0
EndIf
Return Signal
You are a star. Thank you. I wonder why it stopped working from Yesterday. I always that logic but your program is much better.
Try this one…
Hi JS,
Why would that help, you think ?
(I had been staring at the issue for 15 minutes before I gave up)
JSParticipant
Veteran
Sorry, I don’t understand your question…
This code works fine:
EXPA20 = ExponentialAverage[20](close)
CloseABoveEXP20 = summation[10](close > EXPA20)
return (CloseABoveEXP20 and open > EXPA20 and close > EXPA20)