Debug my iCustom EA

MQL5 전문가

작업 종료됨

실행 시간 3 시간
피고용인의 피드백
Thank you very much for the job, it has been a pleasure!

명시

I have a custom indicator, and want to create an EA than using "iCUSTOM" and "PRINT", make the EA can read and print the indicator values at journel for each bar correctly when I put this EA into backtesting, i tried to make it, but it can't get the right values, so would like someone help me to fix it


 

Pls read through my indicator and EA, and make sure you know what’w wrong with my EA before you accpet this job, thanks

 

My indicator

//+------------------------------------------------------------------+
//|     MA_Direction_SingleBuffer_MQL4.mq4                          |
//|      |
//|   適用於 MQL4,便於 EA 調用 buffer[0],與圖表分色並存           |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Lime    // Up
#property indicator_color2 Red     // Down
#property indicator_color3 Gray    // Flat
#property strict

input int MAPeriod = 14;

// Buffers for plotting (only one active per bar)
double bufferUp[];    // buffer 0 - EA 調用此值
double bufferDown[];  // buffer 1 - 僅視覺繪圖用
double bufferFlat[];  // buffer 2 - 僅視覺繪圖用

//+------------------------------------------------------------------+
int OnInit()
  {
   IndicatorShortName("MA_Direction_SingleBuffer");

   SetIndexBuffer(0, bufferUp);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexLabel(0, "Slope");

   SetIndexBuffer(1, bufferDown);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexLabel(1, "Down");

   SetIndexBuffer(2, bufferFlat);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 1);
   SetIndexLabel(2, "Flat");

   return INIT_SUCCEEDED;
  }
//+------------------------------------------------------------------+
int 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[])
  {
   if (rates_total < MAPeriod + 2)
      return 0;

   int start = MathMax(prev_calculated - 1, 1);

   for (int i = start; i < rates_total - 1; i++)
     {
      double ma_now = iMA(NULL, 0, MAPeriod, 0, MODE_SMA, PRICE_CLOSE, i);
      double ma_prev = iMA(NULL, 0, MAPeriod, 0, MODE_SMA, PRICE_CLOSE, i + 1);
      double slope = ma_now - ma_prev;

      // 寫入主輸出 buffer(供 EA 調用)
      bufferUp[i] = slope;

      // 視覺分色(其他兩 buffer 只為圖表用)
      if (slope > 0)
        {
         bufferDown[i] = 0;
         bufferFlat[i] = 0;
        }
      else if (slope < 0)
        {
         bufferDown[i] = slope;
         bufferFlat[i] = 0;
         bufferUp[i] = 0;
        }
      else
        {
         bufferDown[i] = 0;
         bufferFlat[i] = 0.0000001;  // 微量顯示灰色線
         bufferUp[i] = 0;
        }
     }

   return rates_total;
  }

My EA

//+------------------------------------------------------------------+
//|                             MA_Direction_SingleBuffer_Reader.mq4 |
//|                                  Copyright 2024, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+

#property strict

input int MAPeriod = 14;   
input double Threshold = 0.00001; 

double MA_Value;
datetime OpenTime = iTime(Symbol(), PERIOD_CURRENT, 0);

//+------------------------------------------------------------------+
int OnInit()
  {
   Print("MA Reader EA initialized.");
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void OnTick()
  {
   if (newC())
     {
      MA_Value = iCustom(Symbol(), PERIOD_CURRENT, "MA_Direction_SingleBuffer", MAPeriod, 0, 1);

      if (MA_Value > Threshold)
         Print("📈 UP: ", DoubleToString(MA_Value, 6));
      else if (MA_Value < -Threshold)
         Print("📉 DOWN: ", DoubleToString(MA_Value, 6));
      else
         Print("➖ FLAT: ", DoubleToString(MA_Value, 6));
     }
  }
//+------------------------------------------------------------------+
bool newC()
  {
   datetime newOpenTime = iTime(Symbol(), PERIOD_CURRENT, 0);
   if (newOpenTime != OpenTime)
     {
      OpenTime = newOpenTime;
      return true;
     }
   return false;
  }
//+------------------------------------------------------------------+



Pls help






응답함

1
개발자 1
등급
(205)
프로젝트
308
34%
중재
56
38% / 38%
기한 초과
99
32%
작업중
2
개발자 2
등급
(254)
프로젝트
377
25%
중재
22
59% / 23%
기한 초과
1
0%
로드됨
3
개발자 3
등급
(45)
프로젝트
59
37%
중재
1
0% / 0%
기한 초과
1
2%
작업중
4
개발자 4
등급
(36)
프로젝트
38
11%
중재
2
50% / 50%
기한 초과
2
5%
작업중
비슷한 주문
HEY CODERS , I HAVE A STRADEGY IN MIND, I WANT AN EA ROBOT TO TRADE MY STYLE OF STRADEGY, IT DOES NOT NEED NO INDICATOR OR RSI, ITS A MARTINGALE STRADEGY. AND THE EXICUTION OF THE FIRST TRADE WILL BE BASED ON A SET PIP AMOUNT FOR AREA DIRECTION THE PRICE GOES TO FIRST
I am looking for a profitable ready made EA . It should be able to trade forex pairs or crypto. Please note im looking for a ready made NOT someone to develop an EA. Apply if you have the EA . it should work with low balance from 100 usd
Hello, I would like to develop a custom Expert Advisor (EA) for MT4 (or MT5 if preferred). Requirements: Open trades based on a signal (to be specified later: e.g., indicator, moving average cross, or manual conditions). Automatically set Stop Loss (SL) and Take Profit (TP) for each trade. Option to open an averaging/hedging trade with the same lot size when the price moves against the first trade by a defined number
I need a profitable trading EA that can maximize a profitable trade for daily uses. An EA that can trade all kinds of of currencies and must be an existing EA with 70-80% guarantee
I am looking for skilled Expert Advisor (EA) developers and algorithmic traders interested in forming a long-term, profit-sharing partnership. This is an opportunity for developers who have strong strategies but lack the capital to fully deploy them. ✅ What I’m Looking For Developers with profitable EAs (forex, indices, gold, etc.) that can be proven with verified demo performance . Algorithmic traders who can build
Automate my strategy 30 - 70 USD
🚀 Looking for a Trading Bot Coder 🚀 I’m searching for an experienced developer to help automate my trading strategies. Requirements: Strong knowledge in MQL5 / MT5 (or TradingView Pine Script, depending on platform) Experience with price action & strategy automation Ability to integrate custom risk management & alerts 💡 If you’re a skilled coder who can turn trading ideas into a profitable bot, let’s connect
Общая информация о Box EA Эта система — коробочная стратегия . Каждый день в заданное время строится диапазон ( коробка ) по цене. После окончания этого интервала советник выставляет стоп-ордера на пробой коробки. Есть три режима работы: Trend — вход по направлению тренда (определяется по EMA30/60). CounterTrend — вход против тренда. Random (OCO) — ставятся оба ордера, при срабатывании одного второй удаляется. Риск
I need an MQL4 developer to create two projects on MT4. The first is a grid trading EA that should not use martingale, but allow customizable settings such as grid step, lot size, maximum trades, take profit, stop loss, trading hours, and include risk management features. The second is a reverse trade copier that mirrors trades from one MT4 account to another in the opposite direction (for example, if the master
I'm seeking a highly skilled MQL5 developer to backtest and optimize an existing Expert Advisor (EA) for consistent and stable performance on XAUUSD (Gold), M5 timeframe . Project Scope: Conduct detailed backtesting using high-quality, accurate historical data Perform advanced optimization of key parameters: Risk settings Stop Loss / Take Profit Trailing stop Lot sizing Other relevant EA settings Ensure robust
Hello, I’m currently looking to hire a professional and experienced developer to help create a custom trading bot (Expert Advisor) for the MetaTrader platform (MT5). What I Need: I’m looking for someone who can: Develop a fully automated trading bot based on my strategy (which I will provide in detail)

프로젝트 정보

예산
30+ USD
개발자에게
27 USD