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

RE: [amibroker] fl for new highs and new lows with marking as HH1,HH2,HH3,HH4 and LH1,LH2,LH3,LH



PureBytes Links

Trading Reference Links



/*

This should take care of it. It is a combination of 2 existing posts: One buried in a Reinsley afl and one by Tomasz. 

The Zig in the Reinsley post is an elegant modification of the existing AB Zig and uses H and L, rather than only one parameter(e.g. H and L instead of C,H,or L) and was selected over other H_l based Zigs for reasons explained in another post.

(Minor) errors in both of them were corrected and some enhancements were incorporated.

Play with the parameters and adjust or throw out what you don't need or want.

*/

_SECTION_BEGIN("ZigZag");

//added 

Title = EncodeColor(4)+ _DEFAULT_NAME()+";  "+EncodeColor(1) + StrFormat("{{NAME}} - {{INTERVAL}}; {{DATE}}; O=%g, H=%g, L=%g, C=%g (%.1f%%)

{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );     

SetChartOptions(0,chartShowArrows|chartShowDates);

Plot( C, "Close", 1,64);

//from Reinsley

ZigPerc= Param( "ZigZag-HL %",0.02,0.01,10,0.01);

HHLLSel = ParamToggle("Each Pk/Tr|HH/LL","Each Pk/Tr|HH/LL Only",1);

Both_Versions=ParamToggle("Modified Only|Both","Modified Only|Both",1);

ATRmult = Param("Text Shift (in ATR)",0.6,0.1,3,0.1);

Show_Arrows=ParamToggle("Show Arrows","No|Yes",1);

Arrowadj = Param("Arrowadj; ",12,2,25,1);

pk=PeakBars(H,ZigPerc)==0;

tr=TroughBars(L,ZigPerc)==0;

pkbars=PeakBars(H,ZigPerc);

trbars=TroughBars(L,ZigPerc);

zHi=Zig(H,ZigPerc); zLo=Zig(L,ZigPerc); HLAvg=(zHi+zLo)/2;

zp1=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L))); //Reinsley original

zp2=IIf(pk,zHi,IIf(tr,zLo,IIf(pkbars<=trbars,L,H)));//Modified zp to reduce occasional erroneous Pk/Tr connections at very small ZigPerc values

//=========Modified version================

za2=Zig(zp2,ZigPerc);

Slopeza2 = za2-Ref(za2,-1);

Plot(za2,"\nZig Modified",11,5|styleNoLabel);//Zig H-L Modified

if(Show_Arrows)

{

pR=Ref(za2,-1)<za2 AND za2>Ref(za2,1);

pS=Ref(za2,-1)>za2 AND za2<Ref(za2,1);

PlotShapes(shapeDownArrow*pR,colorGreen,0,H,-Arrowadj);

PlotShapes(shapeUpArrow*pS,colorRed,0,L,-Arrowadj);

}

if(Both_Versions)

{

// Original Reinsley Version=================

za1=Zig(zp1,ZigPerc);

Slopeza1 = za1-Ref(za1,-1);

Plot(za1,"ZiG Original",1,5|styleNoLabel);//Zig H-L Reinsley original

if(Show_Arrows)

{

pR=Ref(za1,-1)<za1 AND za1>Ref(za1,1);

pS=Ref(za1,-1)>za1 AND za1<Ref(za1,1);

PlotShapes(shapeDownArrow*pR,colorGreen,0,H,-Arrowadj);

PlotShapes(shapeUpArrow*pS,colorRed,0,L,-Arrowadj);

}

}

//za2 = IIf(Slopeza1 >0 AND Slopeza2>0,Max(za1,za2),IIf(Slopeza1 <0 AND Slopeza2<0,Min(za1,za2),za2));

//Plot(za2,"",11,5|styleNoLabel);//Zig H-L

 

//modified from Tomasco

// ORIGINAL uses H AND L values for next bar after Zig pk/tr instead at Zig pk/tr and is based on Zig(C);

// occasionally, that value is lower/higher than the correct ZigLo/ZigHi values, since the Zig is based on C, NOT on H and L

//added additional bells and whistles

if(HHLLSel)

{

HH=((za2>Ref(za2,- 1) AND za2 > Ref(za2,1)) AND (Peak(za2,ZigPerc,1 )>Peak(za2,ZigPerc,2 ))); //HH

LL=((za2<Ref(za2,- 1) AND za2 < Ref(za2,1)) AND (Trough(za2,ZigPerc,1 ) <Trough(za2,ZigPerc,2 ))); //LL

dist = ATRmult*ATR (20);//might not want that

for( i = 0; i < BarCount; i++ )

{

if( HH [i]) PlotText( "HH"+ "\n"+H[ i ], i, H[ i ]+dist[i], colorGreen );

if( LL [i] ) PlotText( ""+L[ i ]+"\nLL", i, L[ i ]-dist[i], colorRed );

}

}

 

if(!HHLLSel)

{

HH=((za2>Ref(za2,- 1) AND za2 > Ref(za2,1)));

LL=((za2<Ref(za2,- 1) AND za2 < Ref(za2,1)));

}

 

 

dist = ATRmult*ATR (20);//might not want that

for( i = 0; i < BarCount; i++ )

{

if( HH [i]) PlotText( "H"+ "\n"+H[ i ], i, H[ i ]+dist[i], colorGreen );

if( LL [i] ) PlotText( ""+L[ i ]+"\nL", i, L[ i ]-dist[i], colorRed );

}

 

 

/* Original

HH=((za2<Ref(za2,- 1) AND Ref(za2,-1) > Ref(za2,-2)) AND (Peak(za2,ZigPerc,1 )>Peak(za2,ZigPerc,2 )));

LL=((za2>Ref(za2,- 1) AND Ref(za2,-1) < Ref(za2,-2)) AND (Trough(za2,ZigPerc,1 ) <Trough(za2,ZigPerc,2 )));

*/

_SECTION_END();

 

 

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of rvlv
Sent: Saturday, November 07, 2009 5:52 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] fl for new highs and new lows with marking as HH1,HH2,HH3,HH4 and LH1,LH2,LH3,LH

 

 

hELLOW AFL experts

Please help
I am looking for an afl that has
candle chart, 30min, every new HIGHER high marked on chart as HH1,HH2,HH3,HH4
EVERY NEW LOWER HIGH MARKED ON CHART AS LH1,LH2,LH3,LH4
The concept requires marked hh and marked lh, and each hh or lh must have a dotted line plotted on chart.

trading will be on trend
long on breakout over hh, and short over breakout LH

THANKS
in advance

Looks simple but I cant do it
please help
rvlv

like to exchange more info? mail me at rvlv@xxxxxxxxx personally.

hint
I rember gordon rose, even mailed him he is busy.

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.424 / Virus Database: 270.14.51/2482 - Release Date: 11/05/09 07:37:00



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___