How to select the next order

 

Hello, im creating a cost averaging system that increments lotsize if the previous order was a loss. I'm having a problem though, how do i select the next order?

Here is the pseudocode, but i do not know the syntax on how to do it:

if (previousTrade == "Loss"){
        selectNextTrade;
        incrementLotSizeOfNextTrade;
}
else if (previousTrade == "Win") {
	lotSizeIsBackToSquareOne;
}
 
Renz Carillo: increments lotsize if the previous order was a loss.

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.02.11

Why it won't work:
          Calculate Loss from Lot Pips - MQL5 programming forum 2017.07.11
          THIS Trading Strategy is a LIE... I took 100,000 TRADES with the Martingale Strategy - YouTube

 
William Roeder:

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.02.11

Why it won't work:
          Calculate Loss from Lot Pips - MQL5 programming forum 2017.07.11
          THIS Trading Strategy is a LIE... I took 100,000 TRADES with the Martingale Strategy - YouTube

Yeah i knew it, im still going to do it anyways