using iFractals to decide buy or sell

 

I have tried the following code logic. But I guess it is not the right one.

   double UP[],DOWN[];
  double fractal_output = iFractals(_Symbol,_Period); 
  ArraySetAsSeries(UP,true);
ArraySetAsSeries(DOWN,true); 
  CopyBuffer(fractal_output,0,0,5,UP);
  CopyBuffer(fractal_output,1,0,5,DOWN);
  if (UP[1])
  {
  Comment("BUY");
  trade.Buy(0.1);
  }
  if (DOWN[1])
  {
  Comment("SELL");
  trade.Sell(0.1);
  }
I am getting the buy and sell simultaneously. Kindly, suggest me what I can do to improve my decision based on Fractals.
 

Your if() is false! UP and DOWN are double that are casted into a logical values: 0 or 1!

Check correctly the values of UP[] and DOWN[]!

 
Carl Schreiber:

Your if() is false! UP and DOWN are double that are casted into a logical values: 0 or 1!

Check correctly the values of UP[] and DOWN[]!

void OnTick()
  {
   double UP[],DOWN[];
  double fractal_output = iFractals(_Symbol,_Period); 
  ArraySetAsSeries(UP,true);
ArraySetAsSeries(DOWN,true); 
  CopyBuffer(fractal_output,0,0,5,UP);
  CopyBuffer(fractal_output,1,0,5,DOWN);
  
  printf("UP0 ==> " + DoubleToString(UP[0]));
  printf("\nDOWN0 ==> " + DoubleToString(DOWN[0]));
    printf("\nUP1 ==> " + DoubleToString(UP[1]));
printf("\nDOWN1 ==> " + DoubleToString(DOWN[1]));
  if (UP[0]>DOWN[0])
  {
  Comment("SELL");
  trade.Sell(0.1);
  }
  else{
  
  Comment("BUY");
  trade.Buy(0.1);
  }
  if (UP[1]>DOWN[1])
  {
  Comment("SELL");
  trade.Sell(0.1);
  }
  else
  {
  Comment("BUY");
  trade.Buy(0.1);
  }

I tried printing the values but they are so big number series that I am unable to understand. Kindly suggest me what improvement can be done in my program. I am trying on my side and above is one of my tries.

Please let me know your views.