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

Re: [amibroker] Need coding help



PureBytes Links

Trading Reference Links

Thomas,

Use Hold function

buy = Hold( cond1, 5 ) and cond2; // generate buy if cond2 happens within 5 bars from cond1 happened.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: <tchan95014@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, February 20, 2003 12:01 AM
Subject: [amibroker] Need coding help


> Hello,
> 
> I am trying to code the following conditions into AFL, but 
> have difficulties doing it, 
> please advise. Thanks.
> 
> cond1 = xxx; // a condition can come and go.
> cond2 = yyy;
> buy = cond1 AND cond2;
> 
> What I want is when cond1 triggers, I want to disregard its 
> status and track only cond2.
> 
> For example,
> 
> SetTradeDelays(0, 0, 0, 0);
> cond1 = ref(cmo() > 80, -1);
> cond2 = h > ref(h, -1);
> buy = cond1 and cond2;
> 
> when cond1 is triggered, I want to buy this stock only when 
> cond2 becomes true, which might take
> a couple of days (Of course they can come at the same day). 
> During these confirming days the cmo() 
> might come down to less than 80, but I do not care, as long 
> as cond1 has been triggered I want cond2 
> to take over and disregard cond1 all together.
> 
> 
> Thanks for any ideas.
> 
> 
> Thomas
> 
> 
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> 
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

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

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