[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

hi VB,

here I put the code how to do this. Note that I shift the buy signal 1 day forward. Because you can only buy the next day at the open. Also I added chart and explore features that can help when writing code like this. So you can see what happens.

rgds, Ed


Buy = LLV(L,6) == L AND C > Ref(C,-1);
Buy = Ref(Buy,-1);
BuyPrice = O;

Sell = BarsSince(Buy) == 7;
SellPrice = C;

Buy = Exrem(Buy,Sell);
Sell = Exrem(Sell,Buy);

GraphXSpace = 5;
Plot(C,"C",1,64);
PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer = 0, yposition = BuyPrice, offset = 0 );
PlotShapes(IIf(Sell,shapeDownArrow,0),colorYellow, layer = 0, yposition = SellPrice, offset = 0 );

Filter = 1;
AddColumn(Buy,"Buy");
AddColumn(Sell,"Sell");
  ----- Original Message ----- 
  From: vb_MCSE 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, October 31, 2004 4:45 PM
  Subject: [amibroker] Bars since Buy signal - how to code in AFL ?



  Hi:
  Caught this Trend Change system from an old Tradestation video from Omega.

  Hi:
  Caught the following on an old Tradestation video from Omega:

  Buy signal when:
  Today's Low is lower than the lowest Low of past 6 days
  AND
  Today's Close is Greater Than Yesterday's Close.

  Sell signal when:
  If Bars Since Entry = 7 then Sell on Close.

  How would one code the Sell signal ? It's got me (AFL newbie)
  scraching my head. As an aside, I think this Sell signal could be
  useful when combined with other entry systems (crossover etc). I'm
  interested in playing around with different values for Bars Since Entry. 

  Here's what I've coded with AFL so far:

  b=0; 
  donothing=0;
  IIf (Low < LLV(Low, 6) AND Close > Ref(Close, -1), b=1,donothing);
  Buy = b==1;
  Sell = BarsSince (b==1) > 6; 

  Get Buy signals (even though there are too many - it's at least it's a
  start), but cannot get any Sell signals. 

  Thanks in advance for any hints and or suggestions.
  vb






  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 --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/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/