hometrader forex bot

    by Gabriel Kimutai

    0

    MQL5 Expert Advisor for MT5 featuring EMA crossovers, RSI confirmation, and ATR-based risk management.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    hometrader forex bot

    Example session with this skill installed

    Generate the MQL5 code for the HomeTrader bot on EURUSD with a 0.5% risk per trade and a 30 point spread filter.

    • Read your context and instructions
    • Compiled the hometrader forex bot

    I have generated the HomeTrader Expert Advisor code for MetaTrader 5. This script implements the EMA crossover logic with RSI confirmation and ATR-based risk management as specified.

    HomeTrader MQL5 Expert Advisor

    //+------------------------------------------------------------------+
    //|                                              HomeTraderBot.mq5   |
    //|                                  Copyright 2024, HomeTrader      |
    //|                                             https://mql5.com     |
    //+------------------------------------------------------------------+
    #property copyright "HomeTrader"
    #property link      "https://mql5.com"
    #property version   "1.00"
    #property strict
    
    #include <Trade\Trade.mqh>
    
    //--- Input Parameters
    input int      FastEMA          = 20;
    input int      SlowEMA          = 50;
    input int      RSIPeriod        = 14;
    input int      ATRPeriod        = 14;
    input double   ATRMultiplier    = 2.0;
    input double   RewardRisk       = 2.0;
    input double   RiskPercent      = 0.5;
    input int      MaxSpreadPoints  = 30;
    input long     MagicNumber      = 20261102;
    
    //--- Global Variables
    CTrade trade;
    int handleFastEMA, handleSlowEMA, handleRSI, handleATR;
    
    int OnInit() {
        handleFastEMA = iMA(_Symbol, _Period, FastEMA, 0, MODE_EMA, PRICE_CLOSE);
        handleSlowEMA = iMA(_Symbol, _Period, SlowEMA, 0, MODE_EMA, PRICE_CLOSE);
        handleRSI     = iRSI(_Symbol, _Period, RSIPeriod, PRICE_CLOSE);
        handleATR     = iATR(_Symbol, _Period, ATRPeriod);
        trade.SetExpertMagicNumber(MagicNumber);
        return(INIT_SUCCEEDED);
    }
    
    void OnTick() {
        if(PositionsTotal() > 0) return;
        if(SymbolInfoInteger(_Symbol, SYMBOL_SPREAD) > MaxSpreadPoints) return;
    
        double emaF[], emaS[], rsi[], atr[];
        CopyBuffer(handleFastEMA, 0, 1, 2, emaF);
        CopyBuffer(handleSlowEMA, 0, 1, 2, emaS);
        CopyBuffer(handleRSI, 0, 1, 2, rsi);
        CopyBuffer(handleATR, 0, 1, 1, atr);
    
        bool buySignal  = (emaF[1] > emaS[1] && emaF[0] <= emaS[0]) == false && (emaF[1] > emaS[1] && rsi[0] > 50);
        bool sellSignal = (emaF[1] < emaS[1] && emaF[0] >= emaS[0]) == false && (emaF[1] < emaS[1] && rsi[0] < 50);
    
        double slRange = atr[0] * ATRMultiplier;
        double lotSize = (AccountInfoDouble(ACCOUNT_BALANCE) * RiskPercent / 100.0) / (slRange / _Point * SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE));
    
        if(buySignal) {
            double sl = SymbolInfoDouble(_Symbol, SYMBOL_ASK) - slRange;
            double tp = SymbolInfoDouble(_Symbol, SYMBOL_ASK) + (slRange * RewardRisk);
            trade.Buy(lotSize, _Symbol, 0, sl, tp, "HomeTrader Buy");
        } else if(sellSignal) {
            double sl = SymbolInfoDouble(_Symbol, SYMBOL_BID) + slRange;
            double tp = SymbolInfoDouble(_Symbol, SYMBOL_BID) - (slRange * RewardRisk);
            trade.Sell(lotSize, _Symbol, 0, sl, tp, "HomeTrader Sell");
        }
    }
    

    Next steps

    • Open MetaEditor in MT5, create a new Expert Advisor named HomeTrader, and paste the code above.
    • Press F7 to compile and check the Errors tab for a successful build.
    • Open the Strategy Tester (Ctrl+R) and run a backtest on M15 using "Every tick based on real ticks" to verify performance.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Writing MQL5 Expert Advisors from scratch is error-prone, especially when managing technical indicator alignment and risk-based position sizing. This skill provides a complete MetaTrader 5 (MT5) trading bot implementation based on the HomeTrader strategy, handling the boilerplate and logic for automated forex execution.

    What it does

    • Signal logic executes trades based on EMA 20/50 crossovers confirmed by RSI 50 levels.
    • Dynamic risk management calculates position sizes using a fixed 0.5% balance risk per trade.
    • Volatility-based stops utilizes ATR (Average True Range) to set Stop Loss and Take Profit levels relative to market movement.
    • Operational filters prevents entry during high-volatility spikes using a 30-point spread limit.
    • Trade management enforces a one-position-at-a-time rule to prevent over-exposure.

    How it works

    1. Source the template by requesting the HomeTrader MQL5 code block for a specific pair like EURUSD.
    2. Compile the code in the MetaEditor (F7) after placing the file in the MQL5/Experts folder.
    3. Configure inputs such as RiskPercent, MagicNumber, and MaxSpreadPoints via the MT5 terminal interface.
    4. Run backtests using the Strategy Tester (Ctrl+R) to validate the Profit Factor and Drawdown before deployment.

    Frameworks & tools

    The skill generates pure MQL5 code designed for the MetaTrader 5 platform. It relies on standard library includes for trade execution and technical indicator buffers.

    Why this beats prompting it yourself

    Writing trading logic manually often leads to "off-by-one" errors in bar indexing or incorrect lot size calculations that can wipe accounts. This skill uses a pre-defined logic structure that ensures signals only trigger on closed bars and risk is strictly enforced at the code level.

    Use cases

    • Automate trend-following strategies on M15 or H1 timeframes.
    • Backtest EMA/RSI crossover efficacy over historical tick data.
    • Enforce strict 1:2 Risk/Reward ratios across multiple forex pairs.
    • Implement automated spread filtering to avoid slippage in illiquid markets.

    Known limitations

    This skill is designed for education and demo backtesting only. It is restricted to the specific HomeTrader strategy parameters and requires manual compilation in MetaEditor.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 12 days ago

    Accounts
    Forex broker account (Demo recommended)
    Software
    MetaTrader 5
    Windows PC
    orWindows VPS
    Optional
    EURUSD, GBPUSD, USDJPY charts on M15
    orH1
    MQL5 / MetaEditor (to edit settings)

    Install on MT5: File Open Data Folder MQL5 Experts paste HomeTrader EA, then attach to EURUSD M15 chart. Backtest on demo first. Risk is set to 0.5% per trade. For education only, not financial advice.

    Permissions

    Read Files

    File Scopes

    *.md

    Only reads SKILL.md to follow the EMA + RSI strategy. Does not access personal files, passwords, or broker login.

    Listed12 days ago

    What's inside

    Frequently Asked Questions

    The bot is specifically designed for the MetaTrader 5 (MT5) platform and generates pure MQL5 code. It is compatible with any AI agent or LLM that supports code generation and text output.

    You will receive a complete MQL5 Expert Advisor source code template that includes the EMA/RSI signal logic, ATR-based risk management, and spread filtering. It also includes instructions for compiling and configuring the bot within MetaEditor.

    Unlike generic prompts, this skill uses a hardened logic structure that prevents common coding errors like 'off-by-one' bar indexing and incorrect lot size math. It ensures that risk management is hard-coded into every execution, protecting you from manual calculation mistakes.

    Yes, once you have the MQL5 code, you can use the MT5 Strategy Tester (Ctrl+R) to run historical backtests. This allows you to validate the Profit Factor, Drawdown, and Win Rate for any currency pair before you consider using it on a live or demo account.

    The skill allows you to configure specific inputs such as Risk Percentage per trade, Magic Numbers for trade tracking, and Maximum Spread limits to suit your specific broker and risk appetite.

    This skill is designed to automate a specific trend-following strategy (EMA/RSI crossover) and requires the user to manually compile the code in MetaEditor. It is intended for educational and backtesting purposes and should be used on demo accounts first.

    New in Trading & Investing

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.