the C code?.. nice… where do I have to go to learn how to code in C specifically for trading? Sad to see the true potential of the system though. It held so much promise.
That’s interesting. Just out of curiosity I replace the EMA with a Lowpass filter, and removed the profit target. The system now looks much better. This is the new code:
function run()
{
var *Price = series(price());
var *EMA5 = series(LowPass(Price,5));
var *EMA10 = series(LowPass(Price,10));
var *RSI10 = series(RSI(Price,10));
Stop = 50*PIP;
int crossed = 0;
if(crossOver(EMA5,EMA10))
crossed = 1;
else if(crossUnder(EMA5,EMA10))
crossed = -1;
if(crossed == 1 && crossOver(RSI10,50))
enterLong();
else if(crossed == -1 && crossUnder(RSI10,50))
enterShort();
}
Nice… The tutorial looks like something I have been searching for for months. will shortening my journey towards automated trading. Thanks so much mate… Think you can really help some people here by creating a thread and posting the lessons, so it can be more interactive.
The trailing stop reduces the profit, just as the profit target.
However the strategy has indeed potential, simple as it is. I have now made a few modifications and run a WFO optimization, which is normally a hard test if a strategy is good. This is the new script:
The strategy works well with several different assets, which is also a strong indicator that it stays profitable even when the market changes. This is the equity curve:
Sure, any signal triggers a new trade. It makes no sense not to enter a new trade when some previous trade was not yet closed. When I prevent concurrent trades, the strategy is still profitable, but the profit goes down somewhat.
Yes. It does normally not matter if the previous trade is winning or losing. When a signal is triggered, we have a situation where entering a trade has a positive expectancy, regardless of the status of previous trades.
There can be systems with a large correlation horizon where this is different, but that are special cases.
The price curve is often a mixture of cycles with different frequencies; a lowpass filter attenuates all cycles below a given frequency. Thus it has a similar effect as a moving average. In fact an EMA is a 1-pole lowpass filter. The LowPass function used in the script however is a 2-pole filter, which is more complex but has the huge advantage of no lag below the filter frequency. It thus generates signals earlier. We’ll deal with lowpass filters in part 2 of the automated trading course.