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

Re: [amibroker] Bars since Buy signal - how to code in AFL ?



PureBytes Links

Trading Reference Links

Try this:

Buy=BuyCondition;
Sell=0;
Short=ShortCondition;
Cover=0;

Long=Flip(Buy,Sell);
Shrt=Flip(Short,Cover);



Sell=Days > N AND ExitCondition;

  ----- Original Message ----- 
  From: Owen Davies 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, October 31, 2004 8:31 PM
  Subject: Re: [amibroker] Bars since Buy signal - how to code in AFL ?


  Paul Chivers wrote:

  >Here's a shorter version without the loops.
  >
  >
  >Buy = Cross( MACD(), Signal());
  >Sell=Cross(Signal(),MACD());
  >
  >Long = Flip(Buy,Sell);
  >
  >Days = IIf(Long,BarsSince(Cross(Long,0.5)),0);
  >

  Hmmm.  Can I do this?

  Buy=BuyCondition;
  Sell=SellCondtion;
  Short=ShortCondition;
  Cover=CoverCondition;

  Long=Flip(Buy,Sell);
  Shrt=Flip(Short,Cover);

  Darn!  That presupposes that I already have the Sell and Cover 
  conditions.  I can't see how to use this for an exit condition like this:

  Sell=Days > N AND ExitCondition;

  Am I missing something?

  I am deeply grateful for your help.

  Owen


  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/