- OrderSelect loop through history; find the last closed order (OrderCloseTime) for the pair.
- Determine if the close price is near the SL.
- OrderSelect loop through open orders; find any that were opened before the last close time for that pair and close them.
idea:
void yourFunc() { if ( lastSellCounts > sellCounts ) flag_StopNewSells = true; if ( flag_StopNewSells ) flag_StopNewSells = CloseAllSell(); // bool as success return false; if ( flag_StopNewSells ) { lastSellCounts = 0; sellCounts = 0; } // add new++ when opened new... /* similar for buy.. */ /* finish remained tasks.. */ return; }
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
Hello
Please advise the code.
if ((OrderType()==OP_BUY) && OP_BUY==Close)
{
CloseAllBuy();
return(0);
}
I would like:
If one buy is closed by StopLoss, then go to "CloseAllBuy()".
Thank you