Reverse Martingale
We usually use this generic strategy:
1) Study trend, open 3+ position with 3 different lots, same SL and 3 different TP (TP higher for lots lower); or open one position and close progressively lots when hit the 3+ TP.
Example with 3 positions:
BUY EURUSD 0.03 lots (SL:-2 TP:+1)
BUY EURUSD 0.02 lots (SL:-2 TP:+2)
BUY EURUSD 0.01 lots (SL:-2 TP:+3)
or
BUY EURUSD 0.06 lots (SL:-2 TP:dinamic)
BEST RESULT: 3 WIN = +0.03*1 +0.02*2 + 0.01*3 = +0.1
WORST RESULT: 3 LOSE = -0.03*2 - 0.02*2 - 0.01*2 = -0.12
We could change game rule with a reverse Martingale
2) We study trend (or use algoritm to study trend)
Open 1 single position with default lot, set a SL and a TP/Checkpoint
If we hit SL, the trend idea is wrong, close position and stop.
If we hit SL, the trend idea could be correct, then we open another position, with SL setted on first entry price, and new TP/checkpoint
Example with 3 checkpoints:
BUY EURUSD 0.03 lots (SL:-2, TP:+1)
first scenario: HIT STOPLOSS, wrong idea
second scenario: HIT TP, maybe good trend idea, continue
open BUY EURUSD 0.02lots (SL:+1, TP: +3)
BEST RESULT: 3WIN = 0.03*1+0.02*1+0.01*1 = +0.06
WORST RESULT: FIRSTLOSE = -0.03
strategy1 VS reverse Martingale:
2 steps: (LOTS: 0.02, 0.01)
MAX GAIN: 0.04-> 0.03 (-25%)
MAX LOSS: -0.06-> -0.02 (-67%)
3 steps: (lots :0.03, 0.02, 0.01)
MAX GAIN: 0.1->0.06 (-40%)
MAX LOSS: -0.12-> -0.03 (-75%)
5 steps: (lots :0.05, 0.04, 0.03, 0.02, 0.01)
MAX GAIN: 0.35 -> 0.15 (-57%)
MAX LOSS: 0.3 -> 0.05 (-83%)
You don't need to code. You need to describe idea and try to prove that it is good enough.