PDA

View Full Version : metastock code question for gap up in price by 1%


Jackie
15th September 2004, 01:00 AM
Please can someone advise me on the code for the following long entry trigger

Todays low is greater than the last seven days by at least 1% of the low price of today.

So far I have .....LOW - ( LOW/100) > Ref(H,-1)....
But that only gives me the low is greater than yesterdays high by more than 1%. I need to have....
LOW - (LOW/100) > the highest value of the last seven days.
Thanks in advance
Jackie

Jose
15th September 2004, 02:11 AM
Try this indicator:

{ User inputs }
buffer:=Input("Buffer %",0,20,1)/100;
pds:=Input("Lookback periods",1,252,7);

{ Long/Short conditions }
long:=L>Ref(HHV(H,pds),-1)+buffer*L;
short&#58;=H<Ref&#40;LLV&#40;L,pds&#41;,-1&#41;-buffer*H;

&#123; Plot in own window &#125;
long-short


Long exploration code:

&#123; User inputs &#125;
buffer&#58;=1/100; &#123;Buffer %&#125;
pds&#58;=7; &#123;Lookback periods&#125;

&#123; Long/Short conditions &#125;
long&#58;=L>Ref&#40;HHV&#40;H,pds&#41;,-1&#41;+buffer*L;
short&#58;=H<Ref&#40;LLV&#40;L,pds&#41;,-1&#41;-buffer*H;

&#123; Exploration filter &#125;
long


jose '-)

Jackie
16th September 2004, 01:07 PM
Thanks Jose