hi,

what you need to do is define your Buy rule like:

Buy = Cond1 AND Cond2 ... etc;

then in the Buyprice you define as:

BuyPrice = MAX(0.25 * Ref(ATR(45),-1) + Ref(L,-1),O);

regards, Ed




  ----- Original Message ----- 
  From: Christy Wagner 
  To: [email protected] 
  Sent: Thursday, January 01, 2009 4:56 PM
  Subject: [amibroker] buyprice/open problem


  Hello,

  I am trying to test a trading system and I am running into a slight
  problem. I am wanting to take yesterdays low + 0.25 * ref(atr(45),-1)
  to come up with a buyprice.

  If todays open is below the buyprice and todays high is above the
  buyprice everything works as planned. However, if todays open is
  above the buyprice instead of going long at the open (which is what I
  want to do) I am going long at the low of the day, which is
  impossible. Here is my code.

  BuyPrice = 0.25 * Ref(ATR(45),-1) + Ref(L,-1);

  Buy=IIf(Cond1 AND Cond2 AND O > BuyPrice, Open,IIf(cond1 AND cond2 AND
  O < BuyPrice AND H > BuyPrice,BuyPrice,0));

  What I am trying to get this to do is if today at the open is above
  the buyprice I have set to enter long at the open, otherwise if
  today's open is below the buyprice and today's high is above the
  buyprice go long at the buyprice.

  can someone take a look and help me out? Thanks
  Eric



   

Reply via email to