// Definizione dei parametri del codice
DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
ID = high<high[1] and low>low[1]
if ID then
test = 1
hh = highest[2](high)
ll = lowest[2](low)
endif
if test = 1 then
if time>=110000 and time <=120000 then
BUY 1 SHARE AT hh STOP
endif
endif
if test=1 then
if time>=020000 and time <=050000 then
sellshort 1 SHARE AT ll STOP
endif
endif
if longonmarket and time >= 020000 and time<=050000then
SELL AT ll STOP
test = 0
endif
if shortonmarket and time>=110000 and time<=120000 then
EXITSHORT AT hh STOP
test = 0
endif
hi guys, i need help for to exit from long position or short position olso when the condition hh or ll do is not verified, i want exit ,if long at 050000, Â if short at 120000
thanks
Wrong section of forum once again Enzo, please try to post to the correct section next time (ProOrder for automated strategy). Thank you. 👿
Basically, you want your stoploss to be the size of the hh-ll range?
Apologyse Nicolas, You are righe… Forgive me
So if the answer to my question is “yes”, just use the SET STOP LOSS function with the hh-ll range, like this:
SET STOP LOSS (hh-ll)
Hi Nicolas,  no , the sell and exitshort signals are with 1 condiction: SELL AT ll  STOP  ,  EXITSHORT AT hh STOP, i want  that  if the price do not touch LL or HH level the trade long or short .stops.
if  i am long close at 05 o clock ,   if i am short close  at  12 o clock
i hope i was clear ..
thanks
Hmmm… I think we are lost in translation here 🙂
Ok, so now if you want to exit your long position at 5 o’clock, let’s code it like this:
if time=050000 and longonmarket then
sell at market
endif
and do the opposite for your short orders.
sorry for my english..be patient Nicolas :-),
i want that my long position will be close if  in 02  to  05 o clock or at condition “LL” or if this condition is not  verified i want close my long position at 05 o clock.
the same thing for short position
thanks so much Nicolas
hh = highest[4](high)
if time>=020000 and time<=050000 and shortonmarket then
EXITSHORT 1 share AT hh stop
elsif time=050000 then
exitshort 1 share at market
endif
it do is not work…. Why?
thanks
Are you sure your “hh” level is below the current Close? I don’t think that possible. You should look 1 period ago instead, like this:
hh = highest[4](high)
if time>=020000 and time<050000 and shortonmarket then
EXITSHORT 1 share AT hh[1] stop
endif
if shortonmarket and time=050000 then
exitshort at market
endif
hh  is a condition, if the price do is not go upper the “hh”  the trade continue to be short , but anyway at 050000 must be closed.
if the price go is upper the hh between 020000 – 050000 then i want that trade must be closed
i hope to be clear
sorry for my english 🙂
ok it’s clear, so the code posted in my previous message should work as intended.
ID = high<high[1] and low>low[1]
rang = range
NR4 = rang<range[1] and rang<range[2] and rang<range[3]
if ID and NR4 then
test = 1
hh = highest[4](high)
ll = lowest[4](low)
endif
ID = high<high[1] and low>low[1]
rang = range
NR4 = rang<range[1] and rang<range[2] and rang<range[3]
fi= ID and NR4
hh = highest[4](high)
ll = lowest[4](low)
what do is it mean 1st code…and what is the difference ?
no, Niclosa  it do is not work
help me. please
Hello  Nicolas ,
when you have time , please try to answer me
Thanks a lot