Simple Martingale Based EA

MQL4 エキスパート

指定

This is a simple Martingale based EA with RSI indicator used as buy/sell order conditions

Mandatory Inputs:

extern double TakeProfit = 120.0; // self explanatory for first order, for martingale orders it will adjust TP of all orders of the same type (buy / sell) to one, for example if an order opened at 100, 2nd opens at 105, the both of their tps will be at the same point, if an order is manually closed, it will adjust existing order tps accordingly.

extern double StopLoss = 1000.0; // self explanatory for each order it has its own stoploss

extern double InitialLots = 0.03;

extern double MartingaleFactor = 2; // Self explanatory - previous lot size will be multiplied to the next lotsize, so if initial lot is 0.03, 2nd order will be multiplied to 0.03, and 3rd will be multiplied to the 2nd order and so on

extern int MagicNumberBuy = 1986; // self explanatory

extern int MagicNumberSell = 5591; // self explanatory

extern int StartHour = 3; // self explanatory - ea will start working

extern int EndHour = 23; // // self explanatory - ea will stop working

extern double RSI_Period = 14; // self explanatory - variable rsi period setting

extern double RSI_Upper = 60.0; // ea will place sell order if rsi goes above this point -- only first order will follow this rule, martingale orders will be placed according to PointsAfterDistance has reached

extern double RSI_Lower = 30.0; // ea will place buy order if rsi goes below this point -- only first order will follow this rule, martingale orders will be placed according to PointsAfterDistance

extern int MaxTrades = 3; // Maximum number of trades per type (buy/sell) for martingale, when this number has reached it will not place any more orders until closed orders either hit tp or in case of one or more orders hit sl and then number of existing orders changes so it will place orders upto this limit.

extern int PointsAfterDistance = 400; // After the initial order is placed, if the price is going away from tp and this distance has reached, the martingale order will open. this martingale order will not open if the market has gone away from the tp and then coming back, all subsequent orders will have minimum PointsAfterDistance between them, it could be more, but not less than this. If this distance has reached, the order will wait for the new bar to open even if the distance has increased. The ea will make sure all orders follow relevant magic sell/buy numbers and their original type it should not interfere or be interrupted by any other ea's magic numbers All subsequent martingale order should follow the original order type, for example if original order is buy, the 2nd and subsequent orders should be buy and same for sell orders. BarTrade = true/false - if true it will place order only in the first minute of bar and if false, it will place order at any point when conditions are met (for example if placed on 1hr chart and conditions are met it will place order between 07:00:00 - 07:00:59)


Overview and Explanation:

This Expert Advisor is to be designed to trade based on an RSI under/oversold with an integrated Martingale Strategy. The key features include dynamic adjustment of Take Profit (TP) levels, flexible trade placement rules, and strict adherence to the original order's direction (buy/sell). Below is a brief summary of the functionality, followed by clarifications of each parameter.

Summary of the EA Functionality:

  • Initial Trade Conditions: The EA places an initial buy or sell order based on the Relative Strength Index (RSI) indicator's thresholds. It monitors the RSI level against user-defined upper and lower limits.

  • Martingale Strategy: If the price moves against the initial trade by a specified distance ( PointsAfterDistance ), the EA places additional trades in the same direction as the initial trade, increasing the lot size by a multiplier ( MartingaleFactor ).

  • Dynamic TP Adjustment: When a new Martingale order is placed, the EA adjusts the TP for all open orders of the same type (buy or sell) to a unified TP level. This level is recalculated based on the latest order's price.

  • Order Management: The EA continues placing Martingale orders until the maximum number of trades ( MaxTrades ) is reached. It only opens new orders if the market conditions meet the specified criteria, and orders are placed within the allowed trading hours.

  • Bar Trading Mode: The EA can be configured to place orders only at the beginning of a new bar or immediately when conditions are met, depending on the BarTrade setting.

Clarifications of EA Parameters:

  1. TakeProfit (TP):

    • First Order: The TP for the first order is placed based on this value.
    • Martingale Orders: When subsequent Martingale orders are placed, the EA adjusts the TP of all open orders of the same type to a single, unified TP level. This ensures that all trades close simultaneously if the price reaches this level. If an order is manually closed, the EA will recalculate and adjust the TP for the remaining orders accordingly.
  2. StopLoss (SL):

    • Each order has its own SL based on the StopLoss value provided. The SL does not change after the order is placed and is independent for each trade.
  3. InitialLots:

    • This parameter defines the lot size for the initial trade. Subsequent Martingale orders will increase the lot size based on the MartingaleFactor .
  4. MartingaleFactor:

    • The lot size of each Martingale order is multiplied by this factor relative to the previous order. For example, if InitialLots is 0.03 and MartingaleFactor is 2, the lot size progression will be 0.03, 0.06, 0.12, etc.
  5. MagicNumberBuy & MagicNumberSell:

    • These are identifiers to differentiate buy and sell orders placed by the EA. The EA ensures that it only manages orders with these magic numbers and does not interfere with other EAs or manual trades.
  6. StartHour & EndHour:

    • The EA will only place trades between these hours. This ensures that the EA operates within a defined trading window.
  7. RSI_Period, RSI_Upper, RSI_Lower:

    • The EA uses the RSI indicator with the specified period to determine the initial trade. If the RSI crosses above the RSI_Upper , a sell order is placed. If it crosses below the RSI_Lower , a buy order is placed. Martingale orders do not rely on the RSI but are based on price movement away from the initial order's TP.
  8. MaxTrades:

    • Limits the maximum number of trades (buy or sell) the EA will open in a Martingale series. Once this limit is reached, the EA will not place any more orders until one or more existing orders are closed, either by hitting the TP or SL.
  9. PointsAfterDistance:

    • Defines the minimum distance (in points) from the initial order’s TP where a Martingale order will be triggered. The EA waits for a new bar to open before placing the Martingale order, ensuring that trades are not clustered too closely.
  10. BarTrade (true/false):

  • true: The EA will only place orders in the first minute of a new bar (e.g., between 07:00:00 and 07:00:59 on an H1 chart).
  • false: The EA will place orders immediately when the conditions are met, regardless of the time within the current bar.

Additional Considerations:

  • Manual Order Closures: If an order is manually closed, the EA will recalculate the TP for the remaining open orders to ensure they are aligned with the latest market conditions.
  • Trade Type Consistency: Martingale orders will always follow the direction of the initial trade. For example, if the first order is a buy, all subsequent Martingale orders will also be buys, and the same applies to sell orders.

NOTES:

Ideally the code needs to be less than 400 lines no mored than 500 lines, this is an experimental ea and any comments in the code would be appreciated. 

The code will be tested on real market as well as demo. I have made a code through AI which works fine except it just stops sometimes and doesn't work. I would rather pay someone to code the above for me than just use AI to generate the code as there's always something wrong with AI generated codes. 

応答済み

1
開発者 1
評価
(83)
プロジェクト
92
35%
仲裁
3
0% / 0%
期限切れ
1
1%
取り込み中
2
開発者 2
評価
(20)
プロジェクト
19
11%
仲裁
2
50% / 50%
期限切れ
0
3
開発者 3
評価
(53)
プロジェクト
76
14%
仲裁
3
33% / 33%
期限切れ
7
9%
取り込み中
4
開発者 4
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
仕事中
5
開発者 5
評価
(24)
プロジェクト
31
16%
仲裁
7
29% / 43%
期限切れ
4
13%
仕事中
6
開発者 6
評価
(28)
プロジェクト
34
15%
仲裁
5
40% / 60%
期限切れ
5
15%
仕事中
7
開発者 7
評価
(42)
プロジェクト
88
14%
仲裁
30
30% / 57%
期限切れ
36
41%
仕事中
8
開発者 8
評価
(126)
プロジェクト
160
42%
仲裁
20
60% / 20%
期限切れ
9
6%
9
開発者 9
評価
(1)
プロジェクト
1
100%
仲裁
0
期限切れ
0
10
開発者 10
評価
(3)
プロジェクト
3
0%
仲裁
0
期限切れ
0
仕事中
11
開発者 11
評価
(143)
プロジェクト
255
35%
仲裁
12
25% / 58%
期限切れ
42
16%
仕事中
12
開発者 12
評価
(10)
プロジェクト
15
27%
仲裁
3
67% / 33%
期限切れ
0
13
開発者 13
評価
(61)
プロジェクト
188
73%
仲裁
4
100% / 0%
期限切れ
1
1%
14
開発者 14
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
15
開発者 15
評価
(35)
プロジェクト
64
22%
仲裁
10
0% / 60%
期限切れ
18
28%
類似した注文
Fx Kidds 80 - 120 USD
Can l have a EA that can run 24/5 on gold and GBPUSD and stocks. Trilling stop loss. No expireing date. Must make 5% minimum in returns. It can take losses but it must not blow the account minimum deposit must be 35usd
200 pip EA 100 - 200 USD
I require an EA that can deliver on a consistent basis 200 pips per month. The EA must do this with the money management setting where 1 pip = 1 USD
Hello All , Please Create API Bridge MT4 To Web Terminal on Priority basis. MT4 EA to below platform all details shared. https://trade.ivt-markets.com/trade/placeorder.php?type=market&amp ;bs=buy&lot=0.1&sl=111&target=222222&symbol=X:BTCUSD&token=XXXXXXXXXX&clicked=yes 1. MT4 To Web Terminal Api Needed
1st Scenario: 4-Candle Setup (Breakout and Retest) Step 1: Breakout Candle: The price breaks above the EMA 50. Step 2: Retest Candle: After the breakout, look for a bearish (red) candle that touches the EMA. Step 3: Entry Candle: Identify a bullish (green) candle that closes above the EMA. Step 4: Trade Candle: Enter the trade when the price crosses 2 pips above the high of the bullish entry candle. RSI Confirmation
99% quality backtests required for Atreyu EA (MT4). For two set files which are in the comments section of the Atreyu page ( Buy the 'Atreyu' Trading Robot (Expert Advisor) for MetaTrader 4 in MetaTrader Market (mql5.com) ), in addition optimization and resp. backtest results required. H4 timeframe, as far back as you can. Pairs: eurusd, eurcad, usdcad, audnzd
required a bot based on ict ,smc technique order blocks fvg liqidity voids liquidity sweep break of structure eqal low and equal high momentup setup trend recogonsation kkldnvksldnvksdnvlkdsnvlkdsnvlksndlkvnsdklvnlskdvnlksdnvsdvmsldkmv lksdnvlksnl knsdkl nsdlkv sdlkv mslkn vlskdm lksm ,v njdfnv lkjdfnvlkmfsn lfn kdfm vfmmvlkmvlksdmv
Develop a robot for Mac M3 chip which can: 1) Auto copy - take and close trades 2) Minise risk 3) Scale profits 4) Ideally be able to trade in multiple markets or whichever market can bring plenty of trading opportunities. 5) Can be used on mobile (iPhone) and Mac. You can implement it on MT4 or MT5 - whichever will integrate with the robot better. You can use any programming language so long as it serves the
i want to add some feature in my current ea very quick work i need very quickly my ea will start when market run or drop .....for example 100. pip second Lot increasing system in %form for example in 1% lot will increases previous lot with 1% or trailing stoploss system in % market from high
I am looking for an experienced MQL5 programmer to create a custom Expert Advisor (EA) or utility that connects my MT5 signal provider to Telegram. The primary objective is to forward signals from the MT5 platform to a designated Telegram channel. Requirements: The EA or utility should automatically send signals from MT5 to the Telegram channel/group. Support for customization, such as filtering signals based on
Trade methodology based on Red and Green lines entering Overbought / Oversold zone. Using confluence of Higher time frame, Moving Average a trade can enter when there is a strong slope angle. Market Base Line is used to determine overall market sentiment. TDI indicator uses TDI Main and TDI Signal line to generate trades. These two values must cross. The slope measures the Current and Previous values of TDIMain. User

プロジェクト情報

予算
70+ USD
締め切り
最低 3 最高 5 日

依頼者

(1)
出された注文4
裁定取引数0