Im testing a code to set my SL just below “swing low” when going long. This code seems to work the way I want to on DAX, but when testing it in Forex I just cant get it to work properly. I tried to use “pointsize” but I just cant get it to work the way it does in DAX. The problem is that it just closes the order directly with SL or TP. With *pointsize it goes a bit longer but not even close to where it should.
Below a simple code just to show in a simple way the way it works.
Test SL from Low
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Test SL from low
Defparamcumulateorders=false
N=10
TPP=1.5//risk/reward
extra=15//pips below Low for SL
C1=ExponentialAverage[3](close)
C2=ExponentialAverage[20](close)
IFc1crosses overc2THEN
Low1=LOWEST[5](low)//lowest point of the 5 recent candle
SL=(close-LOW1)+extra//Lowest + 15 extra pips under
I still dont get it to work. example pic from GBPUSD where it doesnt work and another from DAX where it looks ok. On Dax it only works without Pipsize and on GBPUSD it doesnt work with or without. Do I need to add pipsize anywhere else?
Ok, everything is working now. I actually had to divide with pipsize at pairs where the the number was lower than 1 (ex 0.002) . I also had to do it at the “extra” as you mentioned Roberto.
Thank you Roberto, Grazie Mille!
1
SL=(close-LOW1)/Pipsize+extra//Lowest + 15 extra pips under