raeParticipant
New
hi all,
i have generate a code on ema crossing strategy. however, it seems like the gain is good but the exit point are not excellent. appreciate anyone could help me optimise this code for better exit prices. thanks in advance.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = ExponentialAverage[620](close)
c1 = (close[1] CROSSES OVER indicator1)
IF c1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator2 = ExponentialAverage[34](close)
c2 = (close CROSSES OVER indicator2)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator3 = ExponentialAverage[620](close)
c3 = (close[1] CROSSES UNDER indicator3)
IF c3 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit short positions
indicator4 = ExponentialAverage[89](close)
c4 = (close CROSSES OVER indicator4)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 30
Post moved to ProOrder forum as that is a more relevant place for strategy questions.
It may help a lot if you tell everyone which instrument you are testing it on and what time frame you are testing it on.
Do you know that you have … over (entry) & over (exit) for Longs and under (entry) & over (exit) for Shorts?
I know it can work good like that but just thought maybe your intention was … over (entry) & under (exit) for Longs?
raeParticipant
New
Thank you all for the reply.
Here is my strategy:
Long entry
Condition 1 – Bar crosses over EMA 620
Condition 2 – MACD crosses over zero
Condition 3 – Stochastic < 45
Exit Long
Condition - Stochastic > 55
Short entry
Condition 1 – Bar crosses under EMA 620
Condition 2 – MACD crosses under zero
Condition 3 – Stochastic > 55
Exit Short
Condition – Stochastic < 45
Time frame, I am looking at 30min
Thanks all.