Author of the idea: Igor
MQL5 code author: barabashkakvn
How it works
If there is a position, and the price moved from the last position open price (stored in the m_last_deal_price_IN internal variable) for the specified Distance, while iDeMarker (DeMarker, DeM) indicator gives the permission, open a position having the volume of Coefficient Lots positions * volume of the last open position (stored in the internal m_lot variable). If there are currently no positions, we expect the permission from the indicator and open with the Lots volume.
Stop loss (the Stop Loss parameter) is 999 points by default so that it is almost never activated :), there is no take profit in the settings. If positions are present, a usual trailing can be applied to them (Trailing Stop and Trailing Step).
Trailing considering available funds is managed by Trailing Equity, Virtual Stop Equity and Trailing Start Equity variables.
Operation periodicity
When the last position is closed, position open price (the m_last_deal_price_IN internal variable) is set to zero, while the m_lot internal variable is reset to Lots. The Reset "last price IN" after deal OUT parameter is set to 'false' by default. If it is set to 'true', the m_last_deal_price_IN internal variable is set to zero AFTER EACH CLOSING.
Test by all symbols, M5, Reset "last price IN" after deal OUT = true, deposit: $10 000.
Symbol
Pass
Result
Profit
Expected Payoff
Profit Factor
Recovery Factor
Sharpe Ratio
Custom
Equity DD %
Trades
EURJPY
16
5359.37
11591.27
19.95
2.86
2.30
0.25
0
26.20
581
GBPJPY
19
4646.45
13861.37
18.63
2.49
2.46
0.19
0
50.32
744
EURGBP
13
3471.68
4345.42
19.84
2.69
1.18
0.24
0
35.49
219
GBPUSD
1
3462.21
6094.22
19.35
2.70
0.64
0.22
0
93.60
315
EURCHF
14
3397.28
4731.38
21.90
2.77
1.55
0.23
0
26.12
216
USDJPY
6
3366.41
6796.61
19.64
2.42
1.18
0.20
0
49.57
346
AUDUSD
5
3191.47
4478.81
15.13
2.39
2.06
0.22
0
17.13
296
AUDJPY
9
3158.82
6267.01
16.45
2.44
1.81
0.19
0
23.53
381
CADCHF
18
3152.07
4787.55
18.20
2.31
2.64
0.21
0
16.35
263
AUDCAD
8
3135.81
3884.48
16.12
2.35
1.77
0.23
0
20.24
241
USDCHF
3
2631.55
4095.64
24.97
2.47
1.76
0.19
0
20.49
164
GBPCHF
15
2603.16
8667.11
18.68
2.12
2.29
0.14
0
27.43
464
EURUSD
0
2359.22
7547.28
15.99
2.18
1.27
0.13
0
53.51
472
AUDNZD
7
2357.53
5224.43
21.07
2.27
1.15
0.15
0
31.15
248
EURNZD
17
2346.72
2709.60
17.48
2.48
0.34
0.18
0
77.72
155
EURAUD
12
-123.00
-8886.16
-132.63
0.13
-0.89
-0.11
0
91.20
67
EURCAD
2
-152.69
-9161.93
-169.67
0.11
-0.94
-0.18
0
92.72
54
AUDCHF
11
-183.87
-8159.14
-77.71
0.25
-0.82
-0.10
0
84.48
105
USDCAD
4
-306.15
-7738.18
-85.98
0.22
-0.85
-0.14
0
80.87
90
CHFJPY
10
-329.38
-9040.32
-1004.48
0.03
-0.95
-0.34
0
93.60
9
Test by all symbols, M5, Reset "last price IN" after deal OUT = false, deposit: $10 000.
Symbol
Pass
Result
Profit
Expected Payoff
Profit Factor
Recovery Factor
Sharpe Ratio
Custom
Equity DD %
Trades
EURCAD
6
3940.94
6567.92
20.09
2.98
1.55
0.24
0
36.82
327
GBPUSD
2
3776.53
4118.16
36.44
6.98
0.51
0.27
0
79.28
113
EURGBP
12
3183.71
1832.41
16.97
2.89
1.01
0.27
0
17.73
108
EURAUD
14
3025.94
2353.52
18.39
2.96
0.67
0.24
0
29.85
128
GBPCHF
18
2999.92
5402.31
18.96
2.65
1.45
0.19
0
27.42
285
EURUSD
0
2807.59
4967.36
20.53
2.92
1.91
0.19
0
18.81
242
GBPJPY
19
2545.40
2732.53
23.36
2.11
0.38
0.20
0
72.14
117
EURNZD
16
2386.11
5171.48
12.80
2.55
1.24
0.16
0
33.85
404
AUDCHF
11
2107.44
2625.39
23.44
2.52
0.44
0.17
0
49.82
112
CHFJPY
10
2040.66
3317.82
15.29
1.89
1.07
0.15
0
23.16
217
AUDNZD
7
1998.33
1427.61
10.50
2.13
0.29
0.17
0
44.93
136
AUDJPY
9
1845.18
4669.09
18.10
2.14
0.74
0.13
0
48.68
258
AUDCAD
8
1595.50
2455.04
23.16
1.90
0.57
0.13
0
39.79
106
AUDUSD
5
1350.90
2973.30
17.19
1.89
0.69
0.10
0
37.89
173
EURJPY
15
-51.72
-9502.56
-141.83
0.16
-0.91
-0.10
0
95.59
67
EURCHF
13
-82.03
-202.60
-3.12
0.93
-0.06
-0.01
0
30.86
65
USDJPY
4
-170.41
-1280.91
-9.02
0.73
-0.31
-0.02
0
33.21
142
USDCAD
3
-479.67
-7688.43
-213.57
0.08
-0.95
-0.21
0
77.84
36
USDCHF
1
-558.02
-8539.55
-609.97
0.06
-0.88
-0.38
0
94.64
14
CADCHF
17
-641.47
-8485.56
-707.13
0.09
-0.94
-0.42
0
89.72
12