Hi MIke: Thanks for your correction. my basic idea is to suppose i have a buy signal; that buy signal's bar has to be of higher value that the last bar where anothe rbuy signal occured.
suppose for example i want to buy on pivot low signal,but i want to add a codnition to it that if this pivot is of higer value than the last pivot low that occured; this way i would know if the stock is in short trend or not...as tredning stocks should create higer pivotlows in itsd way up.... so, i want to refence the last pivotlow like we refer last clsoing pice as C>ref(c,-1) how it could be done for pivotlow Pivotlow>last pivotlow.... Any idea would be aprreciated and thanks in advance for you help. Regards, Shahariar --- In [email protected], "Mike" <sfclimb...@...> wrote: > > Your logic is flawed. Cond3 can never be true. > > Note that Cross returns 1 or 0. So, there are 3 possible scenarios for any > two sequential Cond1 values x,y where x is the previous bar value and y is > the current bar value: > > 0, 0 zero followed by a zero (no recent cross) > 0, 1 zero followed by a one (cross = true on current bar) > 1, 0 one followed by a zero (cross = true on previous bar) > 1, 1 (not possible since cross cannot happen twice in a row) > > Now look at your Ref statement, Ref(Cond1, Cond1 - 1), for each scenario: > > 0, 0 -> Ref(Cond1, 0 - 1) gives previous bar value of 0 > 0, 1 -> Ref(Cond1, 1 - 1) gives current bar value of 1 > 1, 0 -> Ref(Cond1, 0 - 1) gives previous bar value of 1 > > And your final logic of Cond1 > Ref(Cond1, Cond1 - 1) > > 0, 0 -> 0 : 0 not greater than 0 > 0, 1 -> 1 : 1 not greater than 1 > 1, 0 -> 1 : 0 not greater than 1 > > > Mike > > --- In [email protected], "shahariar4" <shahariar4@> wrote: > > > > Hi, All Memebrs, > > > > Some little help in needed for the following idea. > > > > I have tried a code as follows but it does not show any result or > > arrow...what am i making wrong? > > > > Buy= when cond1 occurs and this cond1 has to be of higer value than the > > last cond1 > > > > > > Cond1=Cross( ZLTyp, ZLHa ); > > Cond2=Cross( ZLHa, ZLTyp ); > > Cond3= Cond1> Ref(Cond1,Cond1 -1); > > > > > > Buy=IsTrue(Cond1 AND Cond3); > > > > > > // Suppose i am using a pivotlow as my buy signal, if the pivotlow my scan > > ditercts during scan, that pivotlow has to be at higer position than the > > previous pivotlow; so as like finding an uptrend with pivots........ > > >
