Specification

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

                }

            }

        }

    }

}


Responded

1
Developer 1
Rating
(249)
Projects
312
28%
Arbitration
33
27% / 64%
Overdue
10
3%
Working
2
Developer 2
Rating
(139)
Projects
181
24%
Arbitration
23
22% / 39%
Overdue
13
7%
Free
3
Developer 3
Rating
(325)
Projects
505
19%
Arbitration
32
44% / 31%
Overdue
34
7%
Loaded
4
Developer 4
Rating
(44)
Projects
58
3%
Arbitration
7
0% / 57%
Overdue
5
9%
Working
5
Developer 5
Rating
(194)
Projects
241
34%
Arbitration
10
50% / 50%
Overdue
8
3%
Working
Published: 1 article, 8 codes
6
Developer 6
Rating
(252)
Projects
258
30%
Arbitration
0
Overdue
3
1%
Free
Published: 2 codes
7
Developer 7
Rating
(271)
Projects
400
27%
Arbitration
39
41% / 49%
Overdue
1
0%
Free
8
Developer 8
Rating
(154)
Projects
192
58%
Arbitration
10
80% / 0%
Overdue
0
Working
Published: 1 code
9
Developer 9
Rating
(85)
Projects
168
44%
Arbitration
3
67% / 0%
Overdue
5
3%
Working
Published: 1 code
10
Developer 10
Rating
(37)
Projects
59
27%
Arbitration
26
19% / 54%
Overdue
10
17%
Working
Published: 1 code
11
Developer 11
Rating
(1156)
Projects
1462
63%
Arbitration
21
57% / 10%
Overdue
43
3%
Free
12
Developer 12
Rating
(526)
Projects
798
63%
Arbitration
33
27% / 45%
Overdue
23
3%
Free
Published: 1 code
13
Developer 13
Rating
(43)
Projects
66
12%
Arbitration
12
58% / 42%
Overdue
1
2%
Free
14
Developer 14
Rating
(548)
Projects
632
33%
Arbitration
39
38% / 49%
Overdue
11
2%
Loaded
15
Developer 15
Rating
(12)
Projects
25
4%
Arbitration
1
0% / 0%
Overdue
7
28%
Free
16
Developer 16
Rating
(449)
Projects
477
69%
Arbitration
6
67% / 0%
Overdue
2
0%
Free
17
Developer 17
Rating
(152)
Projects
228
80%
Arbitration
22
27% / 50%
Overdue
11
5%
Free
Published: 24 articles, 1882 codes
18
Developer 18
Rating
(45)
Projects
76
20%
Arbitration
7
0% / 86%
Overdue
14
18%
Free
19
Developer 19
Rating
(2)
Projects
2
0%
Arbitration
1
0% / 0%
Overdue
2
100%
Free
20
Developer 20
Rating
(45)
Projects
46
24%
Arbitration
34
9% / 85%
Overdue
10
22%
Free
21
Developer 21
Rating
(3)
Projects
2
50%
Arbitration
2
0% / 100%
Overdue
0
Free
22
Developer 22
Rating
(15)
Projects
20
35%
Arbitration
3
0% / 100%
Overdue
0
Free
Published: 1 code
23
Developer 23
Rating
(257)
Projects
341
58%
Arbitration
7
14% / 71%
Overdue
9
3%
Free
24
Developer 24
Rating
(3)
Projects
1
0%
Arbitration
5
0% / 100%
Overdue
0
Free
25
Developer 25
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
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
Hello friends, We need Robot, EA , or Trading software with proven( 6 to 12 months) and it should be given consistent profit upto 3 % per month with no risk ( low Drawdown ), we will pay what you ask, and also We are regulated forex broker and we have all access like FIX API etc, and we dealing with Top tier 1 LPs . Thanks

Project information

Budget
30+ USD