Hello,
Last time here I got help with setting my target and profits at the high and low of the bar.
For the next stage of the code I want that when a order is put in at the high of the bar the order is longer valid then just one bar.
I looked at the programming guide for the rigt codes, but I just cant seem to get it to work.
What am I doing wrong?
ONCE Nbbarlimit = 10
var1 = ExponentialAverage[20](close)>= ExponentialAverage[100](close)
var2 = High[0] < High[1]
var3 = Low[0] > Low[1]
mybuy = high[1]
myindex = barindex
If barindex >= myindex + Nbbarlimit THEN
mybuy = 0
endif
// Conditions to enter long positions
IF not onmarket and (mybuy > 0) and var1 AND var2 AND var3 AND not daysForbiddenEntry THEN
BUY 1 CONTRACT AT mybuy STOP
mystop = low[1]
mytarget = high[1] + (2*(high[1]-low[1]))
ENDIF
if onmarket then
sell at mystop stop
sell at mytarget limit
endif