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

RE: [amibroker] Re: DIMITRIS- Question



PureBytes Links

Trading Reference Links

Dimitris,

IAF and AF are not variable in the code I provided, although they could
be.  But what type of array(s) would be passed for that information?  Or
would they be calculated on the fly?

Regards,
Peter

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

Peter,
thank you for the effort.
The question for SAR is in variable IAF and/or AF.
This will make the initial SAR more flexible.
Is it possible through your code ?
As for the variable inputs, we can simply have a SAR of any indicator 
with a simple H,L replacement : 
Example [the MeanCMO and its SAR companion]

m25=Foreign("~sumCMO25","C");// after creating the ~sumCMO25 in AA
m=Foreign("~count","v");
meanCMO25=m25/m;
DD=DEMA(MEANCMO25,15);
H=dd;L=dd;// the replacement
cc=SAR(0.01,0.2 );
This 0.01 works well for the N100 database, it would be better to 
vary from 0.01 to 0.08 according to the trend evolution.
The same for 0.2, it would be better to go up to 0.8 sometimes.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" <investor@xxxx> 
wrote:
> 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@x...] 
> 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@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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 ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/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/