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

RE: [amibroker] How to neglect the short signal before the sell signal of a long trade ?



PureBytes Links

Trading Reference Links

You're welcome.  Learning how to use a loop to manipulate the AB variables
is useful knowledge because it's how you implement more advanced trade
management strategies like scaling in, scaling out, breakeven stops, etc.
The help file has some good examples.

 

Regards,

 

David

 

  _____  

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Tom
Sent: 02/18/2007 6:34 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] How to neglect the short signal before the sell
signal of a long trade ?

 

Dbw, thanks a lot. The use of loop here is truely inspirational, I will test
and learn.

 

B.rgds/ Tom itmwh

 

----- Original Message ----- 

From: dbw451 <mailto:dbw451@xxxxxxxxxxx>  

To: amibroker@xxxxxxxxx <mailto:amibroker@xxxxxxxxxxxxxxx> ps.com 

Sent: Sunday, February 18, 2007 11:27 PM

Subject: RE: [amibroker] How to neglect the short signal before the sell
signal of a long trade ?

 

Here's one way to remove buy and sell signals while in the opposite trade,
use a loop after your exrem() statements:

bInBuyTrade = Buy[0];

bInShortTrade = Short[0];

for(i=1; i<BarCount; i++) {

       bInBuyTrade[i] = bInBuyTrade[i-1];

       bInShortTrade[i] = bInShortTrade[i-1];

       if(Short[i] AND bInBuyTrade[i])

              Short[i] = 0;

       if(Buy[i] AND bInShortTrade[i])

              Buy[i] = 0;

       if(Buy[i])

              bInBuyTrade[i] = 1;

       if(Sell[i])

              bInBuyTrade[i] = 0;

       if(Short[i])

              bInShortTrade[i] = 1;

       if(Cover[i])

              bInShortTrade[i] = 0;

}

Note: the above code is untested, but hopefully you get the idea.

Regards,

David


  _____  


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of itmwh
Sent: 02/18/2007 9:33 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] How to neglect the short signal before the sell signal
of a long trade ?

Hi, I am try to code a futures system . Understanding that to delete 
the multiple signals between the buy and sell point, we can use 

buy=exrem(buy,sell);
sell=exrem(sell,buy);

similarly,

short=exrem(short,cover);
cover=exrem(cover,short);

But I need more than that: I hope to delete the short signals before 
the sell signal of a Long trade is triggered, also , I hope to delete 
the Buy signal before the cover signal of a Short trades are triggered. 
How to implement this in AFL ? Thanks for any help

 


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007 4:35 PM