gouki1001:
Not sure why this code isnt working but any help will be appreciated.
Here's one possibility:
bool Max_Loss_Daily (double PercentageLoss) { datetime startTime = iTime(Symbol(),PERIOD_D1,0); double netProfit = 0; int total = OrdersHistoryTotal(); for(int i=total-1;i>=0;i--) { if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) continue; if(OrderClosePrice() == 0) continue; if(OrderCloseTime() < startTime) continue; netProfit += OrderProfit() + OrderSwap(); } double InitialBalance = AccountBalance()-netProfit; return(netProfit + AccountProfit() < -(InitialBalance*PercentageLoss/100)); }
Yellow: optional. Green: necessary.

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
Not sure why this code isnt working but any help will be appreciated.