指定

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
評価
(249)
プロジェクト
313
28%
仲裁
33
27% / 64%
期限切れ
10
3%
2
開発者 2
評価
(139)
プロジェクト
181
24%
仲裁
23
22% / 39%
期限切れ
13
7%
3
開発者 3
評価
(325)
プロジェクト
505
19%
仲裁
32
44% / 31%
期限切れ
34
7%
取り込み中
4
開発者 4
評価
(44)
プロジェクト
58
3%
仲裁
7
0% / 57%
期限切れ
5
9%
仕事中
5
開発者 5
評価
(194)
プロジェクト
241
34%
仲裁
10
50% / 50%
期限切れ
8
3%
仕事中
パブリッシュした人: 1 article, 8 codes
6
開発者 6
評価
(252)
プロジェクト
258
30%
仲裁
0
期限切れ
3
1%
パブリッシュした人: 2 codes
7
開発者 7
評価
(271)
プロジェクト
400
27%
仲裁
39
41% / 49%
期限切れ
1
0%
8
開発者 8
評価
(154)
プロジェクト
192
58%
仲裁
10
80% / 0%
期限切れ
0
仕事中
パブリッシュした人: 1 code
9
開発者 9
評価
(85)
プロジェクト
168
44%
仲裁
3
67% / 0%
期限切れ
5
3%
仕事中
パブリッシュした人: 1 code
10
開発者 10
評価
(37)
プロジェクト
59
27%
仲裁
26
19% / 54%
期限切れ
10
17%
仕事中
パブリッシュした人: 1 code
11
開発者 11
評価
(1156)
プロジェクト
1462
63%
仲裁
21
57% / 10%
期限切れ
43
3%
12
開発者 12
評価
(527)
プロジェクト
799
63%
仲裁
33
27% / 45%
期限切れ
23
3%
パブリッシュした人: 1 code
13
開発者 13
評価
(43)
プロジェクト
66
12%
仲裁
12
58% / 42%
期限切れ
1
2%
14
開発者 14
評価
(548)
プロジェクト
632
33%
仲裁
39
38% / 49%
期限切れ
11
2%
取り込み中
15
開発者 15
評価
(12)
プロジェクト
25
4%
仲裁
1
0% / 0%
期限切れ
7
28%
16
開発者 16
評価
(449)
プロジェクト
477
69%
仲裁
6
67% / 0%
期限切れ
2
0%
17
開発者 17
評価
(152)
プロジェクト
228
80%
仲裁
22
27% / 50%
期限切れ
11
5%
パブリッシュした人: 24 articles, 1882 codes
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 code
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
類似した注文
Hello developers, I’m looking for a professional trading bot that works using pending orders only (Buy Stop & Sell Stop). Main requirements: The bot must open multiple pending orders continuously. Stable execution without freezing or missing orders. Clean and professional logic suitable for real trading. Fully customizable settings (distance, lot size, TP/SL, trailing, etc.). If anyone already has a ready-made
Develop a fully automated MT5 Expert Advisor based on a multi-timeframe institutional trend-pullback strategy with: Regime filtering (H4) Execution logic (H1) ATR-based stop model Multi-stage trailing system Risk-based position sizing Portfolio-level risk protection Detailed performance logging This EA will be used for client capital (PAMM/MAM environment). Stability and risk control are higher priority than high
Hello, I have an existing MT5 Expert Advisor that works perfectly on a demo account. The strategy is profitable and executes trades correctly in demo testing. However, when I run the same EA on a live account, it takes trades but the results are not profitable. The performance is significantly different compared to demo. I am looking for an experienced MQL5 developer who can: Analyze the EA logic Identify why live
I am looking to purchase a proven scalping Expert Advisor with verified live account performance. Requirements: • Minimum 6 months live trading history • Proven profitability with controlled drawdown • Scalping strategy with Buy and Sell trades • Works on XAUUSD (Gold), MT5 preferred • Includes Stop Loss and Take Profit • Suitable for small accounts ($100) • Reasonable one time price Please share live performance
Hello, I want a grid trading bot for the Gate.io crypto exchange. I currently have a working grid bot written in MQL5, and I want a similar bot implemented in Python. The MQL5 bot can be translated, but the codebase is large and it was not designed to be easily ported to Python. Therefore, I prefer that the final Python bot preserves the same core grid logic, but is implemented cleanly in Python rather than doing a
The EA should only set TP and SL( Both Optional, We can set one at the time or no one at the same time or both active at the same time) 1. We active trade ourself , But in The EA this should ask if what the the TP and SL in form of USD we need. We'll put the Exact Required profit and or loss. This EA should calculate and set the tps and Sls itself to all the trades, and when we change the USD profit from info meter
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

プロジェクト情報

予算
30+ USD