I Need Debugging For My Personal Source Code EA

명시

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

응답함

1
개발자 1
등급
(584)
프로젝트
915
46%
중재
31
39% / 29%
기한 초과
93
10%
작업중
2
개발자 2
등급
(57)
프로젝트
72
22%
중재
13
46% / 15%
기한 초과
5
7%
무료
3
개발자 3
등급
(566)
프로젝트
639
41%
중재
21
57% / 29%
기한 초과
45
7%
로드됨
4
개발자 4
등급
(6)
프로젝트
10
50%
중재
6
17% / 50%
기한 초과
3
30%
작업중
5
개발자 5
등급
(135)
프로젝트
195
81%
중재
18
28% / 44%
기한 초과
10
5%
로드됨
6
개발자 6
등급
(10)
프로젝트
15
27%
중재
3
67% / 33%
기한 초과
0
무료
7
개발자 7
등급
(63)
프로젝트
75
55%
중재
0
기한 초과
0
무료
8
개발자 8
등급
(52)
프로젝트
96
24%
중재
9
22% / 22%
기한 초과
12
13%
작업중
9
개발자 9
등급
(145)
프로젝트
162
41%
중재
5
0% / 80%
기한 초과
8
5%
작업중
10
개발자 10
등급
(48)
프로젝트
53
8%
중재
18
17% / 39%
기한 초과
3
6%
바쁜
비슷한 주문
I need a trading robot that will be about to enter and get out of trades automatically following a set of conditions that will be provided. it will be determining the trend on a higher time frame and making trades on a lower timeframe
Trade Copier 1. Copy same Trade. 2. Also TP and SL 3. Need reverse trading Master to Slave 4. Adjust TP and SL future on Slave if you agree send sample copy first
hi, I need to convert my MT5 robot to Python for the freqtrade framework, https://www.freqtrade.io/en/stable/strategy-customization/ For trading futures on Bybit or Binance, I can also send the MT4 version if it is more convenient
Convert Pine Script Trading view To MT4 Convert Attach Script to mt4 with buy and sell signals on Chart and Data Window. The buy and sell signal must be the SAME signals, on the same candles. No deviation. Must Match BTC 1 hr to buy and sell signals... no deviation
hello 👋 great developer am looking for developer that will help me to convert pinescript strategy to mt4 strategy I will be looking for your bid soon Best regards Ayofe
Hello! I need to make the indicator for Forex Tester 5. The platform supports indicators/strategies/scripts which are written in .dll format and can be created in Delphi or C++ programming languages. Are you interested in the task? In the attached files the Task is explained, and in the file in Excel you can see the formulas and data. The task is to make an indicator for Forex Tester 5. If you want to fulfil the
There is an indicator on tradingview under the name of "Rob Booker - ADX Breakout". I need to convert it to an mql4 expert advisor. Plus adding regular standard settings of EA as tp,sl,lots,etc
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
Hi I bought FXSSI.com tools ( sentiment indicator) including the following indicator: FXSSI.Ratio.ex4 (.mq4 versions are not provided) Now I am trying to export the indicators' output values in an EA in order to generate trading signals and to backtest strategies based on various combinations of some of these indicators but I can't make it work. I use iCustom() but it always returns either: > 2147483647 if
EA (mq4 file) needs customization: 1. Add 2 params and their functionality. 2. Fix Global Variables (GV) so EA will NEVER miss a trade for any reason. Should not take more than an hour to complete the job

프로젝트 정보

예산
40+ USD
개발자에게
36 USD