EA to switch between 2 symbols according to trading parameters (with code for MT4 & MT5)

MQL5 エキスパート

仕事が完了した

実行時間60 日
開発者からのフィードバック
Even we done this project in a long time, I am grateful for great ideas and nice communication. I hope catch his future jobs too :)
依頼者からのフィードバック
Mohammad is BY FAR the most talented programmer I hired so far. He contributed with original solutions to problems that had long troubled me. Great communication, definitely a long-term partnership.

指定

GENERAL IDEA
-- we specify 2 symbols (ex. input symbol 1 = Microsoft & symbol 2 = Apple);

-- we specify input initial amount to trade (ex. $10,000);

-- we specify the interval at which the EA will check the trading conditions (ex. input interval_X = 10M)

-- we specify the trading parameters (ex. input conditions X = 1.0%; & Y = 1.5%)

ACTIONS:

1) UNIQUE ACTION = FIRST BUY:

-- if there is no open position by this EA, immediately buy X shares (= lot1) of symbol 1 at current ask_price (using the initial amount to calculate the lot);

-- register the quotes of BOTH symbol_1 & symbol_2 at the time of the transaction (let's call the "LAST-TRADE-QUOTE-1 & LAST-TRADE-QUOTE-2): those values will be used for trading condition X.


2) REGULAR/REPEATED ACTIONS: (obs. after the first buy, there'll always be an open position)

at every interval_X, check which symbol is the current open position;
-- if symbol 1 is current position, check if condition_X or condition_Y is true
  -- if symbol 1 is current position & (X or Y is true) --> sell symbol 1 

-- use the money from the sell to calculate lot2 (# of shares) --> buy  symbol 2

-- register quotes of both symbols (last-trade-quote-1 & last-trade-quote-2);


-- if symbol 2 is current position, check if condition_X or condition_Y is true
-- if symbol 2 is current position & (X or Y is true) --> sell symbol 2

-- use the money from the sell to calculate the new lot1 (# of shares) --> buy  symbol 1;

-- register quotes of both symbols (last-trade-quote-1 & last-trade-quote-2);

Bottom line:

-- after the first buy, there will always be an open position;

-- the EA will check the trading conditions: if they are true, sell symbol 1 & buy symbol 2 (or sell symbol 2 & buy symbol 1);

-- repeat the process at the defined interval

==============

GENERAL IDEA WITH MORE DETAILS: 

An important part of this EA is the "dynamic calculation" of the lots, meaning: after we close a position, the money generated by the sell of symbol_1 (or symbol_2) will be used to calculate how many shares we can buy of symbol_2 (or symbol_1). 

I think this can be achieved with the use of the following variables: 

double BUYMONEY (the available money to make the buy), SELLMONEY (the money generated by the sell), STANDBYCASH (the money not used in the buy after rounding down to min-lot). 

As there is a MIN LOT requirement, we never use the total amount of available money. We'll call this the STANDBYCASH. 


1) calculating the STANDBYCASH
let's say we have 10,000 to start with and Microsoft is $98. 
let's say the MIN-LOT = 1.0. 
so we could buy 102 shares of Microsoft. 
now: 102 lots at $98 = $9,996, which means that $4 are not used: that's the standbycash = $4
so standbycash = previous available money to make a buy (or BUYMONEY) - amount spent in the buy (which can be calculate by lot * ask.price). 

2) so, after the first buy, we will (always) have an open position.
let's say the trading conditions are true, so it's time to sell. 
let's say the bid price for Microsoft is $104. 
the amount generated by this sell (SELLMONEY) = lot1 * bid1 = 102 * 104 = $10,608 
so the new total amount available to make a buy (let's call it BUYMONEY = standbycash ($4) + sellmoney ($10,608) = $10,612
{obs. later on we can also include TRADEFEES: buymoney = standbycash + sellmoney - tradefees}
With that, we can calculate LOT2 (the # of shares of symbol_2 to be bought): 
LOT2 = buymoney / ask2 (the ask price of symbol2) (rounding to min lot). 
Let's say the ask_price of Apple is $84. 
With $10,612 we could buy 126 shares of Apple. 
Now, 126 * 84 = 10,584 meaning that we will have $28 left in the account. 
new standbycash = 10,612 - 10,584 = $28

Next time, we will sell Apple, say, at 90.

126 shares * 90 = $11,340 (sellmoney)
new buymoney = sellmoney + standbycash = 11,340 + 28 = $11,368

With that, we calculate the new lot of Microsoft to buy.
Let's say Microsoft is now $112.
With $11,364 at $112, we can buy 101 Microsoft (always rounding to min lot). 
Amount spent = 101*112 = $11,312, meaning the new standbycash = 11,364 - 11,312 = $52

And so on.

=========================

SPECIFICATIONS ABOUT THE CONDITIONS X & Y

input periods = 50;

input condition_X = 1.0%
input condition_Y = 1.5%

X1 = (bid1 / last-trade-quote-1) - (ask2 / last-trade-quote-2);  // X1 is the condition X when symbol_1 is the current/open position
X2 = (bid2 / last-trade-quote-2) - (ask1 / last-trade-quote-1); // X2 is the condition X when symbol_2 is the current/open position

Y1 = bid1 / avg1 (= average of 50 periods of symbol1) - ask2 / avg2   // Y1 is the condition Y when symbol_1 is the current/open position
Y2 = bid2 / avg2 (= average of 50 periods of symbol2) - ask1 / avg1  // Y2 is the condition Y when symbol_1 is the current/open position

if (X1 >= condition_X || Y1>= condition_Y) bool sell_1_buy_2 is true
if (X2 >= condition_X || Y2>= condition_Y) bool sell_2_buy_1 is true

===========================

Thanks

Marcos

PS. $100 is the budget for having the EA with the code for both MT4 & MT5

PS2. I have developed this myself and works well in the strategy tester, but I want/need it to be protected against potential errors.

So, the developer who accepts the job may either revise/adapt/protect the code I already have or create his own. 

応答済み

1
開発者 1
評価
(69)
プロジェクト
93
34%
仲裁
10
40% / 30%
期限切れ
5
5%
類似した注文
I have an existing MetaTrader 5 EA that requires significant improvements to its **risk management logic and trade execution** behavior. Currently, the EA executes trades without applying proper stop loss, take profit, or trailing mechanisms, which results in high drawdown and potential loss of capital. The goal is to **optimize the EA for low risk and high return**, starting with small capital (e.g., \$10, \$50
I have pine editor script I want to convert this into MT5 EA Main i want to match tv and mql5 buy and sell signal to match in trading view i use this with heikin ashi candles things to add in this but after main need to be done 1 Ea start stop time 2 Manual lot size 3 tp sl - on Ea start if i want to add separate tp for first 2 trades and after that same tp 4 halt ea and close all trades after over all daily profit
Hello Programmer! **Objective** Create an **MT4 Expert Advisor (“Monitor EA”)** that runs on a single blank chart and acts as an **execution firewall and auto-recovery controller** for all other EAs trading on the account. Because existing EAs are **not editable**, the Monitor EA will control trading by **closing and reopening charts/templates** instead of modifying EA logic. Target Platform: **MT4** Broker Type
💰 BUDGET: $2000-$4000 XAUUSD EA (Negotiable) Institutional XAUUSD EA with 20+ Systems | Sharpe 4.2+ | Quant Firm Standards DESCRIPTION I need an experienced MQL5 developer to build a professional institutional-grade EA with 20+ integrated trading systems for MetaTrader 5. CORE REQUIREMENTS: Architecture: • 20+ independent trading systems (trend, mean reversion, volatility, breakout) • ON/OFF toggle for each system
Hi , I am finding scalping Ea for Mt5 which can work on all pairs and have back tested results at least of 1 year and is currently running in Mt5 so i can login and see how it is performing who ever have message me
Strategy Name: SHA & Fast Ema Pullback for BTCUSD Scalping Indicators Used: Smoothed Heiken Ashi Candles MT5.ex5, Fast EMA, Trend Ema, RSI Filters Used: Break Even Filter, Ema Slope Filter, Day-wise Filter, Session/ Time Filter, Loss Filter Lots: Fixed Size, 50% lots booked when Risk to Reward is 1:1 Stop Loss: in Points Trailing SL: starts once Risk to Reward 1:1 is achieved Target: 2000 Pts (max) Buy Setup Ema
(15M + 1H Support & Resistance + Liquidity Wick + Trailing SL) 🎯 Objective Develop an MT5 Expert Advisor (MQL5) for XAUUSD (Gold) based on 15-minute liquidity rejection at H1/M15 Support & Resistance zones , with candle-close based trailing stop loss . 📊 On-Chart Display Detected Support & Resistance zones Trade direction Current SL & trailing level Active session 🔐 Risk Rules Only one trade per signal No
I’m looking for an experienced EA developer to develop a hedging Expert Advisor for XAUUSD , designed with the primary objective of maximizing broker commission rebates while maintaining overall account profitability . The EA should: Trade XAUUSD only Use a hedging strategy (frequent buy/sell positions) Be optimized for high trading volume to “milk” broker commissions Still aim to keep the net account profitable or
1.Session high low will use GMT time as range. I am not sure how the EA will handle the DST. When GMT+1 is xx:00 - xx:00 When GMT is xx:00 - xx:00 above is Asia range. When GMT+1 is xx: 00 - xx:00 When GMT is xx:00 - xx:00 Above is London range. Entry windows one for London Session and one for NY Session Emas for bias Fractals indicator for invalidation We will discuss more later
Hello all developers! I need a profitable EA ready made, I am paying good, but only serious offer please. In first message please send me backtesting resaults and demo version. If you will not do this your application will be rejected, no exceptions. Source of code of course required

プロジェクト情報

予算
60 - 100 USD
締め切り
最低 1 最高 7 日