madmax3:
I'm trying to code an EA (using some already made codes) which does the following:
- Opens two pending orders, a sell stop and a buy stop, at a specific time (in this case 23:00), both with an SL and a TP.
- Expires the pending order at a certain time (for example at 10:00).
- If two trades are opened and one reaches the SL, the other has its TP increased (I think an OrderModify will solve something like this).
So far I have this:
I have the following issue,
I need the code required for the modifying order part, i.e. if two trades are open and one hits the stop loss, the other will have it's take profit changed.
If anyone can help me it would be greatly appreciated as I think this EA is nearing completion as it is so it might as well get done
Thanks,
madmax3
nearing completion ==>> Begin what needed first.....
total=OrdersTotal(); if(total<1) { // no opened orders identified
This is a wrong way for detecting if there are open trades
On accounts trading you can have orders opened with another Symbol or with other magicnumbers..
total is then >0 So the EA can't open new trades Trie to fix this first
So Check your open trades with selecting right Symbol and MagicNumber
There is a MagicNumber for the trades I believe, the code you mentioned was part of the coding before I did any changes to it so I'm not sure what it's for. I'm also noob at coding MQL just so anyone reading knows.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have the following issue,
I need the code required for the modifying order part, i.e. if two trades are open and one hits the stop loss, the other will have it's take profit changed.