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

Re: MARKING INTERESTING POINTS



PureBytes Links

Trading Reference Links

very nice codes. Do you mind put a short comments on right of each 
line of codes. You've lost me on most of codes. Thanks very much.

--- In amibroker@xxxx, "Dimitris Tsokakis" <TSOKAKIS@xxxx> wrote:
> Let us mark with a small circle the last 3 recent peaks and troughs.
> /*Marking recent peaks and troughs*/
> R=1;//Marking circle radius
> m=0.015*(HHV(H,159)-LLV(L,159));//scaling factor
> x=Cum(1);
> per = 5;//Sensitivity Calibration
> pR = PeakBars( H, per, 1 ) == 0;//Peak condition
> x01= LastValue(ValueWhen( pR, x, 1 ));
> x02=LastValue(ValueWhen( pR, x, 2 ));
> x03=LastValue(ValueWhen( pR, x, 3 ));
> y01 = LastValue(ValueWhen( pR, H, 1 ) );
> y02=LastValue(ValueWhen( pR, H, 2 ) );
> y03 = LastValue( ValueWhen( pR, H, 3 ));
> Plot(C,"",1,64);
> y0=y01;x0=x01;
> y=y0+m*sqrt(R^2-(x-x0)^2);
> y1=y0-m*sqrt(R^2-(x-x0)^2);
> Plot(y,"",4,1);Plot(y1,"",4,1);
> y0=y02;x0=x02;
> y=y0+m*sqrt(R^2-(x-x0)^2);
> y1=y0-m*sqrt(R^2-(x-x0)^2);
> Plot(y,"",4,1);Plot(y1,"",4,1);
> y0=y03;x0=x03;
> y=y0+m*sqrt(R^2-(x-x0)^2);
> y1=y0-m*sqrt(R^2-(x-x0)^2);
> Plot(y,"",4,1);Plot(y1,"",4,1);
> TpR = TroughBars( L, per, 1 ) == 0;//Trough condition
> x01T= LastValue(ValueWhen( TpR, x, 1 ));
> x02T=LastValue(ValueWhen( TpR, x, 2 ));
> x03T=LastValue(ValueWhen( TpR, x, 3 ));
> y01T = LastValue(ValueWhen( TpR, L, 1 ) );
> y02T=LastValue(ValueWhen( TpR, L, 2 ) );
> y03T = LastValue( ValueWhen( TpR, L, 3 ));
> y0T=y01T;x0T=x01T;
> y=y0T+m*sqrt(R^2-(x-x0T)^2);
> y1=y0T-m*sqrt(R^2-(x-x0T)^2);
> Plot(Y,"",5,1);Plot(Y1,"",5,1);
> y0T=y02T;x0T=x02T;
> y=y0T+m*sqrt(R^2-(x-x0T)^2);
> y1=y0T-m*sqrt(R^2-(x-x0T)^2);
> Plot(y,"",5,1);Plot(y1,"",5,1);
> y0T=y03T;x0T=x03T;
> y=y0T+m*sqrt(R^2-(x-x0T)^2);
> y1=y0T-m*sqrt(R^2-(x-x0T)^2);
> Plot(y,"",5,1);Plot(y1,"",5,1);
> Title=Name()+", P1="+WriteVal(Y01,1.2)+", P2="+WriteVal(Y02,1.2)+", 
P3="+WriteVal(Y03,1.2)
> +", T1="+WriteVal(Y01T,1.2)+", T2="+WriteVal(Y02T,1.2)+", 
T3="+WriteVal(Y03T,1.2);
> 
> I suppose that you keep the default number of 159 quotations in a 
chart and you plot 2 or more charts
> per sheet.
> The same technique may be applied for other interesting points of a 
certain graph. Insted of Peak condition
> you may have a cross, buy, sell, highest, lowest or any other 
condition. 
> The marking circles are permanent and independent of selected stock.
> They are also independent of prices [the same apparent size for a 
scale 1 to 3 as for a 2500 to 5000].
> Dimitris Tsokakis