Specifiche

HI

i want some one to make the following MQL5 code work for me. the code has errors.


#include <Trade\Trade.mqh> // Include the trade library


// Define input parameters

input double lotSize = 0.1;    // Lot size for trading

input int stopLoss = 50;       // Stop Loss in pips

input int takeProfit = 100;    // Take Profit in pips


//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

{

    // Subscribe to OnTrade() event

    EventSetMillisecondTimer(60);  // Set a timer to check conditions every 60 milliseconds

    return(INIT_SUCCEEDED);

}


//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{

    // Deinitialization function (if needed)

    EventKillTimer();  // Kill the timer when deinitializing

}


//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

{

    // Nothing to do here for conditions check, as we use OnTrade()

}


//+------------------------------------------------------------------+

//| Expert trade event handler                                       |

//+------------------------------------------------------------------+

void OnTrade()

{

    // Calculate the open and close prices of the previous day

    double prevDayOpen = iOpen(Symbol(), PERIOD_D1, 1);

    double prevDayClose = iClose(Symbol(), PERIOD_D1, 1);


    // Check for Rule 1: Previous day was an uptrend

    if (prevDayClose > prevDayOpen)

    {

        // Check if the current open price is between the previous day's open and close prices

        double currentOpen = iOpen(Symbol(), PERIOD_D1, 0);

        if (currentOpen > prevDayOpen && currentOpen < prevDayClose)

        {

            // Buy if the price breaks above the previous day's close price

            double currentHigh = iHigh(Symbol(), PERIOD_D1, 0);

            if (currentHigh > prevDayClose)

            {

                // Place a Buy order

                double openPrice = SymbolInfoDouble(_Symbol, SYMBOL_ASK);

                double stopLossPrice = openPrice - stopLoss * _Point;

                double takeProfitPrice = openPrice + takeProfit * _Point;


                int ticket = OrderSend(_Symbol, OP_BUY, lotSize, openPrice, 3, 0, 0, "", 0, clrNONE, 0, clrNONE);

                if (ticket > 0)

                {

                    // Order placed successfully - set Stop Loss and Take Profit

                    OrderSend(_Symbol, OP_SELL, lotSize, openPrice, 0, stopLossPrice, takeProfitPrice, "", 0, clrNONE, 0, clrNONE);

                }

            }

        }

    }


    // Check for Rule 2: Opposite of Rule 1

    if (prevDayClose < prevDayOpen)

    {

        // Check if the current open price is between the previous day's open and close prices

        double currentOpen = iOpen(Symbol(), PERIOD_D1, 0);

        if (currentOpen > prevDayOpen && currentOpen < prevDayClose)

        {

            // Sell if the price breaks below the previous day's close price

            double currentLow = iLow(Symbol(), PERIOD_D1, 0);

            if (currentLow < prevDayClose)

            {

                // Place a Sell order

                double openPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID);

                double stopLossPrice = openPrice + stopLoss * _Point;

                double takeProfitPrice = openPrice - takeProfit * _Point;


                int ticket = OrderSend(_Symbol, OP_SELL, lotSize, openPrice, 3, 0, 0, "", 0, clrNONE, 0, clrNONE);

                if (ticket > 0)

                {

                    // Order placed successfully - set Stop Loss and Take Profit

                    OrderSend(_Symbol, OP_BUY, lotSize, openPrice, 0, stopLossPrice, takeProfitPrice, "", 0, clrNONE, 0, clrNONE);

                }

            }

        }

    }

}


Con risposta

1
Sviluppatore 1
Valutazioni
(263)
Progetti
329
29%
Arbitraggio
36
25% / 64%
In ritardo
10
3%
In elaborazione
2
Sviluppatore 2
Valutazioni
(139)
Progetti
181
24%
Arbitraggio
23
22% / 39%
In ritardo
13
7%
Gratuito
3
Sviluppatore 3
Valutazioni
(328)
Progetti
513
19%
Arbitraggio
35
43% / 31%
In ritardo
34
7%
Caricato
4
Sviluppatore 4
Valutazioni
(44)
Progetti
60
5%
Arbitraggio
6
0% / 67%
In ritardo
5
8%
Gratuito
5
Sviluppatore 5
Valutazioni
(195)
Progetti
242
34%
Arbitraggio
11
45% / 45%
In ritardo
8
3%
Gratuito
Pubblicati: 1 articolo, 8 codici
6
Sviluppatore 6
Valutazioni
(258)
Progetti
266
29%
Arbitraggio
0
In ritardo
3
1%
In elaborazione
Pubblicati: 2 codici
7
Sviluppatore 7
Valutazioni
(274)
Progetti
403
28%
Arbitraggio
40
40% / 50%
In ritardo
1
0%
Gratuito
8
Sviluppatore 8
Valutazioni
(160)
Progetti
203
60%
Arbitraggio
10
80% / 0%
In ritardo
0
Gratuito
Pubblicati: 1 codice
9
Sviluppatore 9
Valutazioni
(85)
Progetti
174
44%
Arbitraggio
3
100% / 0%
In ritardo
5
3%
Gratuito
Pubblicati: 1 codice
10
Sviluppatore 10
Valutazioni
(37)
Progetti
59
27%
Arbitraggio
26
19% / 54%
In ritardo
10
17%
In elaborazione
Pubblicati: 1 codice
11
Sviluppatore 11
Valutazioni
(1156)
Progetti
1462
63%
Arbitraggio
21
57% / 10%
In ritardo
43
3%
Gratuito
12
Sviluppatore 12
Valutazioni
(548)
Progetti
833
62%
Arbitraggio
33
27% / 45%
In ritardo
24
3%
Gratuito
Pubblicati: 1 codice
13
Sviluppatore 13
Valutazioni
(43)
Progetti
66
12%
Arbitraggio
12
58% / 42%
In ritardo
1
2%
Gratuito
14
Sviluppatore 14
Valutazioni
(610)
Progetti
708
33%
Arbitraggio
45
44% / 42%
In ritardo
14
2%
Caricato
15
Sviluppatore 15
Valutazioni
(12)
Progetti
25
4%
Arbitraggio
1
0% / 0%
In ritardo
7
28%
Gratuito
16
Sviluppatore 16
Valutazioni
(459)
Progetti
486
70%
Arbitraggio
6
67% / 0%
In ritardo
2
0%
In elaborazione
17
Sviluppatore 17
Valutazioni
(152)
Progetti
228
80%
Arbitraggio
22
27% / 50%
In ritardo
11
5%
Gratuito
Pubblicati: 24 articoli, 1882 codici
18
Sviluppatore 18
Valutazioni
(45)
Progetti
76
20%
Arbitraggio
7
0% / 86%
In ritardo
14
18%
Gratuito
19
Sviluppatore 19
Valutazioni
(2)
Progetti
2
0%
Arbitraggio
1
0% / 0%
In ritardo
2
100%
Gratuito
20
Sviluppatore 20
Valutazioni
(45)
Progetti
46
24%
Arbitraggio
34
9% / 85%
In ritardo
10
22%
Gratuito
21
Sviluppatore 21
Valutazioni
(3)
Progetti
2
50%
Arbitraggio
2
0% / 100%
In ritardo
0
Gratuito
22
Sviluppatore 22
Valutazioni
(15)
Progetti
20
35%
Arbitraggio
3
0% / 100%
In ritardo
0
Gratuito
Pubblicati: 1 codice
23
Sviluppatore 23
Valutazioni
(257)
Progetti
341
58%
Arbitraggio
7
14% / 71%
In ritardo
9
3%
Gratuito
24
Sviluppatore 24
Valutazioni
(3)
Progetti
1
0%
Arbitraggio
5
0% / 100%
In ritardo
0
Gratuito
25
Sviluppatore 25
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
Ordini simili
*Need an MQL5 EA for MT5 to trade gold and forex automatically. Must include Stop Loss, Take Profit, and basic risk management. Budget is $30 to $50. Looking for clean, stable code that works on VPS.*
Description: I need an experienced MQL5 developer to build a professional MT5 Expert Advisor for XAU/USD based on my trading strategy. I require the full .mq5 source code and the compiled file. Trading Logic: Timeframes: H4 to determine overall direction, H1 for supply and demand zones, M15 for trade entries. Buy conditions: H4 trend is bullish, price reaches a valid H1 demand zone, liquidity sweep occurs below the
Standby Description . Prop Firm Environment . ( Monitor Execution and Handling Environment Changes as Required ) . Technical Issues . Delete extra lines of code (Clean Code , Folder) . Asset related translation , no need for Logic Alteration
MultiPair_PriceAction 30 - 200 USD
OANDA market watch clock and symbols (.sim) Multipair able so i can choose at least 6 of those more volatile forex pairs. Price Action setups instead of relay on lag indicators. But rsi for confirmation. Spread protection, position management, magic number editor, hours trading. Volatility protection Trailing Stop, Stop losses, take profit. Percentage and ATR scale instead of dollars or lot sizes. Funds management
Looking for an MT5 Expert Advisor developer with: Minimum 1 year of verified activity on the MetaTrader Market Positive, real user reviews Ability to build EAs without Bollinger Bands Fully configurable parameters (risk, filters, SL/TP, trading hours) Free test version available before any payment Clear communication and ongoing support If you meet these requirements, please send your MQL5 profile or portfolio
I want to create a EA based on an existing EA. I want to create a COPY of same EA. This is a Grid based EA and do averaging when market goes against it. While doing Averaging it keeps on taking trades and booking profits
Akram boushaba 30 - 500 USD
مرحبا كيف حالكم انا اكرم مهتم بالتداول احاول ان اصمم برنامج روبوت قادر على التداول من تلقاء نفسه من يمكنه ان يساعدني او يعلمني كيف استطيع فهل ذلك وسأكون ممتناً له وشكرا لكم
Looking for someone who is experienced in creating MT5 EA from scratch to go over 7 public youtube videos (total duration about 5 hours) and extract the strategy code taught in the videos to make a MT5 .mq5 source code file. Full code is explained in the 7 videos so it's just a matter of going over the videos and extracting the relevant parts that relate to the source code and compiling it into a working EA. The
EA Crafter 500+ USD
Act as a professional Quantitative Developer and Risk Manager. I want to build a systematic trading strategy rulebook that prioritizes capital preservation and statistical edge over raw performance. Please generate a structured trading strategy using the following framework: 1. ASSET CLASS & TIMEFRAME: - Asset: [e.g., Apple (AAPL), Bitcoin (BTC), or EUR/USD] - Timeframe: [e.g., 5-minute, 1-hour, Daily] 2. CORE
I have an existing MT5 Expert Advisor for XAUUSD M5. This is NOT a new robot from zero. I need modification and professional review of an existing MQL5 EA. Main goals: 1. Buy entries: Buy trades are currently too rare. The Buy ADX filter was very strict at 45. I am testing 40 now. I need you to review the Buy entry filters and improve Buy entry quality without making entries random or weak. 2. Sell entries: Sell

Informazioni sul progetto

Budget
30+ USD