code in the active window will execute at every refresh. When data comes in the 
charts is refreshed. Therefor you need to work with static variables.  Herman 
wrote some code that you can use as an example. It can be found in the files 
section of the Yahoo Amibroker-at group, see ER2 Project 01-12-2006

code is also shown here: http://www.mail-archive.com/[EMAIL 
PROTECTED]/msg00213.html

Ed




  ----- Original Message ----- 
  From: Keith Kee 
  To: [email protected] 
  Sent: Wednesday, April 18, 2007 7:23 PM
  Subject: Re: [amibroker] Blau: TSI & Ergodic Oscillator


  Dear all,

  Many thanks for sharing your codes and experience. I am a newbie testing the 
trading system using ib controller with this code for buy as in the manual:

  //trading system
  ibc = GetTradingInterface("IB"); 
  if(ibc.IsConnected())
  {
      if(LastValue(Buy))
      {
          if(ibc.GetPositionSize(Name()) == 0)
          {
          ibc.PlaceOrder(Name(),"Buy",1,"MKT",0,0,"Day",True);
          }
      }
  }

  What I find is that more than 8 buy signals are produced. 

  I suspect that GetPositionSize() is not fast enough to report the actual 
position.

  I would be grateful if anyone could help me code this so the buy condition 
will only be triggered once per bar, as is the case for arrows on the charts. 

  Thanks in advance.

  Keith 






  On 18 Apr 2007 07:59:14 -0700, Roger <[EMAIL PROTECTED] > wrote:
    Thanks Don for sharing. Very nice indicator!
    Roger





   

Reply via email to