Hi, I am trying to get the highest high value and the lowest low value for the previous 10 bars, which I can do with either of the following:
ShortCycle10: (HHV(H, 10)) == H;
LongCycle10: (LLV(L, 10)) == L;
Event: ShortCycle10 | LongCycle10
Event: LongCycle10 | ShortCycle10
Alternatively:
HC10:HHV(HIGH,P1),ColorRed;
LC10:LLV(LOW,P2),ColorGreen;
However, I would like to return a value of 2 otherwise 0 for the HHV and a -2 otherwise 0 for the LLV.
Can someone help?
Script help to return a specific value
Moderator: Chris White
Re: Script help to return a specific value
I believe that this is what you are looking for
Under the Parameters tab
P1 Double 10 2 100
Here is the formula
HC10:=Ref(HHV(HIGH,P1),1);
LC10:=Ref(LLV(LOW,P1),1);
HEvent:If(H>=HC10,2,0),ColorRed;
LEvent:If(L<=LC10,-2,0),ColorGreen;
FillRgn(1,HEvent,0),Brush#50FF0000;
FillRgn(1,LEvent,0),Brush#5000FF00;
Now if you want to plot the Highs and lows on the chart on top of the price, you use the same parameter tab entries
HC10:Ref(HHV(HIGH,P1),1), ColorRed;
LC10:Ref(LLV(LOW,P1),1),ColorGreen;
Under the Parameters tab
P1 Double 10 2 100
Here is the formula
HC10:=Ref(HHV(HIGH,P1),1);
LC10:=Ref(LLV(LOW,P1),1);
HEvent:If(H>=HC10,2,0),ColorRed;
LEvent:If(L<=LC10,-2,0),ColorGreen;
FillRgn(1,HEvent,0),Brush#50FF0000;
FillRgn(1,LEvent,0),Brush#5000FF00;
Now if you want to plot the Highs and lows on the chart on top of the price, you use the same parameter tab entries
HC10:Ref(HHV(HIGH,P1),1), ColorRed;
LC10:Ref(LLV(LOW,P1),1),ColorGreen;
Re: Script help to return a specific value
Thanks Henry 1224.