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

Re: [amibroker] Elementary AFL?



PureBytes Links

Trading Reference Links

Hello Charles,
 
 
Cond1  = ......;
 
Cond2 = .........;
 
Buy = Cond1 and Cond2;
 
Sell = Sell Conditions;
 
Buy = exrem(Buy, sell);
 
Sell = exrem(Sell, Buy);
 
Hope this helps
 
 
Cheers
 
Prashanth
 
----- Original Message -----
Sent: Monday, November 21, 2005 7:38 AM
Subject: [amibroker] Elementary AFL?

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.





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