FIX ERRORS ON MY CODE

指定

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

                }

            }

        }

    }

}


反馈

1
开发者 1
等级
(253)
项目
316
29%
仲裁
34
26% / 65%
逾期
10
3%
空闲
2
开发者 2
等级
(139)
项目
181
24%
仲裁
23
22% / 39%
逾期
13
7%
空闲
3
开发者 3
等级
(328)
项目
511
19%
仲裁
33
45% / 30%
逾期
34
7%
已载入
4
开发者 4
等级
(44)
项目
58
3%
仲裁
6
0% / 67%
逾期
5
9%
空闲
5
开发者 5
等级
(194)
项目
241
34%
仲裁
11
45% / 45%
逾期
8
3%
工作中
发布者: 1 文章, 8 代码
6
开发者 6
等级
(256)
项目
263
30%
仲裁
0
逾期
3
1%
空闲
发布者: 2 代码
7
开发者 7
等级
(273)
项目
402
27%
仲裁
40
40% / 50%
逾期
1
0%
空闲
8
开发者 8
等级
(156)
项目
197
59%
仲裁
10
80% / 0%
逾期
0
空闲
发布者: 1 代码
9
开发者 9
等级
(85)
项目
169
44%
仲裁
3
67% / 0%
逾期
5
3%
工作中
发布者: 1 代码
10
开发者 10
等级
(37)
项目
59
27%
仲裁
26
19% / 54%
逾期
10
17%
工作中
发布者: 1 代码
11
开发者 11
等级
(1156)
项目
1462
63%
仲裁
21
57% / 10%
逾期
43
3%
空闲
12
开发者 12
等级
(541)
项目
818
62%
仲裁
33
27% / 45%
逾期
23
3%
空闲
发布者: 1 代码
13
开发者 13
等级
(43)
项目
66
12%
仲裁
12
58% / 42%
逾期
1
2%
空闲
14
开发者 14
等级
(566)
项目
655
33%
仲裁
41
41% / 46%
逾期
11
2%
繁忙
15
开发者 15
等级
(12)
项目
25
4%
仲裁
1
0% / 0%
逾期
7
28%
空闲
16
开发者 16
等级
(450)
项目
477
69%
仲裁
6
67% / 0%
逾期
2
0%
空闲
17
开发者 17
等级
(152)
项目
228
80%
仲裁
22
27% / 50%
逾期
11
5%
空闲
发布者: 24 文章, 1882 代码
18
开发者 18
等级
(45)
项目
76
20%
仲裁
7
0% / 86%
逾期
14
18%
空闲
19
开发者 19
等级
(2)
项目
2
0%
仲裁
1
0% / 0%
逾期
2
100%
空闲
20
开发者 20
等级
(45)
项目
46
24%
仲裁
34
9% / 85%
逾期
10
22%
空闲
21
开发者 21
等级
(3)
项目
2
50%
仲裁
2
0% / 100%
逾期
0
空闲
22
开发者 22
等级
(15)
项目
20
35%
仲裁
3
0% / 100%
逾期
0
空闲
发布者: 1 代码
23
开发者 23
等级
(257)
项目
341
58%
仲裁
7
14% / 71%
逾期
9
3%
空闲
24
开发者 24
等级
(3)
项目
1
0%
仲裁
5
0% / 100%
逾期
0
空闲
25
开发者 25
等级
项目
0
0%
仲裁
0
逾期
0
空闲
相似订单
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
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
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
I have been working on an EA that is based on Ichimoku cloud and SMC internal blocks for stop loss. ENTRY BUGS: 1. I have entries issues with the chenkou and price action. It is entering trades when chenkou is poking through the kumo. This shouldn't happen. There should be a candle close with chenkou above kumo or below. 2. Another entry issue with other criteria for tenkan and price action also these entries are
I need an Expert Advisor (EA) programmed and designed to help me with trading. Requirements: * The programmer must have experience in implementing software projects. * The code must be high-quality, clean, clear, and editable at any time, with ownership of the code provided. * It must work on MT4 and MT5 platforms. * The maximum project completion time is 3 days. * The programmer must be cooperative and flexible

项目信息

预算
30+ USD