I Need Debugging For My Personal Source Code EA

Tarea técnica

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

Han respondido

1
Desarrollador 1
Evaluación
(584)
Proyectos
915
46%
Arbitraje
31
39% / 29%
Caducado
93
10%
Trabaja
2
Desarrollador 2
Evaluación
(57)
Proyectos
72
22%
Arbitraje
13
46% / 15%
Caducado
5
7%
Libre
3
Desarrollador 3
Evaluación
(566)
Proyectos
639
41%
Arbitraje
21
57% / 29%
Caducado
45
7%
Trabajando
4
Desarrollador 4
Evaluación
(6)
Proyectos
10
50%
Arbitraje
6
17% / 50%
Caducado
3
30%
Trabaja
5
Desarrollador 5
Evaluación
(135)
Proyectos
195
81%
Arbitraje
18
28% / 44%
Caducado
10
5%
Trabajando
6
Desarrollador 6
Evaluación
(10)
Proyectos
15
27%
Arbitraje
3
67% / 33%
Caducado
0
Libre
7
Desarrollador 7
Evaluación
(63)
Proyectos
75
55%
Arbitraje
0
Caducado
0
Libre
8
Desarrollador 8
Evaluación
(52)
Proyectos
96
24%
Arbitraje
9
22% / 22%
Caducado
12
13%
Trabaja
9
Desarrollador 9
Evaluación
(145)
Proyectos
162
41%
Arbitraje
5
0% / 80%
Caducado
8
5%
Trabaja
10
Desarrollador 10
Evaluación
(48)
Proyectos
53
8%
Arbitraje
18
17% / 39%
Caducado
3
6%
Ocupado
Solicitudes similares
THE DEVELOPER MUST NOT HAVE ANY PENDING JOBS TIME IS OF THE ESSENCE I ALREADY HAVE SORUCE CODE, ADD ENTRIES AND CONDITIONS TO CODE I NEED THIS DONE BY TODAY OR TOMORROW MORNING THE LATEST The MT4 EA will work simultaneously on multi pairs the broker has to offer. The opening procedure will begin as follows: In this example I will use a BUY order. The same for SELL order. When the EA is dragged/ double clicked/ added
Attached is the sample of what I need. It is a robot that does not require mt5 or mt4. API has been generated from Deriv already but I don't have the skills required to create the app. Kindly notify me if you can create such for me. Thank you
Hey, im looking for a person who can create an my very own version of pineconnector, which should have all the option of pineconnector and it should be user-friendly without any complications
HI, I'm looking for an experienced person who can add buy/sell indications and Alerts on existing Pinescript along with little modification of the script and the script should connect to MT5 platform using pineconnector MT5 platform should excute trade instantly as based on the alerts/indications on tradingview script
I want the trade to trigger anytime it sees the opportunity on all time frames, sl tp should be automated and all trades should be trigger anytime on cpi news and etc
I need someone to help me convert my tradingview pinescript to mt4, I only got $20 for this and I am gonna be giving you more works ahead, Also I will be paying with cryptocurrency cause my PayPal os not working here, Don't know why
I need someone to help me convert my tradingview pinescript to mt4, my budget for this project is $20 and I need this done fast in two days, Also, I am going to need you to be able to build a new indicator because that's the nest project, But I need to know if you can do this first , Thank you
I need you to convert my tradingview pinescript to mt4, I have just $10 for it now, But i am going to give you more work later on cause i still have more work i am going to need you to work on for me, and i will be paying with crypto, Thank You
Hello, I am in need of an expert to help me convert my tradingview pinescript to mt4, I will attach the file, But for now, I only got $15 for this project and the only payment method I can use right now is crypto, I will send it to you through crypto, Also I need someone that is ready to work because I still have lot of projects I will need him to do for me
Hello how are you doing? Can you help me with a projects connecting trend lines to pivot points on a wave, for trendlines, color detention, and dynamic visualization? I have a project I’d like you to look at. I need a pine script code to capture the different Trendline colors that cross both above and below horizontal lines on the wave indicator

Información sobre el proyecto

Presupuesto
40+ USD
Para el ejecutor
36 USD