you need to use brackets like:

Buy = ( Cross(G0,G1)AND Cross(G0,G2) ) OR ( Cross(G0,G1) AND 
BarsSince(Cross(G0,G2)) <= 10 ) OR ( (Cross(G0,G1) OR Cross(G0,G2)) AND 
NumDownBarsG1 < 5 );






  ----- Original Message ----- 
  From: rijnaars 
  To: [email protected] 
  Sent: Monday, October 06, 2008 11:00 AM
  Subject: [amibroker] Re: Help on conditional Buy signals


  Thanks for explaining, but i meant that the signal was correct but i 
  do not want it to be effective when G1 has been going down for 
  example 5 days. I added your advice

  NumDownBarsG1 = BarsSince( G1 >= Ref(G1,-1));

  Buy = Cross(G0,G1)AND Cross(G0,G2) OR Cross(G0,G1) AND BarsSince(Cross
  (G0,G2)) <= 10 OR Cross(G0,G1); // OR Cross(G0,G2) AND NumDownBarsG1 
  < 5);

  only i get failure messages at the last part: AND NumDownBarsG1 < 5);

  --- In [email protected], "gp_sydney" <[EMAIL PROTECTED]> 
  wrote:
  >
  > One comment about your conditions:
  > 
  > >> Buy = Cross(G0,G1)AND Cross(G0,G2) OR Cross(G0,G1)
  > >> AND BarsSince(Cross (G0,G2)) <= 10 OR Cross(G0,G1);
  > 
  > When mixing multiple AND and OR conditions in the same expression, 
  you
  > should use brackets to indicate operator precedence. For example:
  > 
  > (X AND Y) OR Z
  > 
  > is not the same thing as:
  > 
  > X AND (Y OR Z)
  > 
  > While there is a predefined order of precedence when no brackets are
  > used, I doubt most people would be sure of what it is, whereas
  > brackets make it obvious.
  > 
  > Regards,
  > GP
  > 
  > 
  > --- In [email protected], "rijnaars" <rijnaa@> wrote:
  > >
  > > Thanks Ed 
  > > I will show you the rules i use know.
  > > 
  > > Buy = Cross(G0,G1)AND Cross(G0,G2) OR Cross(G0,G1) AND BarsSince
  (Cross
  > > (G0,G2)) <= 10 OR Cross(G0,G1); 
  > > 
  > > Only sometimes Buy = Cross(G0,G1) gives a wrong signal
  > > 
  > > i do not wnat it to act if G1 has been going down for instance 
  for 
  > > last 7 days how do i implement this condition.
  > > 
  > > (--- In [email protected], "Edward Pottasch" 
  <empottasch@> 
  > > wrote:
  > > >
  > > > hi,
  > > > 
  > > > not sure exactly what you mean but maybe you could use OR 
  instead 
  > > of AND, so Buy = Cross(A1,A3) OR BarsSince(Cross(A1,A2)) <= 2;
  > > > 
  > > > but on an array level you can construct more detailed 
  constraints 
  > > using:
  > > > 
  > > > Buy = IIF(Cross(A1,A3) AND BarsSince(Cross(A1,A2)) <= 2,1, etc
  > > > 
  > > > or just using OR in your contraint rule Buy = (constraint 
  rule1) OR 
  > > (constraint rule 2) OR (constraint rule 3) etc; like:
  > > > 
  > > > Buy = (Cross(A1,A3) AND BarsSince(Cross(A1,A2)) <= 2) OR (Cross
  > > (A1,A3)) OR () etc;
  > > > 
  > > > if you explain in detail how your constraint should work I can 
  > > write it for you.
  > > > 
  > > > regards, Ed
  > > > 
  > > > 
  > > > 
  > > > 
  > > > 
  > > > ----- Original Message ----- 
  > > > From: rijnaars 
  > > > To: [email protected] 
  > > > Sent: Monday, October 06, 2008 9:48 AM
  > > > Subject: [amibroker] Re: Help on conditional Buy signals
  > > > 
  > > > 
  > > > Thank you very much Ed this is what i needed
  > > > maybe you can help me on another aspect as well.
  > > > 
  > > > if i do not want the cross signal to react if A1 crosses A3 
  where 
  > > A3 
  > > > has been going down for the last 4 days forinstance.
  > > > What condition should i then implement?
  > > > thanks in advance
  > > > 
  > > > --- In [email protected], "gp_sydney" 
  <gp.investment@> 
  > > > wrote:
  > > > >
  > > > > Ed,
  > > > > 
  > > > > That's saying the A1/A3 cross must be before the A1/A2 
  cross, 
  > > not
  > > > > after. It should be the other way around:
  > > > > 
  > > > > Buy = Cross(A1,A3) AND BarsSince(Cross(A1,A2)) <= 2;
  > > > > 
  > > > > Regards,
  > > > > GP
  > > > > 
  > > > > 
  > > > > --- In [email protected], "Edward Pottasch" 
  > > <empottasch@>
  > > > > wrote:
  > > > > >
  > > > > > this can be done like:
  > > > > > 
  > > > > > buy = Cross(A1,A2) AND barssince(Cross(A1,A3)) <= 2;
  > > > > > 
  > > > > > rgds,Ed
  > > > > > 
  > > > > > 
  > > > > > 
  > > > > > ----- Original Message ----- 
  > > > > > From: rijnaars 
  > > > > > To: [email protected] 
  > > > > > Sent: Monday, October 06, 2008 8:08 AM
  > > > > > Subject: [amibroker] Help on conditional Buy signals
  > > > > > 
  > > > > > 
  > > > > > I want to use some conditions in a buy cross signal but i 
  do 
  > > > not know 
  > > > > > how to add it.
  > > > > > 
  > > > > > For instance :
  > > > > > 
  > > > > > i have a buy signal buy = Cross(A1,A2)AND Cross(A1,A3)
  > > > > > 
  > > > > > so in this case A1 crosses both A2 and A3
  > > > > > now i like to have a signal as well when the second cross 
  is 
  > > > made 
  > > > > > within 2 days after the first cross how do i make this 
  > > > condition?
  > > > > >
  > > > >
  > > >
  > >
  >



   

Reply via email to