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

Re: [amibroker] little piece of code



PureBytes Links

Trading Reference Links

Alan,

good plan (also have a look at the library). In my opinion visualisation can help a lot. For instance if you try to figure out what CUM(1) exactly does just plot it using the Indicator Builder. 

Plot(CUM(1),"",colorBlue,1);

When learning AFL you have to start grasping the idea that AFL works with arrays and they are all of the same length. A lot of calculations (but certainly not all) can be done on an array level.

In my piece of code especially interesting is: xx = IIF(x > selv - per AND x <= selv, x - (selv - per),null);

This is an example of how to fill only a certain interval of the array and leave the rest empty,

good luck,

ed

  ----- Original Message ----- 
  From: Alan Northam 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Monday, November 08, 2004 1:00 PM
  Subject: Re: [amibroker] little piece of code


  Nice little piece of code, Ed.  I am new to AFL coding and will try to 
  figure out what you did and why.  So i will be using your code as a 
  learning tool.

  Thanks,
  Alann

  At 11:00 AM 11/8/04 +0100, you wrote:

  >previous subject line was in error ....
  >
  >in my attemps to make a trend following systems I made this little piece 
  >of code pure for visualisation. Put is in the Ind. Builder and click 
  >somewhere in the chart with the mouse.
  >
  >rgds, Ed
  >
  >/*
  >
  >trend channel development
  >
  >Edward Pottasch, nov 2004
  >
  >*/
  >
  >
  >per = 10;
  >mm= (H + L) / 2;
  >
  >x = Cum(1);
  >lastx = LastValue( x );
  >selv = SelectedValue(x);
  >
  >aaa = LinRegIntercept( mm, per);
  >bbb = LinRegSlope( mm, per );
  >
  >daa = SelectedValue(ValueWhen( x, aaa, 1));
  >dbb = SelectedValue(ValueWhen( x, bbb, 1));
  >
  >xx = IIF(x > selv - per AND x <= selv, x - (selv - per),null);
  >yy = daa + dbb * xx;
  >
  >detrend = mm - yy;
  >wd = SelectedValue(HHV(abs(detrend),per));
  >
  >Plot(yy, "LinReg", colorBlue );
  >Plot(yy + wd, "Upper Boundary", colorRed );
  >Plot(yy - wd, "Lower Boundary", colorBrightGreen );
  >
  >Plot(C,"",colorwhite,64);
  >
  >[Non-text portions of this message have been removed]
  >
  >
  >
  >
  >Check AmiBroker web page at:
  >http://www.amibroker.com/
  >
  >Check group FAQ at: 
  >http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  >Yahoo! Groups Links
  >
  >
  >
  >



  Check AmiBroker web page at:
  http://www.amibroker.com/

  Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
      
    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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