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
(584)
Projects
913
46%
Arbitration
31
39% / 29%
Overdue
93
10%
Loaded
2
Developer 2
Rating
(57)
Projects
72
22%
Arbitration
13
46% / 15%
Overdue
5
7%
Free
3
Developer 3
Rating
(566)
Projects
639
41%
Arbitration
21
57% / 29%
Overdue
45
7%
Loaded
4
Developer 4
Rating
(6)
Projects
10
50%
Arbitration
6
17% / 50%
Overdue
3
30%
Working
5
Developer 5
Rating
(132)
Projects
191
81%
Arbitration
17
29% / 47%
Overdue
10
5%
Working
6
Developer 6
Rating
(10)
Projects
15
27%
Arbitration
3
67% / 33%
Overdue
0
Free
7
Developer 7
Rating
(63)
Projects
75
55%
Arbitration
0
Overdue
0
Free
8
Developer 8
Rating
(52)
Projects
96
24%
Arbitration
9
22% / 22%
Overdue
12
13%
Working
9
Developer 9
Rating
(145)
Projects
162
41%
Arbitration
5
0% / 80%
Overdue
8
5%
Working
10
Developer 10
Rating
(46)
Projects
50
8%
Arbitration
17
12% / 41%
Overdue
3
6%
Busy
Similar orders
Smith Ai 30+ USD
I want to a developer to build my simple strategy into a Ea ... indicator are bollinger band with default setting variables index dynamic average 9.12 and moving averages 50 with parabolic stars 0.003 ..0.2Here is how the strategy works when vdma crossing 50 ma down ...and price is below middle bollinger band Expert open a SELL ORDER ....if though the psar is below price ....ea open another. Sell position of price
Hi, I've developed an Fratile brake and retest EA. I have not been able to backtest it since i cant get it to work. I need your help in checking the code and making sure that the code is intact and all functions will work as they are or perhaps add your improvements. Please see a detailed description of the EA below. Reachout to me and i will provide you with the full code. Fractal Breakout EA Overview The Fractal
I would like to find a freelancer who can create an indicator or expert advisor about COT reports. I want it to automatically get the results and added to the indicator. it should be able to tell me if the banks are buying oir selling more for the week. it should also advise the long and short position for the pairs that i am looking at
Hi, I am looking for a scalping bot, that will have below criteria: 1. Take a position in the direction of the market with 1 STANDARD LOT. 2. Wait for 125 seconds after entering the position. 3. Exit the position when the position shows $10 profit. 4. Scan multiple leading currencies for such setups. 5. More than 5 positions should not be open at a time. 6. Exit the position if the floating loss exceeds $100. 7
Hello I am looking for a developer to help me do modification on my custom ninjatrader 8 strategy and also backtest it in other to work perfectly your expertise is highly needed for this project Kindly reach out to me and let get started on the project Thanks
I want to build a well performance mt4 indicator or trading view indicator for my strategy, please you must make sure you are a professional in building mt4 indicator or trading view indicator with serveral years of experience, so if you are kindly react to this and let talk more on how you will get my indicator working
EA development 30+ USD
HELLO there, am looking for some one that have serveral years of experience in developing a well performance EA, that can use both mt4, mt5 platform for development, please you most be an expert in the coding of EA , THANK YOU
Hi guys I eould like to know if it‘s possible to draw highs and lows with a horizontal line in the line chart? It should be an indicator with buffers that I can integrate it into an EA. If it‘s possible please explain how you would detect those highs and lows. Thanks in advance
bonjour je cherche un developpeur pour coder un ea que j ai deja , il suffira juste de reproduire le meme , car cette ea fonctionne tres bien en demo mais pas en reel , je veux que celui ci fonctionne en reel , l ea sera donner au developpeur s 'occupant de reconstruire cette ea , merci a vous ! pour mt4
Hi, Greetings ! Can somebody help me with a Half Trend Scanner with Higher Time Frame Confluence feature please. I am willing to pay if thats the case. Kind regards. Anton

Project information

Budget
40+ USD
For the developer
36 USD