Logging & Debug: print message, error code, trade status
៣. បំលែង Strategy ទៅជា EA Logic
មុនសរសេរ code អ្នកត្រូវបំលែង strategy ទៅជា logic ដែល computer អាចអនុវត្តបាន។
ឧទាហរណ៍ “Buy when trend is strong” មិនគ្រប់គ្រាន់ទេ។ ត្រូវបំលែងទៅជា rule ដូចជា
EMA 50 > EMA 200, price above EMA 50, RSI > 50 និង candle close bullish។
Rule កាន់តែ objective EA ក៏កាន់តែស្ថិតស្ថេរ។ Rule ដែលពឹងលើអារម្មណ៍ ឬភ្នែកមនុស្សច្រើនពេក
នឹងពិបាកបម្លែងទៅជា code។
៤. Prompt សម្រាប់បំលែងគំនិតទៅជា EA Specification
EA specification គឺជាឯកសារខ្លីមួយដែលពន្យល់ថា EA ត្រូវធ្វើអ្វីខ្លះ។
វាជាផ្លូវកាត់ល្អ មុនឱ្យ AI សរសេរ code។
📌 EA Specification Prompt
EN: Turn this trading strategy into a clear MT5 EA specification. Include inputs, entry rules, exit rules, risk management, filters, trade management, error handling, and testing checklist. Do not write code yet.
KH: បំលែង trading strategy នេះទៅជា MT5 EA specification ឱ្យច្បាស់។ បញ្ចូល inputs, entry rules, exit rules, risk management, filters, trade management, error handling និង testing checklist។ កុំសរសេរ code នៅឡើយ។
៥. Prompt សម្រាប់សរសេរ MQL5 Code
បន្ទាប់ពី specification ច្បាស់ អ្នកអាចសុំ AI សរសេរ MQL5 code។
សូមបញ្ជាក់ថា code ត្រូវ compile បាន, ប្រើ CTrade, មាន MagicNumber និងមិនបើក position ជាន់គ្នា។
📌 MQL5 Code Prompt
EN: Write a complete MT5 Expert Advisor in MQL5 based on this specification. Use CTrade, add clear input parameters, MagicNumber filtering, spread filter, one-position-per-symbol protection, risk-based lot calculation, SL/TP, trailing stop, and detailed comments. Make the code clean and compile-ready.
KH: សរសេរ MT5 Expert Advisor ពេញលេញជា MQL5 ផ្អែកលើ specification នេះ។ ប្រើ CTrade, បន្ថែម input parameters ច្បាស់ៗ, MagicNumber filtering, spread filter, ការពារ position ជាន់គ្នា, risk-based lot calculation, SL/TP, trailing stop និង comments លម្អិត។ ធ្វើ code ឱ្យស្អាត និង compile-ready។
៦. Risk Module សំខាន់ជាង Entry
EA ដែលមាន entry ល្អ ប៉ុន្តែគ្មាន risk control អាចគ្រោះថ្នាក់ខ្លាំង។
ក្នុង prompt អ្នកគួរបញ្ជាក់ឱ្យ AI បង្កើត risk module ដូចជា risk 1% per trade,
max daily loss, max open positions, max spread, stop trading after losses និង drawdown guard។
📌 EA Risk Module Prompt
EN: Add a strong risk management module to this MT5 EA. Include risk percent per trade, fixed lot option, max daily loss, max drawdown protection, max open positions, spread filter, and a rule to stop trading after consecutive losses.
KH: បន្ថែម risk management module ឱ្យរឹងមាំក្នុង MT5 EA នេះ។ បញ្ចូល risk percent per trade, fixed lot option, max daily loss, max drawdown protection, max open positions, spread filter និង rule ឈប់ trade បន្ទាប់ពីខាតជាប់ៗគ្នា។
៧. Debugging ជាមួយ AI
ពេល compile MQL5 code អាចមាន error ដូចជា undeclared identifier, wrong parameters,
invalid stops, position selection ឬ lot size មិនត្រឹមត្រូវ។ កុំគ្រាន់តែថតរូប error ឱ្យ AI មើល។
ល្អបំផុតគឺ copy error message, line number និង code ផ្នែកដែលពាក់ព័ន្ធ។
📌 Debug Prompt
EN: Fix these MQL5 compile errors. I will paste the error list and the related code. Explain the cause briefly, then provide the corrected full code section. Do not change the trading logic unless necessary.
KH: ជួសជុល MQL5 compile errors ទាំងនេះ។ ខ្ញុំនឹងផ្ញើ error list និង code ផ្នែកពាក់ព័ន្ធ។ សូមពន្យល់មូលហេតុខ្លីៗ បន្ទាប់មកផ្តល់ corrected full code section។ កុំប្តូរ trading logic លុះត្រាតែចាំបាច់។
៨. Strategy Tester និង Demo Test
Code compile បាន មិនមានន័យថា EA ល្អទេ។ អ្នកត្រូវ test ក្នុង MT5 Strategy Tester
ដើម្បីមើល profit factor, drawdown, win rate, number of trades, spread sensitivity និង behavior ពេល market trend/range។
បន្ទាប់ពី backtest សូម run លើ demo account យ៉ាងហោចណាស់ 2–4 សប្តាហ៍ ដើម្បីមើលថា
EA អនុវត្តដូច backtest ឬអត់។ កុំដាក់ lot ធំលើគណនីពិតភ្លាមៗ។
📌 EA Testing Checklist Prompt
EN: Create a complete testing checklist for this MT5 EA before using it on a live account. Include Strategy Tester settings, demo test rules, risk limits, performance metrics, and conditions that mean the EA should not be used live.
KH: បង្កើត testing checklist ពេញលេញសម្រាប់ MT5 EA នេះ មុនយកទៅប្រើលើគណនីពិត។ បញ្ចូល Strategy Tester settings, demo test rules, risk limits, performance metrics និងលក្ខខណ្ឌដែលបង្ហាញថា EA មិនគួរប្រើ live។
៩. កំហុសដែលគេច្រើនធ្វើពេលបង្កើត EA ដោយ AI
សុំ AI សរសេរ EA ដោយមិនមាន strategy specification ច្បាស់
មិនបញ្ជាក់ MagicNumber, symbol filter និង one-position protection