[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Creating lines at a Indicator



PureBytes Links

Trading Reference Links

Nth values in a series may involve loops, which are not available in 
MetaStock.  For a possible solution, take a look at the "Nth Hi/Lo" at
http://www.metastocktools.com/MetaStock/NthHiLo.txt


Or perhaps this approach may be suitable:

======================
Range percentage bands
======================
---8<--------------------------

{ Percentage bands within range.

 ©Copyright 2006 Jose Silva.
  For personal use only
  http://www.metastocktools.com }

{ User inputs }
pr:=Input("Top/Bottom range percent [0~50%]",
 0,50,20)/100;
pds:=Input("Range lookback periods",1,2600,200);
plot:=Input("plot:  [1]Range and Percentage Levels,  [2]Signals",1,2,
1);

{ Data array }
x:=C;

{ Percentage levels within Hi/Lo range }
hi:=HHV(x,pds);
lo:=LLV(x,pds);
RangeTopPercent:=(hi-lo)*(1-pr)+lo;
RangeBotPercent:=(hi-lo)*pr+lo;

{ Crossover of range percentage signals }
upper:=Cross(rangeTopPercent,x);
lower:=Cross(x,rangeBotPercent);
signals:=lower-upper;

{ Overbought/sold signals }
oBought:=x>rangeTopPercent;
oSold:=x<rangeBotPercent;
odd:=Frac(Cum(1)/2)<>0;
oBoughtFill:=If(odd,oBought,0);
oSoldFill:=If(odd,oSold,0);

{ Plot on price chart, signals in own window }
If(plot=1,hi,0);
If(plot=1,lo,(oSoldFill-oBoughtFill)*.5);
If(plot=1,rangeTopPercent,(oSold-oBought)*.5);
If(plot=1,rangeBotPercent,signals)

---8<--------------------------


jose '-)
http://www.metastocktools.com




--- In equismetastock@xxxxxxxxxxxxxxx, Bruno Flor <brunorendeiroflor@
....> wrote:
>
> Hi guys,
>    
>   I wonder if anyone can help me solve this problem:
>    
>   I want to create a indicator that plots the closing of security.
> And then it should plot 2 lines. 
>    
>   The value of line A should be the value of the highest 40th
> closing in the last 200 bars.
>    
>   And the value of line B should be the value of the lowerst 40th
> closing in the last 200 bars.
>    
>   I'm not sure if I'm being clear, so let me show you an exemple
> using only 10 days:
>    
>   Day   Close 
>    
>   1        10
>   2        9
>   3        5
>   4        6
>   5        8
>   6        6
>   7        4
>   8        2
>   9        1
>   10      3
>    
>   I want a line (line A) that the 20% highest closing will be above
> (or equal) it: in this case the value of the line would be 9.
>    
>   Line B would be one that the 20% lowerst closing will be below
> (or equal) it: in this case: 2.
>    
>   In this case using only 10 bars when a download bar number 11, the
> indicator would consider only the data for the last 10 bars
> (it would ignore bar number 1).
>    
>   Sorry about my poor English, I hope you understand my problem.
>    
>   Thanks in advance.
>    
>   Bruno Flor. 







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/