I’m using the following partial close with a EUR/USD mini strategy:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ONCE partialclose = 1
IF partialclose THEN
ONCE PerCent = 0.9 //% positions to close
ONCE PerCent2 = 0.01 //% positions to close
ONCE MinLotSize = 1 //1 lots minimum
ExitQuantity = abs (CountOfPosition ) * PerCent
LeftQty = max (MinLotSize,abs (CountOfPosition ) - ExitQuantity)
CloseQuantity = abs (CountOfPosition ) - LeftQty
ExitQuantity2 = abs (CountOfPosition ) * PerCent2
LeftQty2 = max (MinLotSize,abs (CountOfPosition ) - ExitQuantity2)
CloseQuantity2 = abs (CountOfPosition ) - LeftQty2
IF Not OnMarket THEN
Flag = 1
Flag2 = 1
ENDIF
IF LongOnMarket and close >= (PositionPrice + 4 * pipsize ) AND Flag THEN
SELL CloseQuantity Contracts AT Market
Flag = 0
endif
IF ShortOnMarket and close <= (PositionPrice - 8 * pipsize ) AND Flag2 THEN
exitshort CloseQuantity2 Contracts AT Market
Flag2 = 0
endif
endif
This seems to work and the result is better than without partial close, but I’m getting confused between % and pips, especially as the optimization is so different for long and short (0.9 vs 0.01) ???
The profit target is 0.9% long and 0.5% short. If 0.9% is ~110 pips, how does 4*pipsize relate to that?
I tried using
IF LongOnMarket and close >= (PositionPrice * (1 + PerCentGain))
but it definitely works better with pipsize.