I Need Debugging For My Personal Source Code EA

Specification

here's the code,

+------------------------------------------------------------------+

//|                                                         kama.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//|                 Heikin/Kaufman Strategy Expert Advisor           |
//|                        By OpenAI (ChatGPT)                       |
//+------------------------------------------------------------------+

// Inputs
input int Length = 5;
input double Fastend = 2.5;
input int Slowend = 20;
input int test = 0;
input int sloma = 20;

// Indicator buffers
double nAMABuffer[];
double fmaBuffer[];
double smaBuffer[];
double ha_closeBuffer[];
double mha_closeBuffer[];

// External variables
extern double LotSize = 0.01;  // Trading lot size
extern int StopLoss = 50;      // Stop loss in pips
extern int TakeProfit = 100;   // Take profit in pips

// Trading parameters
int ticket = -1;
int slippage = 3;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[])
  {
   int start = prev_calculated > 0 ? prev_calculated - 1 : 0;

   ArrayResize(nAMABuffer, rates_total);
   ArrayResize(fmaBuffer, rates_total);
   ArrayResize(smaBuffer, rates_total);
   ArrayResize(ha_closeBuffer, rates_total);
   ArrayResize(mha_closeBuffer, rates_total);

   double nfastend = 2 / (Fastend + 1);
   double nslowend = 2 / (Slowend + 1);

   for(int i = start; i < rates_total; i++)
     {
      double xPrice = (high[i] + low[i] + close[i]) / 3;
      double xvnoise = MathAbs(xPrice - xPrice[test]);
      double nsignal = MathAbs(xPrice - xPrice[i - Length]);
      double nnoise = 0;

      for(int j = i - Length + 1; j <= i; j++)
        {
         double xv = MathAbs((high[j] + low[j] + close[j]) / 3 - (high[j - 1] + low[j - 1] + close[j - 1]) / 3);
         nnoise += xv;
        }

      double nefratio = nnoise != 0 ? nsignal / nnoise : 0;
      double nsmooth = MathPow(nefratio * (nfastend - nslowend) + nslowend, 2);
      nAMABuffer[i] = i > 0 ? nAMABuffer[i - 1] + nsmooth * (xPrice - nAMABuffer[i - 1]) : xPrice;

      int ha_t = iCustom(NULL, 0, "Heikin Ashi", 0, i);
      ha_closeBuffer[i] = iCustom(NULL, 0, "Heikin Ashi", 2, i, ha_t);
      mha_closeBuffer[i] = iCustom(NULL, res1, "Heikin Ashi", 1, i, ha_t);

      if(i >= test)
        {
         fmaBuffer[i] = iMAOnArray(mha_closeBuffer, rates_total, 1, 0, test, i);
        }
      if(i >= sloma)
        {
         smaBuffer[i] = iMAOnArray(ha_closeBuffer, rates_total, sloma, 0, MODE_EMA, i);
        }
     }
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0, fmaBuffer);
   SetIndexBuffer(1, smaBuffer);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexLabel(0, "MA");
   SetIndexLabel(1, "SMA");

   double emptyBufferArray[];
  
     {
      int totalBars = ArraySize(open); // Retrieve the size of the 'open' array
      int start = prev_calculated > 0 ? prev_calculated - 1 : 0;

      // Rest of your code...

      for(int i = start; i < totalBars; i++)
        {
         // Processing for each bar
        }

      // Rest of your code...
     }

   SetIndexBuffer(2, emptyBufferArray, INDICATOR_DATA);

   double emptyBufferArray2[];
   ArrayResize(emptyBufferArray2, rates_total);
   SetIndexBuffer(3, emptyBufferArray2, INDICATOR_DATA);

   SetIndexStyle(2, DRAW_ARROW);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(2, SYMBOL_ARROWUP);
   SetIndexArrow(3, SYMBOL_ARROWDOWN);
   SetIndexEmptyValue(2, 0);
   SetIndexEmptyValue(3, 0);

   return INIT_SUCCEEDED;
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ArrayFree(nAMABuffer);
   ArrayFree(fmaBuffer);
   ArrayFree(smaBuffer);
   ArrayFree(ha_closeBuffer);
   ArrayFree(mha_closeBuffer);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   if(ticket == -1 && OrdersTotal() == 0)
     {
      int rates_total = RatesTotal();
      int start = MathMax(0, rates_total - 1 - 1000);

      for(int i = start; i < rates_total; i++)
        {
         if(fmaBuffer[i - 1] > smaBuffer[i - 1] && fmaBuffer[i] < smaBuffer[i])
           {
            ObjectCreate("CrossUnder", OBJ_TRIANGLE, 0, Time[i], High[i], 0);
            ObjectSet("CrossUnder", OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet("CrossUnder", OBJPROP_WIDTH, 1);
            ObjectSet("CrossUnder", OBJPROP_BACK, Red);
            ObjectSetText("CrossUnder", "S", 8, "Arial", Red);
           }
        }

      if(fmaBuffer[rates_total - 2] > smaBuffer[rates_total - 2] && fmaBuffer[rates_total - 1] < smaBuffer[rates_total - 1])
        {
         ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, slippage, Ask - StopLoss * Point, Ask + TakeProfit * Point);
         if(ticket < 0)
            Print("Error opening buy order:", GetLastError());
        }
      else

        {
         if(ticket == -1 && OrdersTotal() == 0)
           {
            int crossUnderBar = -1;


              {
               if(fmaBuffer[i - 1] > smaBuffer[i - 1] && fmaBuffer[i] < smaBuffer[i])
                 {
                  crossUnderBar = i;
                 
                 }
              }

            if(crossUnderBar != -1)
              {
               double crossUnderPrice = Low[crossUnderBar];
               ObjectCreate("CrossUnder", OBJ_TRIANGLE, 0, Time[crossUnderBar], crossUnderPrice, 0);
               ObjectSet("CrossUnder", OBJPROP_STYLE, STYLE_SOLID);
               ObjectSet("CrossUnder", OBJPROP_WIDTH, 1);
               ObjectSet("CrossUnder", OBJPROP_BACK, Red);
               ObjectSetText("CrossUnder", "S", 8, "Arial", Red);
              }

            // Rest of your code...
           }

         // Rest of your code...
        }

        {
         ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, slippage, Bid + StopLoss * Point, Bid - TakeProfit * Point);
         if(ticket < 0)
            Print("Error opening sell order:", GetLastError());
        }
     }

   if(ticket >= 0)
     {
      if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
        {
         if(OrderType() == OP_BUY && Bid - OrderStopLoss() > TakeProfit * Point)
           {
            if(OrderModify(ticket, OrderOpenPrice(), Bid - TakeProfit * Point, OrderTakeProfit(), 0, Green))
              {
               ticket = -1;
              }
            else
              {
               Print("Error modifying buy order:", GetLastError());
              }
           }
         else
            if(OrderType() == OP_SELL && OrderStopLoss() - Ask > TakeProfit * Point)
              {
               if(OrderModify(ticket, OrderOpenPrice(), Ask + TakeProfit * Point, OrderTakeProfit(), 0, Green))
                 {
                  ticket = -1;
                 }
               else
                 {
                  Print("Error modifying sell order:", GetLastError());
                 }
              }
        }
      else
        {
         Print("Error selecting order:", GetLastError());
         ticket = -1;
        }
     }
  }
//+------------------------------------------------------------------+

Responded

1
Developer 1
Rating
(597)
Projects
930
46%
Arbitration
31
39% / 29%
Overdue
93
10%
Free
2
Developer 2
Rating
(57)
Projects
72
22%
Arbitration
13
46% / 15%
Overdue
5
7%
Free
3
Developer 3
Rating
(568)
Projects
641
41%
Arbitration
21
57% / 29%
Overdue
47
7%
Working
4
Developer 4
Rating
(6)
Projects
10
50%
Arbitration
6
17% / 50%
Overdue
3
30%
Working
5
Developer 5
Rating
(140)
Projects
206
80%
Arbitration
18
33% / 44%
Overdue
10
5%
Working
6
Developer 6
Rating
(10)
Projects
15
27%
Arbitration
3
67% / 33%
Overdue
0
Working
7
Developer 7
Rating
(92)
Projects
103
57%
Arbitration
0
Overdue
0
Free
8
Developer 8
Rating
(52)
Projects
97
24%
Arbitration
11
18% / 18%
Overdue
12
12%
Working
9
Developer 9
Rating
(158)
Projects
175
43%
Arbitration
6
0% / 67%
Overdue
8
5%
Free
10
Developer 10
Rating
(58)
Projects
66
6%
Arbitration
28
18% / 39%
Overdue
4
6%
Loaded
Similar orders
I currently have a Forex trading script in .txt format that I want to be converted to a functional/working robot (in .mq4), without altering the strategy of the script. The strategy of the script is already in and shouldn't be changed unless with mutual understanding
Hey greetings, It my pleasure to met you . I need a MT4 develop that can develop an EA based on alert . If you are a professional MT4 programmer you can kindly bid for this project and let proceed
Hi, I would like to create an EA similar to this link: https://www.mql5.com/en/market/product/33508?source=External#description Drawdown 5% Scalping! Ability to avoid big price drop that can hurt capital! stable! bid and ask price different is 0.5
I've use most of code from this script, add some more filter, and added different kind of moving avg instead of rsi input .. please check the source code .. . 70-80% is similar to it. Please check can you convert And are you familiar with backtest.py library? Oky. This library has ML approach to get the optimized backtest parameters right ? included for this but let me know what you think? can you install backtest.py
Project Description : I need an experienced programmer to convert the TradingView indicator "CURRENCY STRANGHT CHART by boitoki" into a MetaTrader 5 (MT5) format. The indicator should function identically to the original and be fully compatible for integration into an Expert Advisor (EA) on MT5. Requirements : Convert "TTD Middle Right Normal" from TradingView to a .mq5 file for MT5. Ensure all indicator features and
Project Description : I need an experienced programmer to convert the TradingView indicator "RSI BARS" into a MetaTrader 5 (MT5) format. The indicator should function identically to the original and be fully compatible for integration into an Expert Advisor (EA) on MT5. Requirements : Convert "TTD Middle Right Normal" from TradingView to a .mq5 file for MT5. Ensure all indicator features and visual signals are
Project Description : I need an experienced programmer to convert the TradingView indicator "TTD Middle Right Normal" into a MetaTrader 5 (MT5) format. The indicator should function identically to the original and be fully compatible for integration into an Expert Advisor (EA) on MT5. Requirements : Convert "TTD Middle Right Normal" from TradingView to a .mq5 file for MT5. Ensure all indicator features and visual
I am seeking to develop a small scalping robot in MQL5 that utilizes the "Trend Catcher with Alert" indicator. This indicator provides entry and exit signals, which I would like the robot to follow. Key Requirements: Entry Signals : The robot should enter a trade based on the signals generated by the Trend Catcher indicator. Exit Signals : The robot should exit trades according to the indicator's exit signals
I have list of free indicators in tradingview and i would like to convert them into an mt4 ea, But the EA will have and work based on the indicators features The list of the are listed as follows :> 1. Market Structure Break And Order block. By EmreKb 2. Rainbow Adaptive RSI by LuxAlgo 3. Multiple MA (21,50,100) 4. SuperTrend My budget for this 80$ max
I want to develop a trade copier that copies trades from master account to client and also from client account to master account. It should be working on computer or VPS

Project information

Budget
40+ USD
For the developer
36 USD