Hedging, grid trading, same as Martingale.
Martingale, Hedging and Grid : MHG - General - MQL5 programming forum (2016)
Martingale, guaranteed to blow your account eventually. If it's not profitable without, it is definitely not profitable with.
Martingale vs. Non Martingale (Simplified RoR vs Profit and the Illusions) - MQL5 programming forum (2015)
Why it won't work:
Calculate Loss from Lot Pips - MQL5 programming forum (2017)
THIS Trading Strategy is a LIE... I took 100,000 TRADES with the Martingale Strategy - YouTube (2020)
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
Please I am building an ea that uses martingale, I want to know a loss trade loss in pips whether the trade is closed before hitting SL or it close hitting SL all I want is to get the loss in pips which the next trade TP will be that loss trade pips. So even if next trade loss or any amount of trade loss the next trade will add that loss trade in pips as TP let say first trade you loss 20 pips the next trade TP is 20 pips which if this second trade loss let say it loss 20 pips so the next trade TP will be 40 pips and if this next trade loss let say it close 10 pips the next trade TP will be 50 pips and so on so if a trade win which the loss trade pips win the martingale will reset. So whether the trade close hitting SL or close without hitting SL once the trade close in negative that means close in (-) that means close in a loss in pips. I have tried to do it but can't figure it out, I have used OrderHistoryTotal function still can't figure it out
This is the code
Please help me guys
This martingale of yours is very weird.. you keep adding lost pips to the TP...you will end up with having a very far TP if you loose 4-5 trades in a row...
If use HistoryTotal I believe that it will search through the pool of closed orders but only what you have on the AccountHistory tab...so..you need to select there AllHistory... but then you need to put a filter there, not to count same order many times...so you need store your tickets into an array...
What I would do...I would not put stoploss in the OrderSend function... I would add a closing condition instead... if price bellow/above you desired setting, close the order...this way when order closes on this condition, you can count the lost pips every time you loose a trade...and add all this values of lost pips into a global variable which you will reset to "0" once you win a trade
//inpus input int StopinPoints =200; input int InitialTP =200; // Global Variable int LostPips=0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { //Closing Condition int TP=LostPips; if(LostPips == 0) TP=InitialTP; for(int i =OrdersTotal(); i>=0; i--) { if(OrderSelect(i,SELECT_BY_POS)) { if(OrderMagicNumber() == Magic) { if(OrderSymbol() == _Symbol) { if(OrderProfit() <0) { if(OrderType() == OP_BUY) { if((OrderOpenPrice() - Bid)/_Point > StopinPoint) { bool result=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0); if(result == true) { LostPips+=StopinPoints; } } } // Simiar I would do for closing on Sell Orders } } } } } // When a winning trade you set LostPips = 0; }
just an ideea

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please I am building an ea that uses martingale, I want to know a loss trade loss in pips whether the trade is closed before hitting SL or it close hitting SL all I want is to get the loss in pips which the next trade TP will be that loss trade pips. So even if next trade loss or any amount of trade loss the next trade will add that loss trade in pips as TP let say first trade you loss 20 pips the next trade TP is 20 pips which if this second trade loss let say it loss 20 pips so the next trade TP will be 40 pips and if this next trade loss let say it close 10 pips the next trade TP will be 50 pips and so on so if a trade win which the loss trade pips win the martingale will reset. So whether the trade close hitting SL or close without hitting SL once the trade close in negative that means close in (-) that means close in a loss in pips. I have tried to do it but can't figure it out, I have used OrderHistoryTotal function still can't figure it out
This is the code
Please help me guys