Spécifications

//+------------------------------------------------------------------+
//|                                                      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");
    }
}

Répondu

1
Développeur 1
Évaluation
(75)
Projets
111
50%
Arbitrage
26
31% / 50%
En retard
9
8%
Gratuit
2
Développeur 2
Évaluation
(19)
Projets
22
36%
Arbitrage
4
25% / 50%
En retard
1
5%
Gratuit
Publié : 4 codes
3
Développeur 3
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
4
Développeur 4
Évaluation
(25)
Projets
29
21%
Arbitrage
20
10% / 50%
En retard
8
28%
Chargé
5
Développeur 5
Évaluation
(1)
Projets
0
0%
Arbitrage
2
0% / 100%
En retard
0
Gratuit
6
Développeur 6
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Commandes similaires
.. 30 - 200 USD
Ebrahim Ajarousha uggjhh jhghjh jhb hbhh hbhkoo ddddf drrd ffff tff ftv. Tf. Rf. Ff. F. Ff v. Hb b h h h c c n j j e. K dk. K kx. Kd. Kc k. Xk. Dk. K xk. Nx. Nx. Xj. Xnx xk. X xk d c g t. X f. C x x c
I have a fully developed and ready Expert Advisor for MT5. I am NOT looking for coding work. I am looking for an experienced MQL5 Market seller who can publish and manage my EA on the MQL5 Market on my behalf. The deal is revenue share — we split the income from sales or rentals. The EA is complete and ready to publish. If you have an established seller account on MQL5 Market with good reputation and experience
I am seeking an alert-only EA. An EA that will follow all the rules but not execute a trade. As this is a repeat posting I am seeking the successful technician - Xiro from Vietnam. Thanks Karl
Ninjatrader bot 30+ USD
I am looking for an experienced developer who specializes in NinjaTrader and NinjaScript to build a fully automated trading bot. The goal is to create a “sniper-style” trading system that focuses on precise entries, strong risk management, and structured trading logic. This is NOT a simple indicator project I am looking for someone who understands algorithmic trading and can translate trading rules into a reliable
24/7 Pick-and-Pack Bot 30 - 200 USD
Title: MT5 EA for XAUUSD M5 – Auto SL/TP + News Filter – Mobile Compatible Strategy: 1. Pair: XAUUSD, Timeframe: M5 2. Entry Buy: EMA(9) crosses above EMA(21) AND RSI(14) > 50 3. Entry Sell: Opposite 4. Exit: SL = 150 points, TP = 300 points. No trailing. 5. Risk: 1% of balance per trade, lot size auto-calculated 6. Time filter: Trade only 08:00–18:00 GMT+2, Mon-Thu. No Friday trades. 7. News filter: Pause 30min
24/7 Pick-and-Pack Bot 30 - 200 USD
Title: MT5 EA for XAUUSD M5 – Auto SL/TP + News Filter – Mobile Compatible Strategy: 1. Pair: XAUUSD, Timeframe: M5 2. Entry Buy: EMA(9) crosses above EMA(21) AND RSI(14) > 50 3. Entry Sell: Opposite 4. Exit: SL = 150 points, TP = 300 points. No trailing. 5. Risk: 1% of balance per trade, lot size auto-calculated 6. Time filter: Trade only 08:00–18:00 GMT+2, Mon-Thu. No Friday trades. 7. News filter: Pause 30min
Looking for a trading bot / Expert Advisor that wont make dozens of small successful trades and then one or two unsuccessful trades that wipes out your account Requirements: - MT4 capable - Use on the major currency pairs - although open to other currency pairs - Be successful in monetary terms not necessarily in how many successful trades
I need a MT5 Prop firm challenge passing EA with strict prop firm rules compliance. Any strategy can be used but win rate should be above 70%. It should have high impact news filter and a dashboard panel to monitor daily drawdown, target profit, current balance, etc. It should not have martingale, grid, hedging, etc
Hello Developers I have a Project to get done! i have a simple strategy can you please create the automated forex ea to execute my trading strategy? i need custom ea for tradingview and mt4/mt5 correction: i need a tradingview indicator created that tells me when to buy or sell. and ea in mt4/mt5
Pro firm setup 30+ USD
Hi, I am starting a futures prop firm. Are you able to help me get data feed for this with no delays and can handle many traders on the platform. Additionally, are you able to handle charts for us

Informations sur le projet

Budget
30 - 50 USD