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
(253)
Projets
316
29%
Arbitrage
34
26% / 65%
En retard
10
3%
Gratuit
2
Développeur 2
Évaluation
(139)
Projets
181
24%
Arbitrage
23
22% / 39%
En retard
13
7%
Gratuit
3
Développeur 3
Évaluation
(328)
Projets
511
19%
Arbitrage
33
45% / 30%
En retard
34
7%
Chargé
4
Développeur 4
Évaluation
(44)
Projets
58
3%
Arbitrage
6
0% / 67%
En retard
5
9%
Gratuit
5
Développeur 5
Évaluation
(194)
Projets
241
34%
Arbitrage
11
45% / 45%
En retard
8
3%
Travail
Publié : 1 article, 8 codes
6
Développeur 6
Évaluation
(256)
Projets
263
30%
Arbitrage
0
En retard
3
1%
Gratuit
Publié : 2 codes
7
Développeur 7
Évaluation
(273)
Projets
402
27%
Arbitrage
40
40% / 50%
En retard
1
0%
Gratuit
8
Développeur 8
Évaluation
(156)
Projets
197
59%
Arbitrage
10
80% / 0%
En retard
0
Gratuit
Publié : 1 code
9
Développeur 9
Évaluation
(85)
Projets
169
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
(541)
Projets
818
62%
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
(566)
Projets
655
33%
Arbitrage
41
41% / 46%
En retard
11
2%
Occupé
15
Développeur 15
Évaluation
(12)
Projets
25
4%
Arbitrage
1
0% / 0%
En retard
7
28%
Gratuit
16
Développeur 16
Évaluation
(450)
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
I am currently manual testing an additional indicator but, I have a few(3) paid(licensed) indicators that I use to trade with. I use one as a primary signal and the other 2 as confluence for entries. I want to backtest them together in order to have an auto/semi-auto data backed system. Would you be able to assist with this? Im am planning on fully engaging this project in 1-2 weeks from now. My indicators are on
OFFICIAL MQL5 SOFTWARE REQUIREMENTS SPECIFICATION (SRS) Project Name: "Quantum-Shield 2.0" Institutional EA Platform: MetaTrader 5 (MT5) Execution Logic: Fully Automated Instrument: GER40 (DAX) Timeframe: 10 Minutes 1. ARCHITECTURAL MANDATE The Expert Advisor must be a monolithic, high-performance C++ based MQL5 application. No DLLs, no external python bridges. The logic must be entirely self-contained. 2. SIGNAL
Hi All, I am looking for an EA which I have attached the video of. It places a buy stop and sell stop with 250 pips above and below current price for every minute with SL as 300 pips and TP as 500 pips. If any of of them triggers in the minute other will be cancelled, it will not place any pending orders till either of SL or TP is hit and places new set of pending orders the very next minute of SL or TP hit minute
Okay so basically this is a repair job of a strategy I hired a guy to do that doesn't quite workas I intended it to but is very close. So should be fairly simple to fix . I have enclosed a video file. Its important to understand that the take profit and stop loss were added by the guy who coded it but arent central to the strategy. The main thing is that the system must reference the prior bar and sell when the ow is
Specification I need a mt5 Expert advisor EA to manage intraday trades with strict risk management. The EA must -Handle between 5 to 8 clean trades a day max altogether throughout all 3 sessions. no big news trading times and no overnight trades -Use 1 % on forex pairs and up to 2% on XAUUSD risk per trade - Automatically calculate lot size based on stop loss -use fixed RR ratio [1:2] For forex pairs
Buy and sell indicator 30 - 200 USD
} Hello, I am looking for a highly skilled and professional developer to create a powerful custom trading indicator for MetaTrader. The indicator must display Buy and Sell signals directly on the chart in a clean and professional way (for example, dots or arrows). The signals must be non-repainting, meaning once a signal appears it must never change or disappear after the candle closes. I want the indicator to be
I trade ES futures on the Ninja trader platform. I recently came across an indicator and wanted to check with you if you can build a similar indicator that works on Orenko or Ninja renko charts, and also combines support and resistance untouched. Below is the indicator, which will tell you market chop and to avoid. I want to include a support and
The Expert Advisor (EA) must work with any custom indicator that provides Buy and Sell signals through buffers. The EA should read signals from the indicator and execute trades according to the defined rules. The EA must be universal and able to work with different indicators as long as they provide signal buffers. I will share the rest of the details with you shortly
I need a highly accurate spike MT5 detector for boom and crash which can be used to catch big spikes. Demo versions will be required. The indicator should not repaint and have high win rate. It should work as shown in the links below https://vt.tiktok.com/ZSHgMePGh/ https://vt.tiktok.com/ZSHg6STkB/ https://vt.tiktok.com/ZSHg62YJ4/ https://vt.tiktok.com/ZSHgjoEML/
I have an existing TradingView Pine Script. I will provide the Pine Script source code after agreement. Goal: Convert the logic into MT5 (MQL5) and build an EA. Phase 1: Create MT5 indicator that matches TradingView signals (M15 only) Phase 2: Build EA with strict execution rules: max 4 trades total one trade per symbol gold lot limit (max 0.02 total) reversal logic (close then open opposite) no re-entry after manual

Informations sur le projet

Budget
30+ USD