Hello.
I m jut trying to use a simple TS (please see below) on my IG demo account, with the idea that if it works I will switch it over onto the live one. However, I have been trying to backtest it and occasionally trades are not taken even though the signal is there. I am new at programming in PRT and I am not sure I have coded well. Can any one help me?
Apologies in advance is this is not the right place to post this
Thanks
// Definition of code parameters
DEFPARAM CumulateOrders = False// Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = ExponentialAverage[5](close)
indicator2 = ExponentialAverage[100](close)
c1 = (indicator1 CROSSES OVER indicator2)
indicator3 = ExponentialAverage[5](close)
indicator4 = ExponentialAverage[200](close)
c2 = (indicator3 CROSSES OVER indicator4)
IF c1 AND c2 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator5 = ExponentialAverage[5](close)
indicator6 = ExponentialAverage[100](close)
c3 = (indicator5 CROSSES UNDER indicator6)
IF c3 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator7 = ExponentialAverage[5](close)
indicator8 = ExponentialAverage[100](close)
c4 = (indicator7 CROSSES UNDER indicator8)
indicator9 = ExponentialAverage[5](close)
indicator10 = ExponentialAverage[200](close)
c5 = (indicator9 CROSSES UNDER indicator10)
IF c4 AND c5 THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator11 = ExponentialAverage[5](close)
indicator12 = ExponentialAverage[100](close)
c6 = (indicator11 CROSSES OVER indicator12)
IF c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 150
Hello,
I have moved your question in a new topic.
About your problem, you are trying to test moving average cross conditions of 3 of them at the same time (moving average 5, 100 and 200 in conditions c1,c2,c4,c5) which will rarely occur! So I believe that’s where is the trouble with your tests.
Hi,
thanks for getting back to me,
I have tried to use a cross over system with two EMA (5 and 200); however, when the market is going sideways (I trade the dax) the trading system starts opening position up and down, losing profits. I was trying to make it open position only in the event of a bigger move by adding a 100 EMA. Do you know any command or any script in the forum that could help me?
thanks
Massimiliano