Script help to return a specific value

A forum for all EdgeRater users

Moderator: Chris White

Post Reply
RobbieRoo
Posts: 6
Joined: Tue Mar 22, 2016 12:43 pm

Script help to return a specific value

Post by RobbieRoo »

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?
henry1224
Posts: 457
Joined: Wed Feb 24, 2016 12:04 pm

Re: Script help to return a specific value

Post by henry1224 »

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;
RobbieRoo
Posts: 6
Joined: Tue Mar 22, 2016 12:43 pm

Re: Script help to return a specific value

Post by RobbieRoo »

Thanks Henry 1224.
Post Reply