Hi all,
This is my first attempt to write an algorithm based on my own (and many others) trading strategies: The idea is to buy when the fast ema crosses the slow ema and the stock is bullish (price higher than a slow sma, e.g., 100 sma); and to short the stock when the conditions are the exact opposite.
I only use indexes (the ones that I remember anyway) in order to ensure high volume and interest.
As you see from the results, the drawdown is huge which I think the reason is that in real trading, the transactions are performed directly after the crossing. In order to do this, I need the ema values for the previous days. I however, have no idea how to access the ema values or price values for past days and only use the current price or ema values. Can anyone help me here and explains how to do that? I would really appreciate that.
In addition, when checking the transactions, I could not see that a shorting was taking place. Am I doing something wrong here?
Regards