HI , I wanted to ask SOMEONE, if I’m not too disturbed, TO SOMEONE GOOD IN the break-out strategies, if you could tell me how to modify the following code of a TS on the IDNR4 pattern,the TS goes long to overcome of candle -high ,and sellshort to inverse conditions, but IDRN4 writer says that if we enter long (or shortsell) and prices go-back and break the minimum of the same set- Up candle the system close the trade long and open sell-short , the author says it could have up to 3 false breaks after which the Ts goes flat
THANKS
ID = high<high[1] and low>low[1]
rang = range
NR4 = rang<range[1] and rang<range[2] and rang<range[3]
if NR4 then
test = 1
hh = highest[4](high)
ll = lowest[4](low)
endif
if test = 1 then
BUY 1 SHARE AT hh STOP
SELL 1 SHARE AT ll STOP
endif
if longonmarket then
SELL AT ll STOP
test = 0
elsif shortonmarket then
EXITSHORT AT hh STOP
test = 0
endif
I just read this topic.
Line 5 should be replaced by:
if ID and NR4 then
In any case, this is the correct code, modified as you requested, no more than 3 trades until a new patterns occurs. I also added a Target Profit equal to the range HH-LL (not tested):
DEFPARAM CumulateOrders = false
ID = high<high[1] and low>low[1]
NR4 = range<range[1] and range<range[2] and range<range[3]
if ID and NR4 then
count = 0
hh = highest[4](high)
ll = lowest[4](low)
endif
If StrategyProfit <> StrategyProfit[1] then
count = count + 1
endif
if count < 3 then
If not LongOnMarket THEN
BUY 1 SHARE AT hh STOP
Elsif not ShortOnMarket THEN
SELLSHORT 1 SHARE AT ll STOP
Endif
SET TARGET PROFIT hh - ll
endif