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

Re: [amibroker] Nested if-statements



PureBytes Links

Trading Reference Links

hi,

you can do it like that but in Amibroker you can also work with arrays. So for instance:

constraint1 = .......;
constraint2 = .......;

constraint1 and 2 are both arrays that contain "0" and "1".

allconstraints = constraint1 AND constraint2;

now allconstraints is an array that carries the values 0 when only 1 or neither constraint applies and it carries 1 when both constraints apply,

So then:

Buy = allconstraints;

rgds, Ed




  ----- Original Message ----- 
  From: carlacash26 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, October 12, 2006 1:40 PM
  Subject: [amibroker] Nested if-statements


  Hi!

  I have a system that has a few indicators. I want to code this in 
  amibroker.

  I want a buy signal when all of the indicators acts in a specific way.

  When one of my indicators acts the way i like a variabel is set 
  to "true" (or 1), when all of these are true, i want the buy signal. 

  So when a,b,c, or d are == 1 then give buy signal.
  Is this done like this with nested if-statements?

  if (a == 1){
  if (b == 1){ 
  if (c == 1){
  if (d == 1){

  BUY-SIGNAL

  }
  }
  }
  } 

  Thanks!