I'll send Martingale function
as described by Andrew Young in his book Expert Advisor programming for MT4.
Look at code and write the Checkloss () function
double martingale() { int WinCount, LossCount; for (int Count = OrdersHistroyTotal()-1;;count--) { if(OrderSelect(Count, Select_By_Pos, MODE_HISTORY)) if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber) { if (OrderProfit()>0 && LossCount == 0) WinCount++; else if (OrderProfit()<0 && WinCount ==0) LossCount++; } else break; } if (MartingaleType==0) int ConsecutiveCount = LossCount; else if (MartingaleType == 1) ConsecutiveCount = WinCount; if(ConsecutiveCount>MaxMartingale) ConsecutiveCount=Max; double LotSize = BaseLotSize * MathPow(LotMultiplier,ConsecutiveCount); return (LotSize); } //+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+

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 trying to figure out function that return true when the last 3 closed orders are loss continuously in a same day. Can anyone help me with this?
example:
Before function filter
Closed Order:
03/12/2019 8am - profit
03/12/2019 10am - loss
03/12/2019 12pm - loss
03/12/2019 2pm - profit
04/12/2019 8am - loss
04/12/2019 10am - loss
04/12/2019 12pm - loss //no new order after this closed order for a day
04/12/2019 2pm - loss
04/12/2019 4pm - loss
04/12/2019 2pm - loss
05/12/2019 8am - profit
after function filter
Closed Order:
03/12/2019 8am - profit
03/12/2019 10am - loss
03/12/2019 12pm - loss
03/12/2019 2pm - profit
04/12/2019 8am - loss
04/12/2019 10am - loss
04/12/2019 12pm - loss
05/12/2019 8am - profit