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

Re: [amibroker] lower trendline



PureBytes Links

Trading Reference Links



Nifty46:  Try this one from the library.  It works and may have the elements of what you're looking for in that he picks the

beginning and endpoints of the barcounts similarly to what you're doing.

Hope this helps,

JOE  

/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

THIS SECTION DRAWS TD TREND LINES */

percent = 0.01 * 1; /* Adjust this percent as necessary, I use .01 because

FOREX is a 0.0000 number */

firstpointL = 2;

firstpointH = 2;

y0=LastValue(Trough(L,percent,firstpointL));

y1=LastValue(Trough(Ref(L,-1),percent,1));

for( i = 1; i < BarCount AND y0 >= y1; i++ )

{

firstpointL++;

y0=LastValue(Trough(L,percent,firstpointL));

}

x0=BarCount - 1 - LastValue(TroughBars(L,percent,firstpointL));

x1=BarCount - 1 - LastValue(TroughBars(Ref(L,-1),percent,1));

LineL = LineArray( x0, y0, x1, y1, 1 );

/*

Plot(C, "C", colorBlack, styleCandle);

*/

Plot( LineL, " Support Trend line", colorWhite,4 +8 );

 

yt0=LastValue(Peak(H,percent,firstpointH));

yt1=LastValue(Peak(Ref(H,-1),percent,1));

for(i = 1; i < BarCount AND yt0 <= yt1; i++ )

{

firstpointH++;

yt0=LastValue(Peak(H,percent,firstpointH));

}

xt0=BarCount - 1 - LastValue(PeakBars(H,percent,firstpointH));

xt1=BarCount - 1 - LastValue(PeakBars(Ref(H,-1),percent,1));

LineH = LineArray( xt0, yt0, xt1, yt1, 1 );

Plot( LineH, "Resistance Trend line", colorBrown,4 + 8 );

Plot(Close,"Close",colorBlack,styleCandle);

----- Original Message -----
From: nifty46
Sent: Saturday, April 11, 2009 5:44 AM
Subject: [amibroker] lower trendline

friends i need to draw trendline,logic is for lowerline start from low of lower close, ignore low of close>open, i try:-

LOWERLINE=ValueWhen(Lowest(Close),Low);

but when i use this in AFL, trendline does not start from low of lower close day of my sad perioud,PLEASE HELP, thax in advanced. nifty46(Dhiraj Sood)

x =Cum(1);
per =Param("PERIOUD",4,1,25,1);

LOWERLINE=ValueWhen(Lowest(Close),Low);

pS =TroughBars( LOWERLINE, per, 1 ) == 0;
//===============SUPPORT TRENDLINE ==============
endt=LastValue(ValueWhen( pS, x, 1 ));
startt=LastValue(ValueWhen( pS, x, 2 ));
endS =LastValue(ValueWhen( pS, LOWERLINE, 1 ) );
startS =LastValue( ValueWhen( pS, LOWERLINE, 2 ));
dtS =endt-startt;
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
//===============================================



__._,_.___


**** 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

__,_._,___