[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

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 
  To: amibroker@xxxxxxxxxxxxxxx 
  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