Announcement

Collapse
No announcement yet.

How can to get a result of more than 2 formulas...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can to get a result of more than 2 formulas...

    there is a big problem... and i dont know what to do... ok i call my formulas and when the trend is upwards then the var is set to 1 and if its downwards then to -1 so now i have thre formulas...
    and i dont know how to get a result out of them because i tested it with
    the following way:
    PHP Code:
    var 0;
    var 
    = new Number(u+VAR1);
    var 
    = new Number(u+VAR2);
    var 
    = new Number(u+VAR3);
    if (
    >= 2)setBarBgColor(Color.lime);
    if (
    <= -2)setBarBgColor(Color.red); 
    so with this way it counts the returned vars (defined throug calling...)

    and i want to reach that every 2nd signal (down or upward) defines the trend.

    but there is a big problem if one of the vars is -1 and the other 2 are 1 then in my mind it should go up but the bgcolor is set to withe because 0 + 1 + 1 -1 = 1
    so it doesnt work.
    please help
    regards erilein

  • #2
    Re: Reply to post 'How can to get a result of more than 2 formulas...'

    IF VAR1, VAR2 AND VAR3 can only be +/- 1, then the possiblitiles are

    +1+1+1=3
    +1+1-1=1
    +1-1+1=1
    +1-1-1=-1
    -1-1-1=-3
    -1+1+1=1
    -1+1-1=-1
    -1-1+1=-1

    so 2 is not an option?

    Maybe check to see
    if var1+var2=2 or
    if var1+var3=2 or
    if va2+var3 =2 or....

    Comment


    • #3
      ok thanks i will test that but there must be a better way.....

      Comment


      • #4
        The better way is to test the sum to see if the sum is greater than or equal to +/-1, this means at least two of them are in the same direction

        Comment


        • #5
          ok sorry i didnt notice that iam a little tired today ... well much thanks...
          verry verry nice
          i see this board has got specialists
          thanks erilein

          Comment

          Working...
          X