In this case, you have to count the number of Buy/sell and BuyStop / SellStop orders.
Then use the logic you want the EA to do according to the exist orders.
Please note that your code is not practically effecient for 2 reasons,
- In case of slippage, trigger_price will never equal to OrderOpenPrice() !.
- OrderOpenPrice() for Buy and Sell orders are not the same (Ask !) ... So, for sure you will get 50% of orders have the same as the slippage case.
In this case, you have to count the number of Buy/sell and BuyStop / SellStop orders.
Then use the logic you want the EA to do according to the exist orders.
Please note that your code is not practically effecient for 2 reasons,
- In case of slippage, trigger_price will never equal to OrderOpenPrice() !.
- OrderOpenPrice() for Buy and Sell orders are not the same (Ask !) ... So, for sure you will get 50% of orders have the same as the slippage case.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to open a BUYSTOP when a new buy trade is opened and a SELLSTOP when a new sell trade is opened
I tried like this but it keeps opening buy trades over and over even when it sees the old buy trade