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

[amibroker] Elementary AFL?



PureBytes Links

Trading Reference Links

I could use some help with what must be a most simple AFL.  My simple plan 
is (with interday data) to:



1.         Buy on buy conditions.

2.         Not buy again if already long

3.         Sell on sell conditions

4.         When sold (step 3), reset everything so we can do 1-3 again on 
future bars



It seemed to me that



Bought = flip (Buy, sell);



was a good way to go, but I can't make it work.  On the one hand, seems like 
flip(buy, sell) has to go AFTER the buy and sell statements.  On the other 
hand, you can't reference bought (line 3 below) until it's defined.   I 
guess I could use applystop to do this, but I prefer the flexibility of 
having my own exit code.



Can anyone help me do this?



Buy = conditions;

//Bought = flip(Buy, sell);  /Here?

Buy = buy and !Bought;

Sell = conditions;

Sell = sell and bought;

//Bought = flip(Buy, sell);  /Or here?



Thanks in advance.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/