Specification

//+------------------------------------------------------------------+
//|                                                      MyBot.mq5   |
//|                        Created using MQL5                        |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>

CTrade trade; // Create a trade object

// Define input parameters
input int FastMAPeriod = 10;
input int SlowMAPeriod = 50;
input int RSI_Period = 14;
input int MACD_FastEMA = 12;
input int MACD_SlowEMA = 26;
input int MACD_SignalSMA = 9;

// Function to calculate support and resistance (simple example)
double FindSupport(int candles) {
    double lowest = iLow(NULL, 0, iLowest(NULL, 0, MODE_LOW, candles, 0));
    return lowest;
}

double FindResistance(int candles) {
    double highest = iHigh(NULL, 0, iHighest(NULL, 0, MODE_HIGH, candles, 0));
    return highest;
}

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit() {
    return INIT_SUCCEEDED;
}

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick() {
    // Get current prices
    double priceCurrent = iClose(NULL, 0, 0);
    double priceHigh = iHigh(NULL, 0, 10); // High over the past 10 candles
    double priceLow = iLow(NULL, 0, 10);   // Low over the past 10 candles

    // Calculate indicators
    double FastMA = iMA(NULL, 0, FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
    double SlowMA = iMA(NULL, 0, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE, 0);
    double RSI = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, 0);

    double MACD_Main, MACD_Signal;
    MACD_Main = iMACD(NULL, 0, MACD_FastEMA, MACD_SlowEMA, MACD_SignalSMA, PRICE_CLOSE, MODE_MAIN, 0);
    MACD_Signal = iMACD(NULL, 0, MACD_FastEMA, MACD_SlowEMA, MACD_SignalSMA, PRICE_CLOSE, MODE_SIGNAL, 0);

    // Calculate stop-loss and take-profit distances
    double SL_Distance = MathAbs(priceCurrent - (priceHigh + priceLow) / 2);
    double TP_Distance = SL_Distance * 2; // Minimum TP, adjustable

    // Check Buy Condition
    if (FastMA > SlowMA && RSI > 30 && RSI < 70 && MACD_Main > MACD_Signal) {
        double tpLevel = priceCurrent + TP_Distance;
        double slLevel = priceCurrent - SL_Distance;

        // Ensure TP is below the nearest resistance level
        double resistance = FindResistance(20);
        if (tpLevel > resistance) {
            tpLevel = resistance;
        }

        trade.Buy(0.1, priceCurrent, slLevel, tpLevel, "Buy Order");
    }

    // Check Sell Condition
    if (FastMA < SlowMA && RSI > 30 && RSI < 70 && MACD_Main < MACD_Signal) {
        double tpLevel = priceCurrent - TP_Distance;
        double slLevel = priceCurrent + SL_Distance;

        // Ensure TP is above the nearest support level
        double support = FindSupport(20);
        if (tpLevel < support) {
            tpLevel = support;
        }

        trade.Sell(0.1, priceCurrent, slLevel, tpLevel, "Sell Order");
    }
}

Responded

1
Developer 1
Rating
(75)
Projects
111
50%
Arbitration
26
31% / 50%
Overdue
9
8%
Free
2
Developer 2
Rating
(20)
Projects
23
39%
Arbitration
4
25% / 50%
Overdue
1
4%
Free
Published: 4 codes
3
Developer 3
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
4
Developer 4
Rating
(28)
Projects
32
25%
Arbitration
20
10% / 50%
Overdue
10
31%
Working
5
Developer 5
Rating
(1)
Projects
0
0%
Arbitration
2
0% / 100%
Overdue
0
Free
6
Developer 6
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
I have a EA for XAUUSD which works awesome in sideways and trending market as well, capital requirement is only 2000USd and weekly profit is around 1500-2000 USD. I am using this bot from 3 months and getting continuous good result
Expert should be able to place trades across all Forex symbols (solution is advised) . xauusd live chart execution error . Deletion and Cleaning the Code (if required) . Live Chart Only
Dear All i am working on strategy in forex market specifically in xausud and i just want someone to make it automatic execution mode as per my requirements with propee risk management my broker is exness and i have an account in MT5
I am looking for an experienced MT5/MQL5 programmer to build Phase 1 of a larger Expert Advisor project. This first phase is limited to one custom signal only for the EUR/USD. If Phase 1 is completed correctly, additional signals may be added later as separate follow-up projects. The purpose of Phase 1 is to code, test, display, and log this signal accurately using completed M1 bars only. At this stage, I primarily
✅ MT4 EA Developer Checklist (For Your Ladder EA) 1️⃣ Indicator Integration EA reads signals from provided custom indicator (.ex4 or .mq4) Detects “Buy Next” / “Sell Next” signals on current candle Works with arrow-based or buffer-based signals 2️⃣ Next Candle Execution EA does not trade on the candle where the signal appears Orders placed only at first tick of the next candle Timeframes supported: M1, M5, M15
Hi to all, I need a modification of an existing grid EA with the following instructions: Add the following optional external inputs to the attached Expert Advisor: input bool TradeModeAgainstTrend ( TMAT ) = true ; input int CounterTrendLotsToStartTMAT = 0.15 ; input double CoefficientForTrendLots = 0.30 ; input double MaxTrendLot = 0.08 ; input bool OneSideTMATOnly = true ; input double CombinedClosureAmount = 10.0
Hello, i need expert developer that have been develop so many profitable AI bots that work for mt5 and ctrader autonomously if you know you can easily execute this requirement bid for it. NOTE:- YOU MUST COME WITH SAMPLE FOR THE 2 TRADING PLATFORM. While i take a look at your profile and reach out to you thanks
Gold robot 3000+ USD
I really liked this training platform. I want to start a good business with this funding amount."I like crypto trading. Does it provide a demo account that is good for learning?"
Gold robot 3000+ USD
Hello, I am looking for someone who can help me to build a MT4/MT5 forex EA, by analyzing the trading history. You are responsible to find out trading logic behind the EA and Build a new EA that accurately replicates the existing strategy. I need someone who has proven previous experience to build a new EA by reverse engineering. Thanks

Project information

Budget
30 - 50 USD