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

[amibroker] Var IAF Re: DIMITRIS- Question



PureBytes Links

Trading Reference Links

Peter,
many thanks for the detailed reply, I will make a further study.
Dimitris Tsokakis
--- 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


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