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" <shahari...@...> 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........
>


Reply via email to