LLV() instead of REF() question

#1
Hi dear members :)

Look at this code:
Code:
MA1 = MA(C, 32);
MA2 = MA(C, 16);

trigger = Cross(MA2, MA1);

vLINE = Ref(trigger, 16);

Plot(MA1, "MA1", colorYellow, styleLine);
Plot(MA2, "MA2", colorBlue, styleLine);
Plot(vLINE, "vLINE", colorWhite, styleHistogram|styleOwnScale);
Once trigger is true, the formula will plot a vertical line 16 periods ago.

Now, I would like to replace REF() with a function that is able to find the previous lowest low over the preceding 16 periods , sothat I can sign it on the chart.

Can LLV() do anything like that?

Thanks :thumb:
 

asnavale

Well-Known Member
#2
Hi dear members :)

Look at this code:
Code:
MA1 = MA(C, 32);
MA2 = MA(C, 16);

trigger = Cross(MA2, MA1);

vLINE = Ref(trigger, 16);

Plot(MA1, "MA1", colorYellow, styleLine);
Plot(MA2, "MA2", colorBlue, styleLine);
Plot(vLINE, "vLINE", colorWhite, styleHistogram|styleOwnScale);
Once trigger is true, the formula will plot a vertical line 16 periods ago.

Now, I would like to replace REF() with a function that is able to find the previous lowest low over the preceding 16 periods , sothat I can sign it on the chart.

Can LLV() do anything like that?

Thanks :thumb:
Yes you can use LLV() to define trigger and you will get what you want

-Anant
 
#3
This code is working great :thumb:

Code:
MA1 = MA(C, 32);
MA2 = MA(C, 16);

trig = Cross(MA2, MA1);
vLINE = Ref(trig, 16);

LLBars= LLVBars(L, 16 + 5); // don't take any notice of that "5"
pd = ValueWhen(trig,LLBars,0);
vLINELow = Ref(trig, pd);

Plot(MA1, "MA1", colorYellow, styleLine);
Plot(MA2, "MA1", colorBlue, styleLine);

Plot(vLINElow, "", colorGrey50 , styleArea|styleOwnScale);
Please give it a try!