Expert advisor custom indicators coding problem

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.

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

    // 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");
      
      }
   
  }
//+------------------------------------------------------------------+

I have PrintFormated my values and they are all wrong, they are even negative… i do not get it why… period and symbol are correct
2021.02.20 20:21:54.021 2021.02.17 23:59:59 BTCUSD,Daily: last close (-515396076) > middle band (440509579) && last close(-515396076) < upper band (-1203849329)

You indeed have invested a lot of energy and time planning on your EA but really what’s the point when there are brokers who offer you EAs that can work as per your demand and trading style? I’d suggest you to go with them and invest your time tweaking strategies that could reap you benefits.

It’s true that when you know what you are doing, you do it better. When you have some coding knowledge, you can easily build an EA in accordance with your requirements. Having some programming knowledge is not less than any plus that you have when you are trading forex in the market.