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

RE: [amibroker] Var IAF another question



PureBytes Links

Trading Reference Links

Keith,

Yes it is possible, but let me ask you this ... how many arrays would
you want to pass to the function?  Right now there are two (along with
the close, high and low arrays) - IAF and MaxAF.  Would you need 2 for
each (longIAF/longMaxAF & shortIAF/shortMaxAF)?

I am not familiar enough with Stephane's code - could you send the AFL
(I have the DLL)?

Regards,
Peter

-----Original Message-----
From: Keith Bennett [mailto:kbennett@xxxxxxxxxx] 
Sent: Saturday, May 03, 2003 1:05 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Var IAF another question

For Peter & Dimitris,

I use SAR variants in conjunction with a custom composite index for 
market timing and then I use these signals to trade hi betas. Of 
particular value to me was the powerSAR dll posted by Stephane some 
time ago (thank you Stephane) which importantly provided different 
acceleration factors for "long" and "short" positions.

I'm not even close to being able to understand your attached code but 
I have loaded it into IB and immediately noted that "as is" the 
SARafl reversal signals often occured one day (sometimes two) earlier 
than the "best" signals from powerSAR.

Would it be possible/difficult to provide this same facilty in SARafl 
to independently set the "long" and "short" accelerations. Thank you 
both for your many contributions.

Keith


--- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" <investor@xxxx> 
wrote:
> Dimitris,
>  
> You are correct ... I did not make any other modifications other 
than
> what you suggested in your prior email (sorry).
>  
> Attached is another version that takes variable arrays for IAF and
> MaxIAF.  Below are answers to your comments.
>  
> Regards,
> Peter
>  
> -----Original Message-----
> From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> Sent: Saturday, May 03, 2003 6:22 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Var IAF Re: DIMITRIS- Question
>  
> Peter,
> thank you very much for your reply.
> I can not make a lot of comments on your code, see my
> http://groups.yahoo.com/group/amibroker/message/39501
> experimental idea.
> I hope you will excuse my naive comments below.
> Dimitris Tsokakis 
>  
>  
> --- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" <investor@xxxx> 
> wrote:
> > Dimitris,
> > 
> > It does not seem to make a big difference with a variable IAF.
> > 
> > Peter
> > 
> > // Initialize IAF Array
> > X=(DEMA(StochD(40),20)-50)/50; 
> > IAF=0.05*(1.1+abs(X));
>  
> this function varies [for ^NDX] from 0.055 to 0.105
> It is important for the MaxAF selection
> Fixed in attached version
>  
> > 
> > function SARafl( Cvar, Hvar, Lvar, MaxAF )
> > {
> >     //IAF = 0.02;       // acceleration factor
> >     //MaxAF = 0.02;     // max acceleration
>  
> It does not make sense to me. MaxAF should be at least 10*IAF
> Fixed - actually 20*IAF based on your prior email
>  
> >     psar = Cvar;            // initialize
> >     long = 1;        // assume long for initial conditions
> >     af = IAF[ 0 ];         // init acelleration factor
>  
> I suppose here you define the initial af value
> yes
>  
> >     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 ] );
>  
> I suppose here you create the various psar values. 
> af has still it initial value ? I do not see variable af here.
> af changes in other portions of the code - it is variable
>  
> >           }
> >           else
> >           {
> >                 psar [ i ] = psar [ i-1 ] + af * ( lp - psar [
> > i-1 ] );
>  
> af still has its initial value ?
> not necessarily
>  
> >           }
> > 
> >           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;
> >                       af = IAF[ i ];
> af changes here ---------^
> >                 }
> >           }
> >           else
> >           {
> >                 if ( Hvar [ i ] > psar [ i ]  )
> >                 {
> >                       long = 1; reverse = 
> 1;        //reverse
> > position to long
> >                       psar [ i ] =  lp;
> >                       hp = Hvar [ i ];
> >                       //af = IAF;
> >                       af = IAF[ i ];
> af changes here ---------^
> >                 }
> >           }
> > 
> >           if ( reverse == 0 )
> >           {
> >                 if ( long )
> >                 {
> >                       if ( Hvar [ i ] > hp ) 
> >                       {
> >                             hp = Hvar [ i ]; 
> >                             //af = af + IAF;
> >                             af = af + IAF[ i ]; 
> >                             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; 
> >                             af = af + IAF[ i ];
> >                             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( SARafl(C,H,L,0.02), "SAR", colorRed, styleDots | 
styleNoLine |
> > styleThick );
> > 
> > Filter=1;
> > AddColumn(SAR(.02,.02),"SAR");
>  
> you use the same IAF, maxAF here ?
> just for comparison . this is the built-in SAR() function
>  
> > AddColumn(SARafl(C,H,L,0.02),"SARafl");
>  
> 0.02 is very low for maxIAF
> this is variable in the current code



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 Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.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/