messages listlengths 2 8 |
|---|
[
{
"role": "user",
"content": "I want a helper that closes every open position on a 5-second timer and stops retrying once a close is complete. My current code sometimes fires OrderSend repeatedly with error 4756 'order send failed'? Actually it prints retcode 10009 thousands of times. Fix it.\n\nvoid OnTime... |
[
{
"role": "user",
"content": "Why am I getting error 4066 (TRADE_RETCODE_INVALID_STOPS) when I turn on my EA on gold XAUUSD? My SL is 2.0 and TP 4.0 on a 0.10 lot, EURUSD works fine."
},
{
"role": "assistant",
"content": "4066 is TRADE_RETCODE_INVALID_STOPS on the server side. Your SL/TP values ... |
[
{
"role": "user",
"content": "Explain why this order is rejected: retcode 10016 TRADE_RETCODE_INVALID_STOPS on a sell limit order on EURJPY. My request:\n\nMqlTradeRequest req = {};\nreq.action = TRADE_ACTION_PENDING;\nreq.symbol = _Symbol;\nreq.volume = 0.10;\nreq.type = ORDER_TYPE_SELL_LIMIT... |
[
{
"role": "user",
"content": "My EA places a buy, gets retcode 10004 (requote) or 10021 (no prices), and my error handler calls GetLastError() but returns 0. Fix the error handling so I can actually see what went wrong."
},
{
"role": "assistant",
"content": "GetLastError() is documented as retur... |
[
{
"role": "user",
"content": "My session filter closes all trades at Friday 22:00 server time, but I only want to remove the take profit on those trades, not close them. Give me the minimal change."
},
{
"role": "assistant",
"content": "PositionModify on the CTrade class sends TRADE_ACTION_SLTP ... |
[
{
"role": "user",
"content": "I get duplicate entries: sometimes Buy() is called twice within the same tick because OnTick fires on every tick from multiple symbols feeding the same EA. Make this multi-pair and stop duplicates."
},
{
"role": "assistant",
"content": "Two separate fixes in one edi... |
[
{
"role": "user",
"content": "My EA gets retcode 10016 every time it tries to open a gold trade. I think my SL/TP prices are wrong. Can you explain how the trade server validates prices and show me a correct risk-based position sizing block for XAUUSD that fixes this?"
},
{
"role": "assistant",
... |
[
{
"role": "user",
"content": "Explain how to build a bounded grid EA in MQL5 that won't blow the account. The broker is rejecting with 10016 on later grid adds. Show the position-size and stop normalization together."
},
{
"role": "assistant",
"content": "Retcode 10016 (TRADE_RETCODE_INVALID_STO... |
[
{
"role": "user",
"content": "Can you show me a self-contained MQL5 function that keeps a running risk of no more than 2% of equity and uses NormalizeDouble for the SL/TP? I keep hitting 10016 on my GBPJPY EA."
},
{
"role": "assistant",
"content": "Retcode 10016 fires when a stop price violates ... |
[
{
"role": "user",
"content": "I want a reusable price-normalization helper in MQL5. My sends keep coming back with 10016 and I suspect I'm not normalizing SL/TP against the symbol's tick size. Explain and show a helper."
},
{
"role": "assistant",
"content": "Two MQL5 fields govern price rounding... |
[
{
"role": "user",
"content": "Write a USDJPY Expert Advisor that sizes lots from 1% of equity and caps grid drawdown at 4%, and make sure 10016 never appears when the grid adds new legs. Show the full file."
},
{
"role": "assistant",
"content": "Retcode 10016 is TRADE_RETCODE_INVALID_STOPS. Two ... |
[
{
"role": "user",
"content": "Please explain the difference between equity and balance for risk sizing in MQL5, then give me a small snippet that shows a fixed-fractional sizing function using NormalizeDouble for the SL, aimed at avoiding retcode 10016."
},
{
"role": "assistant",
"content": "For... |
[
{
"role": "user",
"content": "Show me how to build an MQL5 class that wraps COrderInfo and CPositionInfo to report state for one symbol, and demonstrate it in a script. I want to compare the number of working orders vs open positions on my account."
},
{
"role": "assistant",
"content": "//+-----... |
[
{
"role": "user",
"content": "Compact single-file example: close all positions whose profit exceeds a threshold. Use CTrade and skip the merging concern. Explain the select step briefly."
},
{
"role": "assistant",
"content": "#include <Trade\\Trade.mqh>\nCTrade trade;\n\nvoid OnStart()\n {\n ... |
[
{
"role": "user",
"content": "Deal-count report: for GBPUSD, list all deals in the past 7 days with type, entry, volume, price, profit and comment. Use CDealInfo and OnStart."
},
{
"role": "assistant",
"content": "#include <Trade\\DealInfo.mqh>\nCDealInfo d;\n\nvoid OnStart()\n {\n datetime t... |
[
{
"role": "user",
"content": "Explain history vs live state: I want a script that reconciles netted position volume against the sum of DEAL_ENTRY_IN minus DEAL_ENTRY_OUT volumes for the same POSITION_IDENTIFIER on USDJPY."
},
{
"role": "assistant",
"content": "On netting, POSITION_IDENTIFIER is ... |
[
{
"role": "user",
"content": "My OnTick is doing indicator math on every tick and my backtest runs slowly. Show me the exact lines to change so it only recomputes when a new bar appears, without changing the entry logic."
},
{
"role": "assistant",
"content": "The classic fix is a last-bar guard ... |
[
{
"role": "user",
"content": "Give me a focused snippet that checks whether the account is hedging or netting and refuses to load a multi-position strategy on netting. Then show the exact two lines to add in OnInit."
},
{
"role": "assistant",
"content": "Detect account mode with `AccountInfoInte... |
[
{
"role": "user",
"content": "My 5-digit GBPJPY EA returns retcode 10016 (invalid stops) on real trades but works with 3-digit JPY crosses. Show me the exact fix in my SL/TP computation."
},
{
"role": "assistant",
"content": "Retcode 10016 = `TRADE_RETCODE_INVALID_STOPS`. Two causes are common:\... |
[
{
"role": "user",
"content": "Explain why this order is being rejected in a hedging EA. Retcode is 10009 on the first one then 10018 on the next. Show the exact lines to change so retries use a fresh price."
},
{
"role": "assistant",
"content": "Two different codes:\n\n- 10009 `TRADE_RETCODE_DON... |
[
{
"role": "user",
"content": "I have a 2-leg hedging EA. Fill in the exact OnTradeTransaction handler lines so it re-issues the SL on the opposite leg after a partial close. I want the handler body, not a whole file."
},
{
"role": "assistant",
"content": "`OnTradeTransaction` is called after eve... |
[
{
"role": "user",
"content": "I need to read the last 500 completed H1 bars of EURUSD into arrays using CopyRates and also pull the close and tick volume series. Show me the exact function, no MQL4 iClose/iVolume stuff, and keep the rest of my indicator as is — I only want this helper added."
},
{
"... |
[
{
"role": "user",
"content": "My multi-symbol EA on AUDUSD, NZDUSD and AUDNZD has no cap on how many legs it can open, and it snowballs during news. Add a bounded basket manager: max 6 positions total across all three, max 2 per symbol, and stop adding new legs if total floating loss exceeds 2% of equity. G... |
[
{
"role": "user",
"content": "Only give me the fixed OnTick of my hedging EA. Everything else stays untouched. Problem: my CTrade.PositionOpen calls return retcode 10016 (INVALID_STOPS). I want the SL/TP adjusted to the broker's SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL before sending."
},
... |
[
{
"role": "user",
"content": "Write a small include file, SessionFilter.mqh, that lets my EA check if we are inside a session like London or New York. Nothing else in my project should change. I need it to work across broker server time and account for optional weekend cutoff for Friday close."
},
{
... |
[
{
"role": "user",
"content": "Add a Telegram integration include so my EA can send open/close notifications. Only add Telegram.mqh — don't modify anything else. Must use WebRequest and the documented URL must be configurable as an input, and any error must be logged not thrown."
},
{
"role": "assist... |
[
{
"role": "user",
"content": "My custom MA-difference indicator compiles fine but nothing appears on the chart. I used #property indicator_buffers 3 and #property indicator_plots 3, SetIndexBuffer(0, MainBuf), SetIndexBuffer(1, SignalBuf), SetIndexBuffer(2, HistBuf), then PlotIndexSetInteger for DRAW_LINE o... |
[
{
"role": "user",
"content": "I keep getting retcode 10016 \"Invalid stops\" from OrderSend in my stop-loss/TP logic. The prices look reasonable. How do I actually diagnose this?"
},
{
"role": "assistant",
"content": "Retcode 10016 (TRADE_RETCODE_INVALID_STOPS) is one of the few entirely determi... |
[
{
"role": "user",
"content": "I want to add a grid to my EA, and I need to make sure it filters its own orders only by a Magic Number, and that this survives optimization. What is the correct pattern and what pitfalls should I watch for?"
},
{
"role": "assistant",
"content": "Magic-number based ... |
[
{
"role": "user",
"content": "I am using CTrade in my EA and my SL is not being set. trade.Buy returns true but PositionGetDouble(POSITION_SL) is 0. What should I check?"
},
{
"role": "assistant",
"content": "CTrade's Buy does not attach SL/TP after a market execution fill on all brokers; and th... |
[
{
"role": "user",
"content": "Give me a checklist for writing an EA that uses OnTradeTransaction for multi-symbol logic and doesn't confuse itself with duplicate handling. I want per-symbol state."
},
{
"role": "assistant",
"content": "Here is a checklist for per-symbol state driven by OnTradeTr... |
[
{
"role": "user",
"content": "I'm trying to send a Telegram message from my EA and get error 4060 in the Journal every time. The URL opens fine in a browser. Here's the call: WebRequest(\"https://api.telegram.org/bot123:ABC/sendMessage?chat_id=1&text=hi\", \"GET\", NULL, 0, result, headers); What am I missi... |
[
{
"role": "user",
"content": "My BUY stops get rejected with retcode 10016 (invalid stops). SL = Bid - 20*Point, TP = Bid + 40*Point. EURUSD 5-digit. What's the right fix?"
},
{
"role": "assistant",
"content": "retcode 10016 = TRADE_RETCODE_INVALID_STOPS. On 5-digit symbols Point is 0.00001, so ... |
[
{
"role": "user",
"content": "I get a compile error on these lines when converting an old EA: 'iClose' - undeclared identifier. Also 'iTime'. What should these be in MQL5?"
},
{
"role": "assistant",
"content": "iClose/iOpen/iHigh/iLow/iTime/iVolume do not exist in MQL5. The MQL5 equivalents eith... |
[
{
"role": "user",
"content": "After conversion, my EA trades way less in the tester than it did on the live MQL4 version. Are the tick-level checks broken? Here's the loop fragment:\n\nfor(int i = 0; i < OrdersTotal(); i++)\n if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))\n if(OrderSymbol() == Symbol... |
[
{
"role": "user",
"content": "Converting an old EA: 'MarketInfo(Symbol(), MODE_SPREAD)' — how do I get bid, ask, spread, point, and stops level in MQL5 without touching anything else in the file?"
},
{
"role": "assistant",
"content": "MarketInfo doesn't exist in MQL5. The direct equivalents are ... |
[
{
"role": "user",
"content": "My WebRequest to a personal API returns 401 even though the token is right. I'm building the Authorization header as 'Authorization: Bearer <tok>'. Any idea?"
},
{
"role": "assistant",
"content": "Two common causes: (1) the host isn't in the allowed URL list -> erro... |
[
{
"role": "user",
"content": "Old EA used start(), init(), deinit(). I renamed them to OnTick/OnInit/OnDeinit but I get 'OnInit has wrong signature'. What signatures are actually required?"
},
{
"role": "assistant",
"content": "In MQL5 the three lifecycle handlers have fixed signatures — any dev... |
[
{
"role": "user",
"content": "I have a hedging account and my EA opens BUY and SELL on the same symbol, but MT5 is merging them. Why? Here is the entry logic:\n\nvoid Open(double lot, ENUM_ORDER_TYPE type)\n{\n MqlTradeRequest req={};\n MqlTradeResult res={};\n req.action=TRADE_ACTION_DEAL;\n req.symbo... |
[
{
"role": "user",
"content": "I get retcode 10016 ('Invalid stops') from a USDJPY EA on a 5-digit broker. My SL/TP math:\n\ndouble point=SymbolInfoDouble(_Symbol,SYMBOL_POINT);\ndouble sl=bid - 20*point;\ndouble tp=bid + 40*point;\n\nWhy? Fix it."
},
{
"role": "assistant",
"content": "10016 is T... |
[
{
"role": "user",
"content": "Explain why this order is being rejected at 09:12 broker time on AUDUSD.\n\nreq.action=TRADE_ACTION_PENDING;\nreq.symbol=\"AUDUSD\";\nreq.volume=0.10;\nreq.type=ORDER_TYPE_BUY_LIMIT;\nreq.price=SymbolInfoDouble(\"AUDUSD\",SYMBOL_BID) + 50*_Point;\nreq.sl=0.0;\nreq.tp=0.0;\nreq.... |
[
{
"role": "user",
"content": "OnTick in my EURUSD EA is where all the strategy logic lives, but I also need to react to fills for basket management. Currently I re-scan PositionsTotal() every tick and it's heavy. Show me how to move basket work into OnTradeTransaction. Keep OnTick for signals."
},
{
... |
[
{
"role": "user",
"content": "I need a realistic backtest of a hedging EA on EURUSD M15 for 2023. Give me the exact tester settings and any code changes so the results are trustworthy. My EA currently uses iTime and CopyBuffer only, no random logic, magic 4242."
},
{
"role": "assistant",
"conten... |
[
{
"role": "user",
"content": "Write a complete, compilable MQL5 EA. It should open a position when a new bar forms and the close of the previous bar is above its open. It must not open another position while one on the same symbol is active, and it must never open two positions on the same bar even if the p... |
[
{
"role": "user",
"content": "Need an MQL5 EA that closes every position it owns at a fixed time (e.g. 21:45 server time) using OnTimer so it doesn't depend on ticks arriving. Include Telegram on each closed deal. Full .mq5 please."
},
{
"role": "assistant",
"content": "//+----------------------... |
[
{
"role": "user",
"content": "Give me a compilable MQL5 EA that prevents duplicate entries using a bar flag persisted across sessions, and sends a Telegram when a deal closes. Symbol should be configurable. Full file, no placeholders I have to fill."
},
{
"role": "assistant",
"content": "//+----... |
[
{
"role": "user",
"content": "Build me a full MQL5 EA that closes all positions on a periodic OnTimer sweep (every 30 sec) only if total floating profit exceeds a target, and posts a Telegram message on every closed deal. Include symbol filter and magic filter."
},
{
"role": "assistant",
"conten... |
[
{
"role": "user",
"content": "You are helping me write a small diagnostic MQL5 script. I need to list all positions and all pending orders for the current account, and show the ticket, symbol, type, volume, price, sl, tp. Use CPositionInfo and COrderInfo. Full .mq5 please."
},
{
"role": "assistant",... |
[
{
"role": "user",
"content": "Create a full MQL5 EA that opens trades with an anti-burst lock: after every successfully opened position it waits N seconds before allowing the next entry, and it never opens a second position on the same tick/bar. Telegram on every closed deal. Include comments."
},
{
... |
[
{
"role": "user",
"content": "I want a multi-symbol EA driven by a single OnTimer instead of OnTick so it scans symbols on a schedule. Give me the core skeleton (handle init, symbol array, timer) as a snippet, plus tell me exactly which lines to add to OnInit and which to delete if I currently have per-symb... |
[
{
"role": "user",
"content": "My EA fires 4-5 identical buys in one tick. How do I stop duplicate entries reliably in MQL5? Show the snippet and the exact lines around my existing OrderSend/CTrade block."
},
{
"role": "assistant",
"content": "Snippet — one-entry-per-signal guard using a per-symb... |
[
{
"role": "user",
"content": "How do I validate margin before placing an order with OrderCalcMargin in a multi-symbol EA? Give me the snippet and the exact lines to insert right before trade.Buy()."
},
{
"role": "assistant",
"content": "Snippet — margin check with OrderCalcMargin and free-margin... |
[
{
"role": "user",
"content": "My multi-symbol timer EA gets retcode 10016 (invalid stops) on some symbols when SL/TP are set. Show me how to fix the stops and the exact lines to change."
},
{
"role": "assistant",
"content": "Cause: you are likely computing SL/TP with a fixed point count from _Po... |
[
{
"role": "user",
"content": "Add a grid to my existing multi-symbol EA driven by one timer. It currently opens one buy per symbol on a 10/30 SMA cross; I want additional buys every 25 pips down, capped at 5 total per symbol, with margin checks. Return the snippet and the exact lines to change."
},
{
... |
[
{
"role": "user",
"content": "I keep getting retcode 10016 on EURUSD but only sometimes. I compute my SL as Bid - 300*_Point. Explain the API involved and show me the exact implementation to fix it, including correct price normalization for a 5-digit broker."
},
{
"role": "assistant",
"content":... |
[
{
"role": "user",
"content": "Getting 10016 when I try to sell GBPUSD with SL/TP I built from _Point * 150. What MQL5 API validates these limits and how do I code it so the order passes?"
},
{
"role": "assistant",
"content": "10016 = TRADE_RETCODE_INVALID_STOPS. The server enforces two symbol pr... |
[
{
"role": "user",
"content": "Retcode 10016 on a 500-lot grid on XAUUSD. I deploy grid levels every 20 points. Explain which MQL5 functions I should call to enforce bounded exposure and a proper risk cap so orders stop being rejected."
},
{
"role": "assistant",
"content": "For a grid on XAUUSD, ... |
[
{
"role": "user",
"content": "Using CTrade in an EA, OrderSend-like calls fail with retcode 10016 only on Tuesdays. What is happening and how do I make CTrade set safe SL/TP using MQL5 APIs? Give the full corrected snippet."
},
{
"role": "assistant",
"content": "10016 = TRADE_RETCODE_INVALID_STO... |
[
{
"role": "user",
"content": "My grid EA on US500 gets 10016 when I try to place pending BuyLimit layers. Explain the API for placing pending orders with correct stops and bounded risk, and show a tested pattern."
},
{
"role": "assistant",
"content": "10016 = TRADE_RETCODE_INVALID_STOPS. For pen... |
[
{
"role": "user",
"content": "What MQL5 error is retcode 10016 and how do I fix it in a multi-pair EA that opens USDJPY, EURUSD, and GBPUSD simultaneously?"
},
{
"role": "assistant",
"content": "10016 is TRADE_RETCODE_INVALID_STOPS. In a multi-symbol EA you must compute stops per symbol because ... |
[
{
"role": "user",
"content": "I have an existing multi-symbol EA that reads technical signals only. I want to add an economic calendar news filter so it pauses trading around high-impact USD and EUR events. Write the file NewsFilter.mqh only, don't change anything else in my project."
},
{
"role": "... |
[
{
"role": "user",
"content": "Show me how to correctly read the last 300 bars of XAUUSD H1 into a rates array and also extract close and tick volume into their own arrays. I keep mixing up ArraySetAsSeries. Just give me the corrected code file, don't touch the rest of my EA."
},
{
"role": "assistant... |
[
{
"role": "user",
"content": "I need a custom indicator for MT5 that plots a 20-period high/low channel and a midline (all as line buffers), plus a histogram-style deviation on a subwindow? Actually just do the channel + midline in the main window. Fix the OnCalculate function, nothing else."
},
{
"... |
[
{
"role": "user",
"content": "My custom indicator compiles fine but nothing appears on the chart (XAUUSD, M15). I call SetIndexBuffer and then in OnCalculate I write into the arrays. Can you give me a debugging checklist for why the buffers are not drawing?"
},
{
"role": "assistant",
"content": ... |
[
{
"role": "user",
"content": "I have an EA on EURUSD M5 that opens trades and also some other EA on the same account, and my grid EA keeps interfering with a manual EURUSD buy I placed. How do I filter positions properly by Magic Number so each EA only manages its own trades?"
},
{
"role": "assistan... |
[
{
"role": "user",
"content": "Testing an EA in Strategy Tester (build 4600+, symbol USDJPY H1) and getting wildly different results from what I expect. What should I check about inputs and optimization to trust the report?"
},
{
"role": "assistant",
"content": "Checklist for MQL5 Strategy Tester... |
End of preview. Expand in Data Studio
Generated MQL5 Q&A
Description
Teaches domain-specific instruction following and code generation for this expert.
Source
- Project-generated 14_mql5.jsonl (3,101 examples) authored for this project
Formatted for the MoE-orchestrator project
(https://github.com/michaelowusuntim6/MoE-orchestrator). Expert target:
mql5_optional.
Format
Each record is a JSON object with a messages field formatted for Qwen3.5's
native chat template:
{"messages": [
{"role": "system", "content": "..."},
{"role": "user", "content": "..."},
{"role": "assistant", "content": "..."}
]}
The records are consumed via tokenizer.apply_chat_template(). Special tokens
(<|im_start|>, <|im_end|>) are added by the template, never embedded in
content.
Splits
train: 3,032 recordsval: 69 records
Usage
from datasets import load_dataset
ds = load_dataset("michaelowusuntim6/mql5-generated-qwen35", split="train")
print(ds[0]["messages"])
License
project-generated. Upstream sources keep their own licences - see the source list
above and docs/DATASET_SOURCES.md in the MoE-orchestrator repository for
per-source detail.
- Downloads last month
- 59