From 66810a409018b0c5154185520c573fbcad2b6d20 Mon Sep 17 00:00:00 2001 From: Bell Date: Thu, 9 Oct 2025 23:46:38 +0700 Subject: [PATCH] config code for vscode --- .github/copilot-instructions.md | 58 +++++++++++++++++++++++++ .vscode/settings.json | 7 ++- Experts/BellPriceActionWithEma50EA.mq5 | Bin 20358 -> 20890 bytes Profiles/Charts/Default/chart01.chr | Bin 955450 -> 955450 bytes experts.dat | Bin 0 -> 73956 bytes 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/copilot-instructions.md create mode 100644 experts.dat diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..97b5720 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,58 @@ +## Objective + +This repository contains MetaTrader 5 Expert Advisors (MQL5). The primary EA is `Experts/BellPriceActionWithEma50EA.mq5`. These instructions help an AI coding assistant make productive, low-risk edits by highlighting the project's structure, conventions, and important code patterns. + +## Quick architecture overview + +- Codebase is organized under `Experts/`, `Include/`, `Indicators/`, `Libraries/`, `Scripts/` following typical MQL5 terminal structure. +- Primary control loop: `OnTick()` in `Experts/BellPriceActionWithEma50EA.mq5` — this contains entry logic, signal detection, position sizing, and order placement. +- Signal & filters: + - Trend filter: `EMAFilter()` uses `iMA` (EMA50/EMA200) on `TrendTF` (default `PERIOD_M5`). + - Entry patterns: `DetectDoubleTop()` / `DetectDoubleBottom()` plus `IsBullishEngulfing()` / `IsBearishEngulfing()` run on `EntryTF` (default `PERIOD_M1`). + - Risk sizing: `CalculateLotByRisk()` computes lots from `RiskPercent` and stop-loss points using `SymbolInfoDouble` values. + - Order execution: `PlaceMarketOrder()` calls the `CTrade` methods `Buy()`/`Sell()` and sets `ExpertMagicNumber`. + +## What to change safely + +- Non-critical tweaks: input parameter defaults near the top of `Experts/BellPriceActionWithEma50EA.mq5` (e.g., `EMA_Fast`, `EMA_Slow`, `RiskPercent`, `TP_Multiplier`, `MaxOpenPositions`). +- Add diagnostics/logging: use `Print()` or `PrintFormat()` inside `OnTick()` and helper functions. Avoid printing every tick (rate-limit by comparing `iTime()` or a static timestamp). +- Visualization: toggles like `VisualizeEMAs` control `ChartIndicatorAdd()` calls; toggles are safe to change. + +## What to avoid / high-risk areas + +- Changing position sizing or order placement logic without running a backtest can cause real-money risk. `CalculateLotByRisk()` and `PlaceMarketOrder()` are the critical sections to review together. +- Do not change the `ExpertMagicNumber` lightly — it's used to identify positions opened by this EA. + +## Project-specific conventions + +- Timeframe separation: Trend calculation runs on `TrendTF` (M5 by default) while entry pattern detection runs on `EntryTF` (M1). Keep this separation when adding indicators or signals. +- Many helper functions work with the `_Symbol` and explicit timeframe arguments (`ENUM_TIMEFRAMES`). Prefer `iMA`, `iOpen`, `iClose`, `iLow`, `iHigh` calls to keep data access consistent. +- Use `_Point`, `SymbolInfoDouble(..., SYMBOL_...)`, and account info functions when computing price/volume; these are used throughout for portability across symbols and instruments. + +## Build / test / debug workflows + +- This is an MQL5 project intended to be edited inside MetaEditor or the MetaTrader terminal: + - Build: open the `.mq5` file in MetaEditor and press Compile (or use the terminal's compile command). + - Backtest / debug: use the Strategy Tester in MetaTrader 5. There is no CI here; changes should be validated with local backtests before live deployment. +- Quick local checks an AI agent can suggest to the developer (do not run live): + - Run a short backtest (few thousand ticks) in the Strategy Tester on a demo account. + - Add `PrintFormat()` statements and use the Journal/Experts log to inspect behavior during a forward test. + +## Examples from codebase (patterns an AI should follow) + +- Pattern detection: `DetectDoubleBottom(EntryTF, 40, DoubleTolerancePoints, level)` — helpers return booleans and an out parameter `levelPrice`. +- Rate-limited tick handling: `static datetime lastEntryTime` + comparing to `iTime(_Symbol, EntryTF, 0)` to run logic only once per `EntryTF` candle. +- Position counting: `CountOpenPositionsSymbol()` loops `PositionsTotal()` and compares `PositionGetSymbol(i) == _Symbol`. + +## Edit guidance for PRs + +- Provide a short description linking changes to specific inputs or functions (e.g., “Adjust risk calc in `CalculateLotByRisk()` to use SYMBOL_TRADE_TICK_VALUE fallback”). +- Add or update a small test/backtest report (Strategy Tester settings and graphs) in the PR description when changing trading logic. + +## Missing information / when to ask the human + +- If a change modifies risk, order execution, or magic number, ask for the intended account (demo vs live) and a short test plan. +- If adding new external dependencies (libraries/indicators), request the exact indicator file or include path and confirm licensing. + +--- +If anything in this file is unclear or you want me to include more project-specific examples (e.g., sample Strategy Tester settings, typical symbol/instrument, or a suggested short backtest), tell me which area to expand. diff --git a/.vscode/settings.json b/.vscode/settings.json index 26ced2f..2ae0a60 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,12 @@ "*.mq5": "cpp" }, "editor.tabSize": 3, + "editor.wordWrap": "wordWrapColumn", // "on"|"off"|"wordWrapColumn"|"bounded" + "editor.wordWrapColumn": 100, // wrap column (set to whatever you prefer) + "editor.wrappingIndent": "indent", // keeps wrapped lines indented + "editor.rulers": [80, 100], // visual guides for line length "C_Cpp.default.forcedInclude": [ "c:\\Users\\thinh\\.vscode\\extensions\\l-i-v.mql-tools-2.2.0\\data\\mql5_en.mqh" - ] + ], + } \ No newline at end of file diff --git a/Experts/BellPriceActionWithEma50EA.mq5 b/Experts/BellPriceActionWithEma50EA.mq5 index fc81c60c8260d4ae92bd7c531638024c1290fd96..5072929885cbd5bf9103096f06eb3746e25e8830 100644 GIT binary patch delta 839 zcmaizL1@!p6vvacbhgHt)ig=FuBL4!ZRti0b=G#)PFp8qRuPdQqX%IkSn8O!4QAb; z2bF>RRmLugiU&ccdbBXvtbzePigErTw0;3QiXCtH68KRk%90COZ^NoE^SJHt62+Zov6|vB zbKqo0{6lo%xhNtaaj*#^X5tWvy+e2^)c%#MCnUQH%;Ji)h4*3c{!RdAWcBy4;&)+A z4t0kwWw9N~jwnO9n0<^BU&BGPWRCU_fZMC#!dM6u?<&MmKo5_;A-PnJ#g~jqR*p@v9kb=kI?dxTl@_pi zg2P-|Cb5w{7F~&%v=f)IqV6Agl(n#3O4ayi&&91qsn276>pY|2U06cCAmDPI!_ujm zgKh)e3i{yIX$f40Lp(1-=o3xV6Nkb~GiBx`Gi|g%>tMYQBb9=$hgHbkiR0}tZJhOY Ukn2S^QHv3sM*k%^l+Hzd0Y20j!~g&Q delta 816 zcma))Ur19?9LINc-eg@b^KS0{^twOgZflEeZl>FEq0T>JE{GoXFno|6WQ6z44EF#i*(5A_Bcd;(@ zlF65r@|_{9nXCW4V4!IhRqHJ6s`gA`$GU`j zHXo|}MigZkH~K}4+bwMY9i@I?k80F8&8i^gIK&5+K*rDdfCL0ar4}J7T%Tf>oA%`(%$!#!|s$ocqQ0^ zxd8_XK^rq{N+PKQ%N$A<>ZyId7(pa-K-G}KX>vXMxrN1+yWx9izE@`4!cXcFS08I@5L+uah)JUwQ^ z$E*dFu{9K}1{e|&<|f!ta@0bK*^x7pj;!WW9EPXszwl++MV~_>w BBw7Ff delta 110 zcmWm1yA6OK6a~=t{Nry0H!u<*5;`kece1cnmY}pVVI-#TTAbnpZ-cjw< diff --git a/experts.dat b/experts.dat new file mode 100644 index 0000000000000000000000000000000000000000..51ae4602821fb197f31bba1394bcfac5f358499d GIT binary patch literal 73956 zcmeI5Z*m*Q5yi);T);Qr1>#ECj{oEv2#S#^l1U4)n7B~ofnKbxI>GtNu*CCqyncc67x*q-`8M3+$_i)v39sVMN_S1d6-NFM zJ_}!lukidN{5^b)uOa?^im{_`7{0)j0j_UUmej0z` zXLz0V^B>FS`;gc9F>e0#x8E=MJs*|6@$td(1W4RO91|>qa304a+H9&;Tw}!0ZQ)U;!*6IIExGz)qsxnMdu# z^K)TTqo~KQP@zzCCz(otJ%l))K)cXOBF6N50nDu1LzfV zRraw9mM-h*3>I3D%eD2OMWOY$!3YzNL}=S}L#b|sY`p6Y?$elKSekI;AG$0{7v#=h zS;n01B3!__3~)?~GQrs_+LiKE1Bpp~S(XM$k3WNZ9OdZ@Sa9ZwGeT(^;4sSDY4{&R zEaRg0h>H%w8Jy7^cg&z-7%QFQEX|4?;JzV(Z39NI2$mu&FT$~40UtefLw}xSVUAap zMX>DUhDLB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