Simple Martingale Based EA

MQL4 Experts

Job finished

Execution time 7 days
Feedback from customer
Amazing Service
Feedback from employee
Thanks a lot!

Specification

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. 

Responded

1
Developer 1
Rating
(369)
Projects
458
55%
Arbitration
24
58% / 17%
Overdue
31
7%
Working
2
Developer 2
Rating
(22)
Projects
21
10%
Arbitration
4
25% / 75%
Overdue
0
Free
3
Developer 3
Rating
(111)
Projects
184
25%
Arbitration
25
16% / 76%
Overdue
16
9%
Free
4
Developer 4
Rating
(2)
Projects
2
0%
Arbitration
1
0% / 100%
Overdue
0
Free
5
Developer 5
Rating
(62)
Projects
90
29%
Arbitration
24
13% / 58%
Overdue
7
8%
Working
6
Developer 6
Rating
(50)
Projects
64
20%
Arbitration
11
27% / 55%
Overdue
5
8%
Free
7
Developer 7
Rating
(45)
Projects
91
13%
Arbitration
34
26% / 59%
Overdue
37
41%
Free
8
Developer 8
Rating
(144)
Projects
186
41%
Arbitration
24
58% / 21%
Overdue
13
7%
Free
9
Developer 9
Rating
(2)
Projects
2
50%
Arbitration
0
Overdue
1
50%
Free
10
Developer 10
Rating
(102)
Projects
105
60%
Arbitration
0
Overdue
0
Free
11
Developer 11
Rating
(162)
Projects
289
35%
Arbitration
18
22% / 61%
Overdue
43
15%
Free
12
Developer 12
Rating
(11)
Projects
18
28%
Arbitration
4
50% / 50%
Overdue
1
6%
Free
13
Developer 13
Rating
(78)
Projects
246
74%
Arbitration
7
100% / 0%
Overdue
1
0%
Free
Published: 1 article
14
Developer 14
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
15
Developer 15
Rating
(43)
Projects
73
23%
Arbitration
11
9% / 55%
Overdue
18
25%
Free
Published: 1 article, 1 code
16
Developer 16
Rating
(271)
Projects
553
50%
Arbitration
57
40% / 37%
Overdue
227
41%
Working
17
Developer 17
Rating
(298)
Projects
478
40%
Arbitration
105
40% / 24%
Overdue
82
17%
Loaded
Published: 2 codes
18
Developer 18
Rating
Projects
0
0%
Arbitration
1
0% / 100%
Overdue
0
Free
19
Developer 19
Rating
Projects
1
0%
Arbitration
4
0% / 50%
Overdue
0
Working
Similar orders
I am looking for an experienced MQL5/MT5 developer to develop a custom Expert Advisor based on a complete technical architecture already prepared by the client. This is not a request to design a trading strategy from scratch . The strategy architecture, entry/exit concepts, filters, risk-management requirements and testing requirements are already documented. The main responsibility will be MQL5 development
EAs 100+ USD
To apply, you must already have your EA running on an active MT5 trading account connected to the market. The account must have genuine trading history that can be independently reviewed and verified. EA Requirements 1. Prop-Firm Compatible Risk Management - The EA must include daily and overall drawdown protection. - Required inputs: "MaxDailyLoss = 5%" "MaxTotalDrawdown = 10%" - Once either limit is
Strategy 40 - 60 USD
yo i have a strategy i would really like to turn into a signal bot basically please this is very technical and serious to me the strategy needs more time 1 time frame and the bot most be 100% accurate
Ready to use bot 100+ USD
seller must provide the following to be considered... i will answer to all who fit this description, and can purchase more than 1 EA... - brief strategy description - overall EA expectancy - 1 week limited trial version, with whatever settings you consider best (can be blocked on demo, i don't really care) - investor password from a reputable broker (if history is available... live / demo, same thing, doesn't really
I want you to develop a professional HFT trading robot for MT5/MQL5 , initially focused on XAUUSD . The robot should be designed for high-speed tick-level trading , analyzing real-time bid/ask movement, spread, tick velocity, momentum, volatility, price acceleration and short-term market microstructure to identify very short-term opportunities. The core strategy should be capable of opening 5–10+ positions in a
can you help me use a Tickblaze Algo NRBO on the NT platform? I have it somewhat set up, but I have other questions about running it & knowing how to operate it in NT. Thank you if anyone have experience in this kindly bib and let do it asap
I need a fully automated custom Expert Advisor for MetaTrader 5 (MQL5). The EA is intended for use on a The5ers $100,000 2-Step prop-firm account. IMPORTANT DELIVERY REQUIREMENT: I must receive the complete editable .mq5 source code as well as the compiled .ex5 file. Compiled-only delivery is NOT acceptable. The EA must be coded specifically for this project and must not copy trades, use external trading signals or
I've got a Pine Script from Trading View. I need help from a programmer who can help with optimising the strategy by 1) Adding a couple of further rules 2) Redesign the trading alert arrows & colours I need, please, a programmer who is 1) Good at Pine language 2) Has excellent after-job support (not for free though) 3) Possess the ability to work with others. 4) Able to deliver the job at the shortest possible time
I need an experienced TradingView Pine Script developer to build and test a custom intraday strategy for NQ/MNQ . I am not looking for a conversion . I need the strategy researched, developed, tested, and optimized based on my requirements. Requirements: NQ/MNQ intraday trading 5–15 minute charts New York session only Flat before market close Base logic using Zero Lag Signals , with additional filters if justified
Le robot devra : Respecter strictement les règles de risque des comptes FTMO : perte journalière maximale, perte maximale totale, taille des positions, etc. Intégrer un système de gestion du risque automatique. Être capable de gérer différents types de comptes et tailles de capital. Être basé sur ma stratégie et mes règles de trading que je fournirai au développeur. Être entièrement automatisé pour l’exécution des

Project information

Budget
70+ USD
Deadline
from 3 to 5 day(s)