Created
January 4, 2023 09:03
-
-
Save mamirjamali/57839555c122c04347dc4cf255c63f61 to your computer and use it in GitHub Desktop.
Stop EA based on daily profit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double DailyProfit() | |
{ | |
double profit = 0; | |
int i, hstTotal = OrdersHistoryTotal(); | |
for (i = 0; i < hstTotal; i++) | |
{ | |
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) == TRUE) | |
{ | |
if (OrderType() > 1) | |
continue; | |
if (TimeToStr(TimeCurrent(), TIME_DATE) == TimeToStr(OrderCloseTime(), TIME_DATE)) | |
{ | |
profit += OrderProfit() + OrderSwap() + OrderCommission(); | |
} | |
} | |
} | |
return (profit); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment