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%
空闲
相似订单
XAUUSD Scalper M1 30 - 100 USD
I want XAUUSD scalping bot it works on strong support and resistance.Put pending BUY SELL orders at S&R levels. Adding some basic inputs TP,SL,Trailing.If you have similar EA share demo file in personal chat.if results satisfy with my expectations i will proceed with same EA any modifications if required
1 indicator SATV Final Work a. Symbol Name b. If Last Candle is Blue Then scanner Box Colour is Blue If Last Candle is RED Then Scanner Box colour is RED c. Live Price d. IF price is cross strong Buy or strong sell showing only For Buy/Sell and Candle low / High showing price 2 Bhav Copy Input field for 1-12 month If I want 5 Month back open Bhav & 1 Year 3 Moving Average Average Line price If Live price below to
It's a ninjacators.com indicator they offered at one time but no longer appears on their website. It's called the "Emini Predictive Trader" - based on tracking the three major indices - NYSE, DOW30, and NASDAQ - and suggests long or short entries if/when all three indices "agree". Would work well to trade the S&P500. I copied their original pitch page while it was up, along with the video that was on it. I'll attach
i NEED SOMEONE WHO CAN HELP ME CREATE A BOT THAT EXECUTE AND CLOSE TRADE AUTOMATICALLY ONLY FOR GOLD (XAUUSD) . A BOT THAT DOES NOT TRADE THE NEWS BUT ONLY TAKE TRADE ON ITS OWN AUTOMATICALLYON A NORMAL TRADING DAYS , I DONT MIND IF YOU ALREADY HAVE ONE THAT YOU ALREADY CREATED BUT TRUST AND HAVE A GOOD PERCENTAGE WIN RATE . I WANTS A BOT THAT USES (SL & TP) ON ITS OWN , OPENING AND CLOSES TRADE AUTOMATICALLY WITHOUT
Busco programador para crear un bot de trading automático. El bot operará en opciones binarias en Nadex, basado en la relación entre dos índices. La estrategia completa será entregada por privado al programador que acepte el trabajo. Requisitos: • Operación automática con delay configurable. • Entrada basada en datos de otro activo. • Personalizable en cantidad, expiración y lógica. • Código fuente incluido
Hello, I'm currently seeking a skilled and reliable MQL4 developer to assist in modifying and enhancing my Expert Advisor, Reversal Master V10.1 , to its next version V12.1 FF . This update involves integrating several advanced third-party indicators and implementing new trading logic based on clearly defined conditions to improve performance and strategy precision. If you have experience in EA development and enjoy
Hello, I'm currently seeking a skilled and reliable MQL4 developer to assist in modifying and enhancing my Expert Advisor, Reversal Master V10.1 , to its next version V12.1 FF . This update involves integrating several advanced third-party indicators and implementing new trading logic based on clearly defined conditions to improve performance and strategy precision. If you have experience in EA development and enjoy
Project Description: I am looking for a highly skilled MQL5 developer to create a robust solution for a persistent TLS handshake failure. My Expert Advisor (EA) needs to connect to a secure WebSocket server ( wss:// ) hosted on Railway.app or any other online websocket provider, but the connection consistently fails during the security negotiation phase. Ideal Candidate Skills: Deep expertise in MQL5 programming
I need an experienced developer to convert my MT4 EA based on the Super Trend indicator to MT5. The new EA should also include additional features. Essential modifications: - Incorporate additional indicators: Moving Average and PSAR. - Add custom alerts: Push and sound notifications. - Implement money management rules
I have a custom EA that I need optimized. I need it optimized for many pairs and the set files sent to me. The EA was created a few months ago, it works, but I need it optimized for it to run better

项目信息

预算
60 - 100 USD
开发人员
54 - 90 USD
截止日期
 1  7 天