Hello,
My strategy is:
General Setup:
- Currency Pair AUD/USD
- Take Profit: .0008
- Stop Loss: .0005
- Close all trades before weekend
- MACD (12,26, 9)
- RSI (14 period)
- ATR (14 period)
Long Setup:
- Close > 9 EMA ( 5 minute )
- Open > 9 EMA ( 5 minute )
- Close < Open ( 5 minute )
- 9 EMA > 50 EMA ( 5 minute )
- RSI < 65 and > 58 ( 5 minute )
- MACD > .00005 ( 5 minute )
- ATR > .00025 ( 5 minute )
- MACD Value of Current Bar > MACD Value 1 Bar Ago at the Close ( 5 minute and 1 Hour)
- MACD Difference > 0 ( 5 minute and 1 Hour )
Short Setup:
- Close < 9 EMA ( 5 minute )
- Open < 9 EMA ( 5 minute )
- Close > Open ( 5 minute )
- 9 EMA < 50 EMA ( 5 minute )
- RSI > 38 and < 45 ( 5 minute )
- MACD < -0.00005 ( 5 minute )
- ATR > .00025 ( 5 minute )
- MACD Value of Current Bar < MACD Value 1 Bar Ago at the Close ( 5 minute and 1 Hour)
- MACD Difference < 0 ( 5 minute and 1 Hour)
But my the code is not executing this strategy how it should. First off, its not entering trades at the right time. Second its not executing the stop loss and take profits how they should because the profit to risk ratio should be at 1.6.
Please help me figure out why the strategy is not being executed correctly. THANKS!
Jacob Barbee
Varad Kabade
Hi Jacob Barbee,
In the above algorithm, the stop loss and take profit logic is not implemented correctly. Please refer to the following thread, which describes the above implementation in detail.
Best,
Varad Kabade
Jacob Barbee
Thanks Varad kabade,
Can you tell what is wrong with my 5 minute MACD setup? It doesn't seem to know when the previous close MACD value is less than the current close MACD value. I don't know why that is..
Varad Kabade
Hi Jacob Barbee,
When we ran the backtest, we could not reproduce the error as mentioned above. The algorithm goes long as expected; you can see the Logs of the attached backtest. Instead of using a list to store past indicator values, we recommend using RollingWindow we have implemented this in the attached backtest for your reference.
Best,
Varad Kabade
Jacob Barbee
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!