My indicator "iCUSTOM" template

MQL4 Experts

Job finished

Execution time 37 seconds

Specification

i have an indicator called "MA_Direction_SingleBuffer", and then create another indicator called "TrendStrength_BuyOnly" to calcualate the values of  "MA_Direction_SingleBuffer", until here, it seems work well  ( i am not sure, but at least both are work well when i put them in chart), now i want to create a EA, that can read the value of "TrendStrength_BuyOnly" for every bar, but doesn't work, so i wonld like someone help me to fix them, and tell me what's wrong with my code, pls make sure you can fix it before take this job

Here are the indicators and EA



MA_Direction_SingleBuffe

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


TrendStrength_BuyOnly

//+------------------------------------------------------------------+
//|     TrendStrength_BuyOnly.mq4                                    |
//|     計算近 LookbackBars 根 MA 斜率的趨勢強度(做多為主)         |
//|     資料來源:MA_Direction_SingleBuffer 的 buffer[0]            |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_width1 2
#property indicator_label1 "TrendStrength_BuyOnly"
#property strict

// --- 輸入參數
input int MAPeriod = 14;                 // 傳給 MA_Direction_SingleBuffer 用
input int LookbackBars = 90;            // 回顧 K 線數量
input double SlopeThreshold = 0.05;     // 視為有效斜率的門檻

// --- 指標 buffer
double TrendStrengthBuffer[];

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

   SetIndexBuffer(0, TrendStrengthBuffer);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexLabel(0, "Buy Trend Strength");

   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 < LookbackBars + 1)
      return 0;

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

   for (int i = start; i < rates_total - 1; i++)
     {
      double score = 0;

      for (int j = 0; j < LookbackBars; j++)
        {
         double slope = iCustom(NULL, 0, "MA_Direction_SingleBuffer", MAPeriod, 0, i + j);

         if (slope > SlopeThreshold)
            score += slope;
         else if (slope < -SlopeThreshold)
            score -= MathAbs(slope) * 0.5;
         else
            score -= 0.1; // 側向或雜訊
        }

      TrendStrengthBuffer[i] = score;
     }

   return rates_total;
  }
//+------------------------------------------------------------------+


EA

//+------------------------------------------------------------------+
//|                                      TrendStrengthReader_EA.mq4  |
//|                       Copyright 2025, The Blue Teams Academy     |
//|                  https://www.TheBlueTeamsAcademy.com             |
//+------------------------------------------------------------------+
#property strict
#property copyright "Copyright 2025, The Blue Teams Academy"
#property link      "https://www.TheBlueTeamsAcademy.com"
#property version   "1.00"

//--- 變數宣告
double TrendStrengthValue;
datetime OpenTime = 0;

//+------------------------------------------------------------------+
//| Expert 初始化                                                    |
//+------------------------------------------------------------------+
int OnInit()
  {
   Print("✅ TrendStrengthReader_EA initialized.");
   OpenTime = iTime(Symbol(), PERIOD_CURRENT, 0);
   return INIT_SUCCEEDED;
  }

//+------------------------------------------------------------------+
//| OnTick                                                            |
//+------------------------------------------------------------------+
void OnTick()
  {
   if (IsNewBar())
     {
      TrendStrengthValue = iCustom(Symbol(), PERIOD_CURRENT, "TrendStrength_BuyOnlyv2", 0, 1);

      if (TrendStrengthValue == EMPTY_VALUE)
         Print("❌ EMPTY_VALUE at bar 1 (未有資料填入)");
      else if (TrendStrengthValue == 0.0)
         Print("⚠️ Zero value at bar 1 (可能資料不足或斜率弱)");
      else
         Print("✅ TrendStrength (Bar 1): ", DoubleToString(TrendStrengthValue, 5));
     }
  }

//+------------------------------------------------------------------+
//| 判斷是否為新K線                                                  |
//+------------------------------------------------------------------+
bool IsNewBar()
  {
   datetime newTime = iTime(Symbol(), PERIOD_CURRENT, 0);
   if (newTime != OpenTime)
     {
      OpenTime = newTime;
      return true;
     }
   return false;
  }
//+------------------------------------------------------------------+













Responded

1
Developer 1
Rating
(226)
Projects
281
27%
Arbitration
14
50% / 36%
Overdue
9
3%
Busy
2
Developer 2
Rating
(15)
Projects
34
24%
Arbitration
3
0% / 33%
Overdue
2
6%
Working
3
Developer 3
Rating
(258)
Projects
585
35%
Arbitration
64
20% / 58%
Overdue
147
25%
Free
Published: 1 article, 22 codes
4
Developer 4
Rating
(7)
Projects
7
14%
Arbitration
5
20% / 20%
Overdue
0
Working
5
Developer 5
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Working
6
Developer 6
Rating
(839)
Projects
1431
72%
Arbitration
117
29% / 47%
Overdue
354
25%
Working
Published: 3 articles
7
Developer 7
Rating
(40)
Projects
57
21%
Arbitration
3
67% / 0%
Overdue
9
16%
Busy
8
Developer 8
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
9
Developer 9
Rating
(23)
Projects
25
8%
Arbitration
2
50% / 50%
Overdue
2
8%
Loaded
10
Developer 10
Rating
(11)
Projects
16
31%
Arbitration
3
67% / 0%
Overdue
0
Free
11
Developer 11
Rating
(10)
Projects
13
15%
Arbitration
0
Overdue
3
23%
Free
12
Developer 12
Rating
(284)
Projects
459
39%
Arbitration
95
43% / 18%
Overdue
73
16%
Working
Published: 2 codes
Similar orders
I have an existing TradingView indicator, and I’m looking to convert it into a trading bot for MQL5. If you're experienced in converting Pine Script strategies (specifically an EMA crossover strategy) into Expert Advisors (EA), feel free to reach out. Key features I need: A dashboard displayed at the top-left corner of the MetaTrader chart Input for risk amount per trade (in USD) Option to focus on either Buy setups
Custom Trading-View-to-(Meta Trader 4/Meta Trader 5) Bridge with Stealth Stop L/Take P Logic Project Title Custom Trading-View-to-Meta Trader 4/Meta Trader 5 Bridge with Stealth Stop L/Take P Logic (Web-hook + EA) Project Description I’m looking for a skilled M.Q.L developer who can build a custom Trading-View-to-Meta Trader 4/Meta Trader 5 trading bridge that performs the following functions: System Overview 1
SMC EA 50 - 100 USD
Looking for an SMC/ICT/S&R. it doesn't actually need to follow one of those concepts it's just those concepts offer tp that is bigger than sl and that is very important to me. If you have a profitable ea that tp is bigger then sl feel free to reach out. Waiting to hear from you guys
Through a series of sources, I’ve been able to generate this code. However, it won’t “Enable” in the Control Panel. The strategy should buy a futures contract at market Ask price. The contract should be held until the price reaches its highest point since entering the position. A user specified virtual (does not show on the order book) trailing sell stop should be in place so when the market begins to decline it
I want an EA for MT5 which makes many lots daily to earn broker rebates. it should be stable for long term. starting lot sizes should be 0.01-0.02 not big lots it should work on EURUSD/Gold and any other pairs please first present how many lots you can make and send me your test reports, then I will ask for demo version to check. source code should be included. all trading methods are allowed. please offer ready made
Below show the frame work needed and each component under each section have it its own explanation in the zip folder. Expert Advisor is trading base on time identified by EA on the candle, identifying when a market structure break occurs, followed by placing trades though Fibonacci, there are also Filters present. Money Management 1) Risk Filter 1) Manual Direction 2) Day 3) Exponential Moving Average 4)
Hello, I am looking for an experienced MQL5 developer to build a semi-automated Expert Advisor (EA) for MetaTrader 5. The EA will analyze US indices (US30, US100, US500) to detect specific market structures and send me alerts (pop-up + sound) when conditions are met. It will NOT execute trades automatically — manual confirmation is required (button click to execute). 🔹 Strategy Conditions: Timeframes: - OPR (Opening
I need an Expert Advisor (EA) for MetaTrader 5 that executes scalping trades on Gold (XAUUSD) based on ICT Smart Money Concepts. Strategy requirements: - Timeframes: M1 and M5 - Entry conditions: - Market Structure Shift (MSS) - Order Block detection - Liquidity Sweep (stop hunt) - Session filter: only trade during Asia, London, and New York sessions - Alert every 15 minutes when a valid entry setup appears -
✅ EA Features: MA Filters : Customizable SMA & EMA Market Structure : Detect basic swing highs/lows, identify bias Candle Patterns : 2 bullish + 2 bearish (logic will be provided) Trade Logic : Executes Limit and market entries on confirmed setup (MA + Structure + Pattern) 🎯 Settings: SL/TP: Fixed, or structure-based Lot size: Fixed or % risk Setup toggles: Enable/disable each of the 4 setups Alerts: Optional popup
Create a simulated MT5 ea to practice entering backtest trading orders in the strategy tester, the ea needs to have simple and easy-to-see control panels, including the following elements: - Buy - sell button and corresponding bid - ask price - Blank box to fill in lots size, TP, SL. Additional requirement is that TP, SL can be installed after placing a simulated order and just press the button, TP SL will be

Project information

Budget
30+ USD
For the developer
27 USD