- How to start with MQL5
- learn how to earn money villagers [Episode 2] !
- Machine learning in trading: theory, models, practice and algo-trading
Please advise how to programmatically skip 1 - 2 negative trades (do not apply martin to them) that usually go on an unsuccessful start of a flat... or rather unsuccessful entry into a flat by the first trade or it often happens on a reversal to a new track...
OnTradeTransaction - catching losing trades and increasing counter.
Thanks for the reply, but there's nothing there about history and getting the last negative trade, which is what the martingale multiplies
Please read carefully:
Forum on trading, automated trading systems and trading strategy testing
Tips on how to cook a martin so as not to drain...
Vladimir Karputov, 2018.09.06 16:45
OnTradeTransaction - catching losing trades and increasing the counter.
Now it is more detailed:
STEP 1: Caught a negative trade.
Step 2: Increase counter.
Step Three: as long as the counter is 1 or 2 - do not use a martin.
It is inOnTradeTransaction that we get ALL the information about the last trade.
Thanks for the reply, but there's nothing in there about history and getting the last negative trade, which is what the martingale multiplies
Search for the wordOnTradeTransaction.
Here's a code where everything is clear, but it's not clear how to catch the last deals... and there in your abstruse documentation you can't understand anything, as if they write for abstruse people and it's useless to read and reread... I read it twice myself and didn't understand what of what and from what
//+----------------------------------------------------------------------------+ //| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru | //+----------------------------------------------------------------------------+ //| Версия : 19.02.2008 | //| Описание : Возвращает флаг убыточности последней позиции. | //+----------------------------------------------------------------------------+ //| Параметры: | //| sy - наименование инструмента ("" - любой символ, | //| NULL - текущий символ) | //| op - операция (-1 - любая позиция) | //| mn - MagicNumber (-1 - любой магик) | //+----------------------------------------------------------------------------+ bool isLossLastPos(string sy="", int op=-1, int mn=-1) { datetime t; int i, j=-1, k=OrdersHistoryTotal(); if (sy=="0") sy=Symbol(); for (i=0; i<k; i++) { if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) { if (OrderSymbol()==sy || sy=="") { if (OrderType()==OP_BUY || OrderType()==OP_SELL) { if (op<0 || OrderType()==op) { if (mn<0 || OrderMagicNumber()==mn) { if (t<OrderCloseTime()) { t=OrderCloseTime(); j=i; } } } } } } } if (OrderSelect(j, SELECT_BY_POS, MODE_HISTORY)) { if (OrderProfit()<0) return(True); } return(False); }
What does it mean to catch the next unprofitable one and skip it? Tell the bot that there is no signal.
What does it mean to catch the next unprofitable one and miss it? Tell the bot that there is no signal.
You can't tell the MQL5 bot nothing with this code))))
At least pay some attention to the topic!
He won't tell the MQL5 bot anything with this code))))
At least keep an eye on the subject!
I agree. I'm far away from MQL5. The key thing in this code for him is(OrderProfit()<0)
"so that you don't lose..." - that is, how do you get a profitable EA?
That's the question on everyone's mind here
;)
"so you don't lose..." - that is, how do you get a profitable EA?
That's the question on everyone's mind.
;)
What's the worry? Do not enter the whole cutlet, and exit the market on time - do not wait for a stop-out. That's all for 5 kopecks.)
Agreed. I'm far away from MQL5. The key thing in this code for him is(OrderProfit()<0)
Wrong approach - it should beOrderProfit()>Spread

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use