EA_Gold_MNAKOO

MQL4 Uzman Danışmanlar

İş Gereklilikleri

//+------------------------------------------------------------------+
//| XAUUSD Automated Forex Robot                                     |
//| Enhanced Version with Error Handling and Improvements           |
//+------------------------------------------------------------------+
input int FastMA = 10;                 // Fast moving average period
input int SlowMA = 50;                 // Slow moving average period
input int RSI_Period = 14;             // RSI period
input double Overbought = 70;          // RSI overbought level
input double Oversold = 30;            // RSI oversold level
input double RiskPercent = 1.0;        // Risk per trade as a percentage of account equity
input double ATRMultiplier = 2.0;      // ATR multiplier for stop-loss
input double TrailingStop = 300;       // Trailing stop in points
input double MinLotSize = 0.01;        // Minimum lot size
input double LotStep = 0.01;           // Lot size increment
input int ATR_Period = 14;             // ATR period
input int MaxSlippage = 3;             // Maximum slippage in points
input int MAGIC_NUMBER = 123456;       // Unique identifier for trades
input string TradeComment = "XAUUSD Bot"; // Trade comment

//+------------------------------------------------------------------+
//| OnTick Function - Main Logic                                     |
//+------------------------------------------------------------------+
void OnTick() {
    // Calculate indicators
    static double fastMA, slowMA, rsi, atr;
    fastMA = iMA(NULL, 0, FastMA, 0, MODE_EMA, PRICE_CLOSE, 0);
    slowMA = iMA(NULL, 0, SlowMA, 0, MODE_EMA, PRICE_CLOSE, 0);
    rsi = iRSI(NULL, 0, RSI_Period, PRICE_CLOSE, 0);
    atr = iATR(NULL, 0, ATR_Period, 0);

    // Check for existing trades
    bool buyOpen = IsTradeOpen(OP_BUY);
    bool sellOpen = IsTradeOpen(OP_SELL);

    // Entry logic
    if (fastMA > slowMA && rsi > Oversold && rsi < 50 && !buyOpen) {
        // Buy Signal
        double sl = Bid - ATRMultiplier * atr;
        double tp = Bid + ATRMultiplier * atr * 2;
        double lotSize = CalculateLotSize(sl);
        OpenTrade(OP_BUY, lotSize, sl, tp);
    }

    if (fastMA < slowMA && rsi < Overbought && rsi > 50 && !sellOpen) {
        // Sell Signal
        double sl = Ask + ATRMultiplier * atr;
        double tp = Ask - ATRMultiplier * atr * 2;
        double lotSize = CalculateLotSize(sl);
        OpenTrade(OP_SELL, lotSize, sl, tp);
    }

    // Exit logic (Close trades when conditions reverse)
    if (buyOpen && (fastMA < slowMA || rsi >= Overbought)) {
        CloseTrade(OP_BUY);
    }

    if (sellOpen && (fastMA > slowMA || rsi <= Oversold)) {
        CloseTrade(OP_SELL);
    }

    // Manage Trailing Stop
    ManageTrailingStop();
}

//+------------------------------------------------------------------+
//| Calculate Lot Size Based on Risk                                 |
//+------------------------------------------------------------------+
double CalculateLotSize(double stopLossPrice) {
    double accountEquity = AccountEquity();
    double riskAmount = (RiskPercent / 100) * accountEquity;
    double stopLossDistance = MathAbs(Bid - stopLossPrice);
    double lotSize = riskAmount / (stopLossDistance * MarketInfo(Symbol(), MODE_TICKVALUE));

    // Adjust lot size to broker limits
    lotSize = MathMax(lotSize, MinLotSize);
    lotSize = NormalizeDouble(MathFloor(lotSize / LotStep) * LotStep, 2);
    return lotSize;
}

//+------------------------------------------------------------------+
//| Open Trade Function                                              |
//+------------------------------------------------------------------+
void OpenTrade(int tradeType, double lotSize, double stopLoss, double takeProfit) {
    double price = tradeType == OP_BUY ? Ask : Bid;
    int ticket = OrderSend(Symbol(), tradeType, lotSize, price, MaxSlippage, stopLoss, takeProfit, TradeComment, MAGIC_NUMBER, 0, Blue);
    if (ticket < 0) {
        int errorCode = GetLastError();
        Print("Error opening trade: ", errorCode, ". Retrying...");
        Sleep(1000); // Retry after 1 second
        ticket = OrderSend(Symbol(), tradeType, lotSize, price, MaxSlippage, stopLoss, takeProfit, TradeComment, MAGIC_NUMBER, 0, Blue);
        if (ticket < 0) {
            Print("Failed to open trade after retry. Error: ", GetLastError());
        }
    } else {
        Print("Trade opened: ", ticket);
    }
}

//+------------------------------------------------------------------+
//| Close Trade Function                                             |
//+------------------------------------------------------------------+
void CloseTrade(int tradeType) {
    for (int i = OrdersTotal() - 1; i >= 0; i--) {
        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == Symbol() && OrderType() == tradeType && OrderMagicNumber() == MAGIC_NUMBER) {
                int ticket = OrderClose(OrderTicket(), OrderLots(), tradeType == OP_BUY ? Bid : Ask, MaxSlippage, Red);
                if (ticket < 0) {
                    Print("Error closing trade: ", GetLastError());
                } else {
                    Print("Trade closed: ", ticket);
                }
            }
        }
    }
}

//+------------------------------------------------------------------+
//| Manage Trailing Stop Function                                    |
//+------------------------------------------------------------------+
void ManageTrailingStop() {
    for (int i = OrdersTotal() - 1; i >= 0; i--) {
        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC_NUMBER) {
                double newStopLoss;
                if (OrderType() == OP_BUY) {
                    newStopLoss = Bid - TrailingStop * Point;
                    if (newStopLoss > OrderStopLoss()) {
                        OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, Blue);
                    }
                } else if (OrderType() == OP_SELL) {
                    newStopLoss = Ask + TrailingStop * Point;
                    if (newStopLoss < OrderStopLoss()) {
                        OrderModify(OrderTicket(), OrderOpenPrice(), newStopLoss, OrderTakeProfit(), 0, Blue);
                    }
                }
            }
        }
    }
}

//+------------------------------------------------------------------+
//| Check if Trade Exists                                            |
//+------------------------------------------------------------------+
bool IsTradeOpen(int tradeType) {
    for (int i = OrdersTotal() - 1; i >= 0; i--) {
        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == Symbol() && OrderType() == tradeType && OrderMagicNumber() == MAGIC_NUMBER) {
                return true;
            }
        }
    }
    return false;
}

Dosyalar:

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(151)
Projeler
188
57%
Arabuluculuk
10
80% / 0%
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
2
Geliştirici 2
Derecelendirme
(240)
Projeler
301
28%
Arabuluculuk
33
24% / 61%
Süresi dolmuş
9
3%
Çalışıyor
3
Geliştirici 3
Derecelendirme
(33)
Projeler
38
21%
Arabuluculuk
5
0% / 60%
Süresi dolmuş
0
Serbest
4
Geliştirici 4
Derecelendirme
(321)
Projeler
499
19%
Arabuluculuk
33
42% / 30%
Süresi dolmuş
32
6%
Yüklendi
5
Geliştirici 5
Derecelendirme
(9)
Projeler
20
10%
Arabuluculuk
4
50% / 50%
Süresi dolmuş
5
25%
Serbest
6
Geliştirici 6
Derecelendirme
(428)
Projeler
622
54%
Arabuluculuk
29
55% / 24%
Süresi dolmuş
6
1%
Yüklendi
7
Geliştirici 7
Derecelendirme
(5)
Projeler
8
13%
Arabuluculuk
3
0% / 33%
Süresi dolmuş
2
25%
Serbest
Yayınlandı: 1 kod
8
Geliştirici 8
Derecelendirme
(12)
Projeler
13
23%
Arabuluculuk
7
0% / 71%
Süresi dolmuş
3
23%
Çalışıyor
9
Geliştirici 9
Derecelendirme
(102)
Projeler
105
60%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
10
Geliştirici 10
Derecelendirme
(3)
Projeler
6
17%
Arabuluculuk
0
Süresi dolmuş
3
50%
Serbest
11
Geliştirici 11
Derecelendirme
(4)
Projeler
2
0%
Arabuluculuk
5
0% / 80%
Süresi dolmuş
1
50%
Serbest
12
Geliştirici 12
Derecelendirme
(121)
Projeler
134
66%
Arabuluculuk
36
25% / 56%
Süresi dolmuş
22
16%
Serbest
Yayınlandı: 10 kod
13
Geliştirici 13
Derecelendirme
(462)
Projeler
483
75%
Arabuluculuk
5
80% / 0%
Süresi dolmuş
0
Çalışıyor
14
Geliştirici 14
Derecelendirme
(102)
Projeler
157
21%
Arabuluculuk
23
9% / 78%
Süresi dolmuş
16
10%
Çalışıyor
15
Geliştirici 15
Derecelendirme
(539)
Projeler
619
33%
Arabuluculuk
36
36% / 53%
Süresi dolmuş
11
2%
Yüklendi
16
Geliştirici 16
Derecelendirme
(2)
Projeler
1
0%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
0
Serbest
17
Geliştirici 17
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Yayınlandı: 1 kod
18
Geliştirici 18
Derecelendirme
(59)
Projeler
81
43%
Arabuluculuk
27
11% / 70%
Süresi dolmuş
8
10%
Serbest
19
Geliştirici 19
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Çalışıyor
Benzer siparişler
SMC, etc.) - Backtest results and the set files you used - Whether you’re willing to make minor tweaks so I can use it as my own If the performance looks good, we can discuss adjustments and next steps. My requirements are screenshot, backtes results, demo fileS Let me know if you have anything that fits the bill
iF you already have an successful MT4 EA for scalping in M5 XAUUSD [and eventually EURUSD and USDJPY] working essentially ON the trend when there is an Break Of Structure but also on reversal eventually with strategy Martingale with param ON/OFF eventually with strategy Grid with param ON/OFF eventually with HEDGING with param ON/OFF and on each trade : Stop loss, Trailing sl without High Frequency Trades [means
"I'm searching for a genuinely aggressive, high-risk / ultra-high-reward Expert Advisor (EA) optimized for MetaTrader 5 , capable of running on a very small real account of $100 (or cent/micro account equivalent). Key requirements: Strategy type : Preferably martingale , grid + martingale hybrid , aggressive scalping with recovery , or any other explosive growth-oriented approach (Bollinger/martingale, hedging grid
looking for EA using zone recovery strategy. would like to make small per cent daily with small drawdown. it is a martingale hedge system. Please make the entry based on your own judgement
Hi, is this signal enough for a bot to trade on attached images. its literally just a telegram channel I have access to, the trader avg's 10% weekly for the last 2 years, but I do not have the time to copy trade so wanted to find a solution, all he does is send TV screenshots of his entry/sl/tp and then sends updates as he manages the trade. I thought about hiring someone in a similar timezone to the trader (hes in
Modifiedea 30+ USD
Please my robot doesn’t open trades and I also believe it the ma crossover and others please I want the ma crossover to be fixed.also add trade directions to parameter for both, only sell, or only buys. Please also correct the balance drawdown and equity drawdown if it’s not working.the ea would be carefully tested for assessment l. Also source code will be handed before Payment. Only 30bucks for budget
I need an MT4/MT5 EA modification. Requirements: 1. Equity protection based on DAILY and TOTAL drawdown 2. Automatically close all trades when limit is hit 3. Disable trading after drawdown hit 4. Email notification when: - Daily loss limit reached - Total loss limit reached 5. EA must work on multiple accounts simultaneously 6. Clean and error-free code 7. Compatible with MT5 (or MT4 mention yours)
If you have profitable strategy or profitable EA on the gold pair without martingale / Hedge, then share me the EA with expiry time to back test and to test on the live market. Platform: MT5 pair: Gold Non-Martingale, No Hedging. Need Source Code
I have a working Python backtester for my “DC-WAD Donchian” strategy. I need a MetaTrader 5 Expert Advisor (MQL5) for live trading that matches the Python logic as closely as possible ( no lookahead ). ✅ Critical requirement (must accept) EA must be tick-driven for entries/exits (touch logic). Bar-close approximation is not acceptable . Timeframes Strategy runs on a single Setup Timeframe (HTF) (user input, e.g
This indicator will code into MT5 EA. Trade on live, demo and strategy tester. No repaint, no redraw and stable on chart. 1. Include all inputs variable and value, Lots size in points adjustable, TP in points true or false adjustable, SL in points true or false adjustable, close position on opposite signal true or false, Use pending order true or false, use BE points true or false, use slippage point true or false

Proje bilgisi

Bütçe
100+ USD