Tâche terminée
Temps d'exécution 37 secondes
Spécifications
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; } //+------------------------------------------------------------------+
Répondu
1
Évaluation
Projets
362
30%
Arbitrage
37
27%
/
65%
En retard
10
3%
Chargé
Publié : 10 codes
2
Évaluation
Projets
35
23%
Arbitrage
4
0%
/
50%
En retard
2
6%
Travail
3
Évaluation
Projets
603
34%
Arbitrage
65
22%
/
57%
En retard
146
24%
Travail
Publié : 1 article, 22 codes
4
Évaluation
Projets
8
13%
Arbitrage
6
33%
/
33%
En retard
0
Gratuit
5
Évaluation
Projets
2
0%
Arbitrage
2
0%
/
50%
En retard
0
Gratuit
6
Évaluation
Projets
1469
72%
Arbitrage
123
28%
/
47%
En retard
360
25%
Travail
Publié : 3 articles
7
Évaluation
Projets
63
24%
Arbitrage
10
30%
/
50%
En retard
10
16%
Gratuit
8
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
9
Évaluation
Projets
198
46%
Arbitrage
4
50%
/
25%
En retard
1
1%
Travail
10
Évaluation
Projets
26
38%
Arbitrage
6
33%
/
50%
En retard
0
Gratuit
11
Évaluation
Projets
15
27%
Arbitrage
0
En retard
3
20%
Gratuit
12
Évaluation
Projets
478
40%
Arbitrage
105
40%
/
24%
En retard
82
17%
Chargé
Publié : 2 codes
Commandes similaires
Ninjascript strategy tester
30+ USD
Hi, I need NinjaTrader 8 Strategy Analyzer backtests on two of my strategies, each over 1 year AND 3 years of data. Please quote the full job. Common settings: NT8 Strategy Analyzer, MCL (Micro WTI Crude Oil) continuous front-month contract (MCL ##-##), 5-minute bars, 1yr + 3yr of the most recent data, $2.50 round-turn commission per contract. Deliverables per run: full Strategy Analyzer summary (net profit, profit
Ninjascript strategy tester
30+ USD
Hi, I need NinjaTrader 8 Strategy Analyzer backtests on two of my strategies, each over 1 year AND 3 years of data. Please quote the full job. Common settings: NT8 Strategy Analyzer, MCL (Micro WTI Crude Oil) continuous front-month contract (MCL ##-##), 5-minute bars, 1yr + 3yr of the most recent data, $2.50 round-turn commission per contract. Deliverables per run: full Strategy Analyzer summary (net profit, profit
1. Overview Build an MQL5 Expert Advisor for MetaTrader 5 that trades XAUUSD (Gold) as a scalper, using Heiken Ashi candles and a 50 EMA for entries. 2. Platform and symbol MetaTrader 5, Expert Advisor (.mq5 and compiled .ex5) Symbol: XAUUSD (must work with broker suffixes, e.g. XAUUSDm) Default timeframe: M5 (configurable; M1 to M15 should work) 3. Indicators Heiken Ashi candles, calculated inside the EA (no
I I am looking for an experienced MQL5 developer to build a robust, fully automated Expert Advisor (EA) for MetaTrader 5 based on a moving average pullback strategy. The EA must be optimized for multi-symbol and multi-timeframe processing, capable of running on a single chart while scanning and trading a user-defined list of currency pairs. 1. Core Strategy Logic * Trend Zone: The strategy utilizes the zone between
a { text-decoration: none; color: #464feb; } tr th, tr td { border: 1px solid #e6e6e6; } tr th { background-color: #f5f5f5; } Project Description I need an Expert Advisor (EA) for MetaTrader 5 (MT5) that can automatically trade Gold (XAUUSD) and major Forex pairs. The EA must analyze market conditions, open and close trades automatically, manage risk effectively, and be fully compatible with the MT5 Strategy Tester
Hi mql5 community, I am actually looking for a dev who applied to my previous job posted few days ago regarding " Need a faithful ready made hft scalper ea robot" He already reached out with an EA which I was validating its performance on my end, but unfortunately the weekend absolutely got my away from internet while have to pay attention to some physical tasks, and during those time I couldn't been able to check
I am aspiring professional trader
30 - 70 USD
I can pay you 70 USD for consultation if you have something valuable. no scam please, I am too smart to be scammed, Thank you for your patient and attention. Have a nice day for you and your family, May God bless you and your family :)
MQL5/MT5 TRADING BOT
57+ USD
Hi i'm looking for a trading bot that will trade on mt5/MQL5. The bot must be able to follow trend and works on any pair,chart and symbol. All distance measured with ATR. Trend from a higher time frame (default H1) with a moving average;UP/DOWN. Support and resistance found automatically from recent swing highs and low nothing drawn on the chart. Two kinds of trades, each can be switched on/off. S/R trades; price
EA-MT5-XAUUSD-PuPrime-Live6 +10%/m
30 - 200 USD
I am looking for an EA using MT5, trading XAUUSD on PuPrime-Live6, Standard account. LIMITATIONS No martingale, no grid. Start equity 1000 EUR. Leverate 1:500 Account in USD. PuPrime-Live6 All settings (risk, time, drawdown %, cooldown, lot size) shall be adjustable on init or backtest. VERIFICATIONS The EA needs to reach the profit goals on Actual Ticks, 100ms slippage in backtests for each month 2026. profit goal
Hi All developers, I am looking for a EA which makes minimum 1:5 risk reward ratio with buy stop and sell stop orders placed based on candle open based or candle high low based or any other strategy .... If any having please share it for TEST, After proper TESTING only I will confirm the job... Please read this and respond
Informations sur le projet
Budget
30+ USD