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

RE: [amibroker] Re: DIMITRIS- Question



PureBytes Links

Trading Reference Links

Peter

-----Original Message-----
From: bluesinvestor [mailto:investor@xxxxxxxxxxxxx] 
Sent: Friday, May 02, 2003 10:33 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: DIMITRIS- Question

Hello Dimitris,

A little modification from Tomasz original code and 'kitakste edho'
(excuse my lousy Greek ;)

Regards,
Peter

function SARafl( Cvar, Hvar, Lvar, IAF, MaxAF )
{
	//IAF = 0.02;       // acceleration factor
	//MaxAF = 0.02;     // max acceleration

	psar = Cvar;		// initialize
	long = 1;        // assume long for initial conditions
	af = IAF;         // init acelleration factor
	ep = Lvar[ 0 ];   // init extreme point
	hp = Hvar [ 0 ];
	lp = Lvar [ 0 ];

	for( i = 2; i < BarCount; i++ )
	{
		if ( long )
		{
			psar [ i ] = psar [ i-1 ] + af * ( hp - psar [
i-1 ] );
		}
		else
		{
			psar [ i ] = psar [ i-1 ] + af * ( lp - psar [
i-1 ] );
		}

		reverse =  0;
		//check for reversal
		if ( long )
		{
			if ( Lvar [ i ] < psar [ i ]  )
			{
				long = 0; reverse = 1; // reverse
position to Short
				psar [ i ] =  hp;       // SAR is Hvar
point in prev trade
				lp = Lvar [ i ];
				af = IAF;
			}
		}
		else
		{
			if ( Hvar [ i ] > psar [ i ]  )
			{
				long = 1; reverse = 1;        //reverse
position to long
				psar [ i ] =  lp;
				hp = Hvar [ i ];
				af = IAF;
			}
		}

		if ( reverse == 0 )
		{
			if ( long )
			{
				if ( Hvar [ i ] > hp ) 
				{
					hp = Hvar [ i ]; 
					af = af + IAF; 
					if( af > MaxAF ) af = MaxAF; 
				}
             
				if( Lvar[ i - 1 ] < psar[ i ] ) psar[ i
] = Lvar[ i - 1 ];
				if( Lvar[ i - 2 ] < psar[ i ] ) psar[ i
] = Lvar[ i - 2 ];
			}
	       else
			{
				if ( Lvar [ i ] < lp )  
				{ 
					lp = Lvar [ i ]; 
					af = af + IAF; 
					if( af > MaxAF ) af = MaxAF; 
				}	
				
				if( Hvar[ i - 1 ] > psar[ i ] ) psar[ i
] = Hvar[ i - 1 ];
				if( Hvar[ i - 2 ] > psar[ i ] ) psar[ i
] = Hvar[ i - 2 ];

			}
		}
	}
	return psar;
}

Plot( Close, "Price", colorBlack, styleCandle );
Plot( psar, "SAR", colorRed, styleDots | styleNoLine | styleThick );

Filter=1;
AddColumn(SAR(.02,.02),"SAR");
AddColumn(SARafl(C,H,L,0.02,0.02),"SARafl");

-----Original Message-----
From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@xxxxxxxxx] 
Sent: Friday, May 02, 2003 3:40 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: DIMITRIS- Question

Wally,
You may go to
http://groups.yahoo.com/group/amibroker/message/38370
http://groups.yahoo.com/group/amibroker/message/38424
for the two alternatives.[I hope enough explained].
I try to introduce variable smoothing to an already useful trend 
detector, the DEMA(StochD(40),20).
It has nothing to do with PSAR, it is a stand-alone indicator.
Since it is quite smooth, I use 3-bars peak to signal the change of 
the direction.
DT
PS. We will follow a similar procedure, when PSAR will accept 
variable parameters, to improove PSAR results.

--- In amibroker@xxxxxxxxxxxxxxx, "netbull2000" <netbull2000@xxxx> 
wrote:
> I read in one of the messages here that you came up with some new 
> trend indicator that seems to be better than PSAR. Could you please 
> point me to your relevant message concerning this indicator. I am 
> interested in this as PSAR is about the only indicator I have some 
> respect for.
> 
> Thanks...
> Wally



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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


Attachment:
Function - SAR.afl

Attachment: Description: "Description: Binary data"