[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can i use ref + for this



PureBytes Links

Trading Reference Links

Hi can anyone help me with this problem.
This is only an example of what i am trying to solve.
1) I would like to know a simpler way to code this.
IIf(C<Ref(O,-11)AND C>Ref(O,-12) AND C<Ref(O,-13),Ref(C,-8),0) 
OR 
IIf(C<Ref(O,-11)AND C>Ref(O,-12) AND C>Ref(O,-13) AND C<Ref(O,-
14),Ref(C,-5),0)

would it be able to be done without the ref function e.g. ( using the 
alert and maybe hold function) or can i use a ref + .
I know that using the ref+ is not good because it looks into the future, 
but what if youre system is one where the past x amount of days 
decides that you would buy 3 or 5 or 21 days after the fact depending on 
how many days the condition was true.
e.g. if condition true 2 days in a row , and it was false before and after 
the condition then buy in 6 days
if the same applied but it was true 3 days in a row then buy in 9 days.

another problem is how do i get an entry condition to start fresh after 
an exit and an exit cond to start fresh after an entry. ( i dont want a buy 
condition to place a buy when part of the condition has been true before 
my exit, e.g. if it took 3 days for a true condition which started 2 days 
before an exit i do not want this.)

thanks.john.