Hi! I have been trying to create my custom EA, i have managed to put indicators on the chart. I was trying to implement if logic form my long entry and it should be really simple task, but i cannot get it to work can you please help me?

My logic is that for a long postion price close should be above middle line and below upper line.
Name: cb__4.png Views: 9 Size: 18.3 KB

my code is:
I have tried many variations, but the problem is that i get long position when my price close is above upper line and it should be below

Code:
// the input variables of the EA
input ENUM_TIMEFRAMES    TimeFrame       = PERIOD_CURRENT;
input int                AMAPeriod       = 10;
input ENUM_APPLIED_PRICE AMAPrice        = PRICE_CLOSE;
input int                Nfast           = 2;
input int                Nslow           = 30;
input double             GCoeff          = 2;
input int                PriceFilter     = 5;
input maTypes            PriceFilterMode = ma_smoo;
input bool               Interpolate     = true;


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

   double band_middle = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter, PriceFilterMode,Interpolate, 0,0 );
   double band_1 = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode,Interpolate, 1,0 );
   double band_2 = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode,Interpolate, 2,0 );
   double band_3 = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 3,0 );
   double band_up = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 4,0 );
   double band_down = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 5,0 );
   
   
   //strategy
   double band_middle_curr = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter, PriceFilterMode,Interpolate, 0,0 );
   double band_middle_prev = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter, PriceFilterMode,Interpolate, 0,1 );
   double band_up_prev = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 4,1 );
   double band_up_curr = iCustom(_Symbol,_Period,"kaufman_ama_averages_filtered_ATR bands",TimeFrame, AMAPeriod, AMAPrice,Nfast, Nslow, GCoeff, PriceFilter,PriceFilterMode, Interpolate, 4,0 );
   Comment(band_up_prev);
   
   
   if(Close[0] >  band_middle_curr && Close[0] < band_up_curr)
      {
      
         Print("open a buy order");
      
      }
   
  }
//+------------------------------------------------------------------+