Termos de Referência

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

                }

            }

        }

    }

}


Respondido

1
Desenvolvedor 1
Classificação
(253)
Projetos
316
29%
Arbitragem
34
26% / 65%
Expirado
10
3%
Livre
2
Desenvolvedor 2
Classificação
(139)
Projetos
181
24%
Arbitragem
23
22% / 39%
Expirado
13
7%
Livre
3
Desenvolvedor 3
Classificação
(328)
Projetos
511
19%
Arbitragem
33
45% / 30%
Expirado
34
7%
Carregado
4
Desenvolvedor 4
Classificação
(44)
Projetos
58
3%
Arbitragem
6
0% / 67%
Expirado
5
9%
Livre
5
Desenvolvedor 5
Classificação
(194)
Projetos
241
34%
Arbitragem
11
45% / 45%
Expirado
8
3%
Trabalhando
Publicou: 1 artigo, 8 códigos
6
Desenvolvedor 6
Classificação
(257)
Projetos
263
30%
Arbitragem
0
Expirado
3
1%
Livre
Publicou: 2 códigos
7
Desenvolvedor 7
Classificação
(273)
Projetos
402
27%
Arbitragem
40
40% / 50%
Expirado
1
0%
Livre
8
Desenvolvedor 8
Classificação
(156)
Projetos
197
59%
Arbitragem
10
80% / 0%
Expirado
0
Livre
Publicou: 1 código
9
Desenvolvedor 9
Classificação
(85)
Projetos
169
44%
Arbitragem
3
67% / 0%
Expirado
5
3%
Trabalhando
Publicou: 1 código
10
Desenvolvedor 10
Classificação
(37)
Projetos
59
27%
Arbitragem
26
19% / 54%
Expirado
10
17%
Trabalhando
Publicou: 1 código
11
Desenvolvedor 11
Classificação
(1156)
Projetos
1462
63%
Arbitragem
21
57% / 10%
Expirado
43
3%
Livre
12
Desenvolvedor 12
Classificação
(541)
Projetos
818
62%
Arbitragem
33
27% / 45%
Expirado
23
3%
Livre
Publicou: 1 código
13
Desenvolvedor 13
Classificação
(43)
Projetos
66
12%
Arbitragem
12
58% / 42%
Expirado
1
2%
Livre
14
Desenvolvedor 14
Classificação
(566)
Projetos
655
33%
Arbitragem
41
41% / 46%
Expirado
11
2%
Ocupado
15
Desenvolvedor 15
Classificação
(12)
Projetos
25
4%
Arbitragem
1
0% / 0%
Expirado
7
28%
Livre
16
Desenvolvedor 16
Classificação
(450)
Projetos
477
69%
Arbitragem
6
67% / 0%
Expirado
2
0%
Livre
17
Desenvolvedor 17
Classificação
(152)
Projetos
228
80%
Arbitragem
22
27% / 50%
Expirado
11
5%
Livre
Publicou: 24 artigos, 1882 códigos
18
Desenvolvedor 18
Classificação
(45)
Projetos
76
20%
Arbitragem
7
0% / 86%
Expirado
14
18%
Livre
19
Desenvolvedor 19
Classificação
(2)
Projetos
2
0%
Arbitragem
1
0% / 0%
Expirado
2
100%
Livre
20
Desenvolvedor 20
Classificação
(45)
Projetos
46
24%
Arbitragem
34
9% / 85%
Expirado
10
22%
Livre
21
Desenvolvedor 21
Classificação
(3)
Projetos
2
50%
Arbitragem
2
0% / 100%
Expirado
0
Livre
22
Desenvolvedor 22
Classificação
(15)
Projetos
20
35%
Arbitragem
3
0% / 100%
Expirado
0
Livre
Publicou: 1 código
23
Desenvolvedor 23
Classificação
(257)
Projetos
341
58%
Arbitragem
7
14% / 71%
Expirado
9
3%
Livre
24
Desenvolvedor 24
Classificação
(3)
Projetos
1
0%
Arbitragem
5
0% / 100%
Expirado
0
Livre
25
Desenvolvedor 25
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
Pedidos semelhantes
Experience steady growth with this sophisticated, indicator-free scalping EA, specifically engineered to nurture small accounts starting at just 50 USD. This expert advisor is built on the foundations of pure price action, intentionally avoiding high-risk methods like martingale or grid systems. To preserve the high-performance logic of the original strategy, it is provided in its authentic form, bypassing the
I am looking for a highly skilled and professional developer to create a custom Buy/Sell indicator for MT5. The indicator must be fully non-repainting on the chart and must include separate Buy and Sell buffers for possible future EA integration. What I need is not a noisy indicator that produces frequent random signals. I want the exact opposite: the indicator should be highly selective, with few but strong signals
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
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
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
Hello, I need a clear, professional, and strictly rule-based MT5 Expert Advisor. Please follow the specification below exactly as written, without adding extra logic, extra indicators, or personal modifications unless I ask for them later. The goal is to build a universal EA that can work with any custom indicator that provides signals through buffers. PROJECT TITLE Universal Indicator EA for MT5 1) GENERAL IDEA The

Informações sobre o projeto

Orçamento
30+ USD