仕事が完了した
実行時間37 秒
指定
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; } //+------------------------------------------------------------------+
応答済み
1
評価
プロジェクト
338
29%
仲裁
36
28%
/
64%
期限切れ
10
3%
取り込み中
2
評価
プロジェクト
35
23%
仲裁
4
0%
/
50%
期限切れ
2
6%
仕事中
3
評価
プロジェクト
602
34%
仲裁
65
20%
/
57%
期限切れ
147
24%
仕事中
パブリッシュした人: 1 article, 22 codes
4
評価
プロジェクト
8
13%
仲裁
6
33%
/
33%
期限切れ
0
暇
5
評価
プロジェクト
2
0%
仲裁
2
0%
/
50%
期限切れ
0
暇
6
評価
プロジェクト
1461
72%
仲裁
122
29%
/
48%
期限切れ
356
24%
仕事中
パブリッシュした人: 3 articles
7
評価
プロジェクト
62
23%
仲裁
10
20%
/
50%
期限切れ
10
16%
仕事中
8
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
暇
9
評価
プロジェクト
180
46%
仲裁
3
33%
/
33%
期限切れ
1
1%
仕事中
10
評価
プロジェクト
26
38%
仲裁
6
33%
/
50%
期限切れ
0
暇
11
評価
プロジェクト
15
27%
仲裁
0
期限切れ
3
20%
暇
12
評価
プロジェクト
478
40%
仲裁
105
40%
/
24%
期限切れ
82
17%
取り込み中
パブリッシュした人: 2 codes
類似した注文
DESCRIPTION: I have a trading bot (Pips Sure EA v2.1) that operates on MT4, but I do not own the original .mq4 source code file. I need an experienced MQL4 developer to build a clean, optimized clone from scratch so that I can own the source code for long-term updates. WHAT I WILL PROVIDE: 1. The compiled .ex4 bot file. 2. The companion custom indicator file used by the bot (HiLo.ex4). 3. Detailed screenshots of all
Senior MQL5 + Python Quant Developer Needed – Institutional AI Trading Platform I'm looking for a highly experienced quantitative developer (or small team) to build an institutional-grade algorithmic trading platform for MetaTrader 5 and Python . This is not a simple Expert Advisor. It is a complete trading platform consisting of an MQL5 execution engine, Python AI research environment, machine learning pipeline, and
I need a trading robot for MetaTrader 5 that works on mobile for XAUUSD. === TRADING RULES === Symbol: XAUUSD Timeframe: M15 Trading Hours: 10:00 to 18:00 server time only Buy: When 10 EMA crosses above 50 EMA Sell: When 10 EMA crosses below 50 EMA Close opposite position when new signal appears === RISK MANAGEMENT === Risk per trade: 1% of account balance Stop Loss: 300 points / $3.00 Take Profit: 600 points / $6.00
Jona copilot v12
30 - 40 USD
Hi, I'm interested in ordering an MT4 trading bot. Before we begin, could you please send me the technical specifications and requirements you'll need? Specifically, I'd like to know: - The trading strategy the bot will use. - The currency pairs or instruments it will trade. - The timeframes it supports. - Risk management features (lot sizing, stop loss, take profit, trailing stop, maximum drawdown). - Whether it
Please programm liquidity sweep
100+ USD
Please programm liquidity sweep based on my 0/1 conditions. I will contact selected candidates, btw, Maybe you did already liquidity sweep, it would be very nice, you will have better understanding what I mean, source of code required
I need an ea send news low medium or high to my telegram channel or group with topic news news news news news n n n j j i i i o
I am searching a specialist for market validation
30 - 100 USD
I have few EAs that I want to place on market, but I can't due to some errors, please help me, because I am not a programmer. Source of code required, bug free version, ony my computer it must works not only on your computer
Anybody programm in python here?
100 - 500 USD
Hello dear all developers, I will find here python programmers? I would like to create an Expert Advisor, if you can you can convert, because I already have Expert Advisor written in mql5 or maybe you will create a bridge? it's up to you, but I need 1:1 copy
I am searching a professional programmer
100 - 700 USD
Hello! I am searching a professional programmer for regular works. I don't care if you have 1 projects done or 1000, show me your skills. I need to create an EA based on Zig Zag indicator and candlestick patterns, EA must works on all time frames, source of code required
My EA have bug
30+ USD
Expert Advisor have a bug, I tried to fix it somehow with searching on google, but I couldn't fix find a solution. Please fix it, I will send you erorr type, what line etc. Only serious programmers, not amateur please. My time is precious
プロジェクト情報
予算
30+ USD