Spécifications

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);

                }

            }

        }

    }

}


Répondu

1
Développeur 1
Évaluation
(249)
Projets
312
28%
Arbitrage
33
27% / 64%
En retard
10
3%
Travail
2
Développeur 2
Évaluation
(139)
Projets
181
24%
Arbitrage
23
22% / 39%
En retard
13
7%
Gratuit
3
Développeur 3
Évaluation
(325)
Projets
505
19%
Arbitrage
32
44% / 31%
En retard
34
7%
Chargé
4
Développeur 4
Évaluation
(44)
Projets
58
3%
Arbitrage
7
0% / 57%
En retard
5
9%
Travail
5
Développeur 5
Évaluation
(194)
Projets
241
34%
Arbitrage
10
50% / 50%
En retard
8
3%
Travail
Publié : 1 article, 8 codes
6
Développeur 6
Évaluation
(252)
Projets
258
30%
Arbitrage
0
En retard
3
1%
Gratuit
Publié : 2 codes
7
Développeur 7
Évaluation
(271)
Projets
400
27%
Arbitrage
39
41% / 49%
En retard
1
0%
Gratuit
8
Développeur 8
Évaluation
(154)
Projets
192
58%
Arbitrage
10
80% / 0%
En retard
0
Travail
Publié : 1 code
9
Développeur 9
Évaluation
(85)
Projets
168
44%
Arbitrage
3
67% / 0%
En retard
5
3%
Travail
Publié : 1 code
10
Développeur 10
Évaluation
(37)
Projets
59
27%
Arbitrage
26
19% / 54%
En retard
10
17%
Travail
Publié : 1 code
11
Développeur 11
Évaluation
(1156)
Projets
1462
63%
Arbitrage
21
57% / 10%
En retard
43
3%
Gratuit
12
Développeur 12
Évaluation
(527)
Projets
799
63%
Arbitrage
33
27% / 45%
En retard
23
3%
Gratuit
Publié : 1 code
13
Développeur 13
Évaluation
(43)
Projets
66
12%
Arbitrage
12
58% / 42%
En retard
1
2%
Gratuit
14
Développeur 14
Évaluation
(548)
Projets
632
33%
Arbitrage
39
38% / 49%
En retard
11
2%
Chargé
15
Développeur 15
Évaluation
(12)
Projets
25
4%
Arbitrage
1
0% / 0%
En retard
7
28%
Gratuit
16
Développeur 16
Évaluation
(449)
Projets
477
69%
Arbitrage
6
67% / 0%
En retard
2
0%
Gratuit
17
Développeur 17
Évaluation
(152)
Projets
228
80%
Arbitrage
22
27% / 50%
En retard
11
5%
Gratuit
Publié : 24 articles, 1882 codes
18
Développeur 18
Évaluation
(45)
Projets
76
20%
Arbitrage
7
0% / 86%
En retard
14
18%
Gratuit
19
Développeur 19
Évaluation
(2)
Projets
2
0%
Arbitrage
1
0% / 0%
En retard
2
100%
Gratuit
20
Développeur 20
Évaluation
(45)
Projets
46
24%
Arbitrage
34
9% / 85%
En retard
10
22%
Gratuit
21
Développeur 21
Évaluation
(3)
Projets
2
50%
Arbitrage
2
0% / 100%
En retard
0
Gratuit
22
Développeur 22
Évaluation
(15)
Projets
20
35%
Arbitrage
3
0% / 100%
En retard
0
Gratuit
Publié : 1 code
23
Développeur 23
Évaluation
(257)
Projets
341
58%
Arbitrage
7
14% / 71%
En retard
9
3%
Gratuit
24
Développeur 24
Évaluation
(3)
Projets
1
0%
Arbitrage
5
0% / 100%
En retard
0
Gratuit
25
Développeur 25
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
Commandes similaires
Hello, I have an MQ4 indicator that works with a specific strategy. I want to modify some aspects and convert the file to MQ5. It's simple and won't take much effort or time for someone experienced in this field. Ideally, the person undertaking this task should be familiar with the MX2Trading software, as I will be using it to transfer the signals from the indicator to the trading platform
I trade manually on M1 chart (XAUUSD) with fractals and alligator. When there is a price break on fractal (or some fractals that form a price level) or a price level created by multiple candles spikes, I enter 2 trades (0.02 lots), and 2 trades (0.04 lots). If I go in profit (5/10€), I close in profit. But if I go in loss with DD, at this point starts the management: every price level (important level) created by
Phahla fx boto 30+ USD
99.99% signal accuracy 10-15 trades distribution all currency trade and meta AI assistance on loss[advice] stop and start robot cyber security firewall protection activation code: 20060605TLP20 Please create a trading bot with any logo with the name elevation
Refine signal trigger execution . Optimize live chart performance . Ensure stable and clean code structure : Stable and clean code is important . Otherwise its a mess . Apply with as much accurate structure you foresee
RED DEVIL AI 30+ USD
50 EMA > 200 EMA → Uptrend confirmed Price pulls back to touch or cross below 50 EMA RSI > 50 ATR(14) > 20-period ATR average (volatility expanding) Current candle closes bullish ➡ Enter BUY at candle close50 EMA < 200 EMA → Downtrend Price pulls back to touch or cross above 50 EMA RSI < 50 ATR filter confirms volatility Current candle closes bearish ➡ Enter SELL at candle closeATR(14) Take Profit: 2.5 × ATR(14) This
This post is subject to developers response . Edit the post as you like . May be with me you can make a come back . So , , , Shift calculations . More to the calculation then you can comprehend is known . What else comes to your mind
Here is an example of Requirements Specification for the development of the MACD Sample Expert Advisor, which is available in the MetaTrader 5 standard package. 1. The idea of the trading system is as follows: market entries are performed when MACD's main and signal lines intersect in the current trend direction. 2. Trend is determined based on the Exponential Moving Average with the specified period
I’m looking for a trading bot where I can use a balance of £1000 to make regular entries making £20-£40 per entry. obviously, I want to have minimum loss with a lot more profit being made
I’m hiring an experienced MQL5 developer to finish and fix an existing project (NOT building from scratch). I have: An existing MT5 EA (.mq5 + .ex5) that is based on my TradingView logic A TradingView indicator version used for signals/alerts The EA works but has logic/consistency issues and needs improvements + cleanup Goal Make the EA reliable and consistent: Ensure entries/exits match the intended logic Fix
I have a High-Frequency Trading EA and I need a full conversion and optimization for MT5. The goal is to ensure stable execution and reliable performance on real accounts (IC Markets Raw and similar ECN brokers). I need an experienced and reputable MQL5 developer to: Convert the existing strategy to MT5 with full fidelity to the original trading logic (entries, SL, breakeven, trailing, pending orders). Optimize the

Informations sur le projet

Budget
30+ USD