Managing open orders on multiple timeframes
-
Hi All,
I've written an EA which creates entries and stop losses but the target is based on hitting a live moving average
One issue I unexpectedly found in testing was that if I use the EA on multiple timeframes it has created order management issues
i.e.
Opens trade on 1hr chart, but because the EA is also on the 15min chart it then closes the 1hr trade on the 15min MA being hit, which means I'm taking profits far too early and negatively impacting R:R ratiosOn their own they work fine on 1 timeframe but I want to test multiple currencies and timeframes together to see what the performance, impact to margin and correlation looks like
How do i manage orders so that the order can be tied to the timeframe that the order was opened on? and only exit when it hits that timeframes MA target?
I've considered placing objects on the chart or using comments in the order line and making the closing conditions subject to finding these but I'm relatively new to FXdreema and so far have been unsuccessful
Any help appreciated!
-
I'm using the If Trade (open buy or sell trade) -> condition (crosses MA) -> Close trades
-
@DV4 You can specify the active MA timeframe within the condition block:

-
Thank you for your reply!
Although it will still use close all trades in box which is probably net the right way to manage open orders
This will only trigger a close order message but how do I tie that to a specific order that was generated only on that timeframe?
-
I think the issue is that the signals to close happen on different timeframes but the trades are already open, this is more of a managing open orders issue and tying them to specific timeframes only and leaving other timeframe orders intact
i.e.
1hr chart trade opens, its looking for MA cross on 1hr chart,
EA is running on 15min chart as well, it see that there is a trade open
prices crosses 15min MA and closes the 1hr orderI'm not sure how to keep these separate other than not trading multiple timeframes on the same MT4 account?
I'm open to any other suggestions? -
There are 2 way to do that.
- Use the same bot on different charts per TF and use different magic numbers.
- Use one only bot on one chart but then you will need a custom code array to identify the ticket number of each different TF to identify each trade.
-
Your a legend, l'andorra - great advice, I will amend the magic numbers and hopefully that will fix it!
I'm a noob EA coder so relatively new to managing EAs in practice -
You're wlecome, man!
