Hi I am trying to set the target profit based on the difference from my entry and the lowest point of the last bar. Any idea why it is not working?
if close[0]>open[1] then
TL=30-(close[0]-lowest[1])
buy 10 contracts at market
set target profit TL
endif
In line 2 how can you be sure the prior LOW is lower than current CLOSE and that 30 is greater than that difference? I suggest that you use:
TL=abs(30-abs(close[0]-lowest[1]))
Furthermore, what is 30? Is it a price difference or pips (in some cases it can be the same, but it’s better to code it correctly).
If it’s pips then use:
TL=abs(30*PipSize-abs(close[0]-lowest[1]))
it will make no difference if used with DOW, DAX, etc…, but will make a huge one with most currency pairs.