StopLoss & TakeProfit are a bit tricky - they happen without the EA knowing about it.
You can do it indirectly by
A) Keeping a list of relevant orders in myArrayOfSavedOrders
B) Add or subtract deliberately opened or closed orders to/from myArrayOfSavedOrders
C) on each tick, check for a change in OrdersTotal() (or Orders that match your criteria) against count of relevant orders in myArrayOfSavedOrders
D) if mismatch, then SL or TP hit (or non-EA close anyway), so ...
E) create new array myArrayOfCurrentOrders, check for differences (if you want to know which order disappeared or was added) & PlaySound()
F) Create or update myArrayOfSavedOrders & cycle around
static int orders=OrdersTotal(); if(OrdersTotal()!=orders){ //Some trade action happend. Alert("Please check me"); orders=OrdersTotal(); }//z
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
Hi,
I'm new to MT4 and still trying to figure it out. In particular I'm wondering if it's possible at all for it to make a noise when a stop loss, take profit etc is hit and the trade executes, as I'm not really keen on staring at the screen until it hits one of the limits.