Code a function that returns the correct lot size basing on two inputs: stop loss and balance to risk

Experts Bibliotecas

Trabalho concluído

Tempo de execução 11 dias
Comentário do cliente
_Techno_ did a great job that no one else on the Forums was able to do. He is a real pro and the code delivered works perfectly and with any broker and is easy to read and as optimized as it can get. Communication was always prompt and on time and very professional and friendly as well. I can highly recommend him!

Termos de Referência

Hello Coders,

I am looking for a function (not a complete EA, but a function that I can use from any of my EA´s that I code) that I simply can call like:


Lotsize = ExampleLotFunction(BalanceToRiskInPercent, StopLossPrice);

so for example with values:

Lotsize = ExampleLotFunction(2, 1.23456);


... and it returns the correct lot-size to risk exactly 2% of my current Account balance in my base-currency with the StopLoss passed to it and taking into account the account-base-currency and ANY conversions needed of course if the pair I trade is not in the account-base-currency (example: trading the AUDNZD on a account with the base currency EUR). I have found code on the forum that does work correctly if my account-base-currency is included in the pair that I trade (example: EUR is the account-base-currency and I trade EURUSD), but none yet that calculates correctly if trading AUDNZD, GBPCAD, NZDJPY or whatever and my account-base-currency is in EUR. Hence this request here in the hope someone can finally code something like this for me:)

The code should be of good quality and just be in a simple complete function so that I can use it for any of the EA´s I will be coding in the future without creating a mess and just should take those 2 input variables: Percent of current account balance to risk for the current trade by taking into account the stop loss I´ve passed to it.

Of course it should also be highly adaptive and should have no hard-coded constraints, meaning that it should adapt to different account-base-currencies, 4 and 5 digit brokers, check for the correct lot-step, lot-min and lot-max, etc. etc. Just what a professional function requires.

Thank you:)


P.S.: IMPORTANT: THS IS FOR MT4, not MT5 !


Respondido

1
Desenvolvedor 1
Classificação
(473)
Projetos
1138
44%
Arbitragem
51
31% / 33%
Expirado
500
44%
Livre
2
Desenvolvedor 2
Classificação
(187)
Projetos
367
56%
Arbitragem
45
22% / 56%
Expirado
188
51%
Livre
3
Desenvolvedor 3
Classificação
(24)
Projetos
98
83%
Arbitragem
4
0% / 25%
Expirado
9
9%
Livre
Pedidos semelhantes
Preciso de um EA que abra ordens a mercado a partir de um indicador, Ele precisa obter take e stop loss fixos, spread máximo, horários de início e final das operações, meta e stop diário, martingale, painel e a função no script para que eu possa ceder o EA apartir do id do mt4 de terceiros
Hello Investors, I'm selling a profitable and stable expert advisor trading on the Gold (XAUUSD) pair using a cutting-edge scalping strategy. The EA is able to generate a stable monthly income without using martingale strategy, and with an optional cut loss in place. Particularly the average monthly gain can go from 2-3% (at a relatively low risk, with an historical max DD of 6%) to 20-30% (with an aggressive style
Hello, I have a strategy and I need a very good programmer who will create me an exprt or make me an indicator that will open positions for buy/sell limit (see picture below). The indicator/Expert will have to open positions (buy/sell limit) regarding the strategy and indicators (I will explain it more in collaboration). Below I will give pictures of what I mean. I will send a link to the telegram group where it
Atomic Analyst Indicator to EA. I have an mt4 indicator called Atomic Analyst. The indicator gives buy/sell signals as shown in the screenshot. I want to know if you can take this indicator, and create an EA that automatically takes the signals. The indicator puts in the SL and TP1, TP2, TP3, TP4, TP5 automatically. I would like the option to put in my lot size parameter and I would also like an automatic trail stop
can you help me with Ctrader i need modification on the linkhttps://docs.google.com/document/d/1fggk49xWbnwahtfOlE-U7G6muZB1FT8eWmftGiY7R-s/edit?usp=sharing can you assist with cTrader modifications to enhance functionality and improve performance. do text me if you a professional on it i will be looking forward to your response best regards
MT4 Expert Advisor 30 - 120 USD
EA sittings The EA utilises the concept of grid and hedging by creating a zone for recovering losing trades It is a continues trading EA without any stop loss. The EA initially aims to trade continually without the need to hedge. The EA enter the first trade following the direction of the moving average (when price is above or below the moving average), and only hedge when, the trade goes against the trend and reach
Would I honestly need is someone who can make a profitable EA for me that can at least make me around $80 a day starting with $50 and the EA must be able to work with exness the EA should automat trades 24/7. Broker = Exness Pairs = USD/JPY XAU/USD and etc Chart time frames = M1 M15 History = last month till last 6 months. Lot size 0.10 take profit at $2 stop
Hello i am seeking a skilled MetaTrader 5 (MQL5) developer to modify an existing Telegram signal copier. The goal is to enhance the copier's functionality, reliability, and user experience. kindly bid this job to get started immediately
Hello, I’m looking for assistance with creating or customizing a TradingView indicator to suit my trading needs. If you have experience in this area, please reach out. Your help would be greatly appreciated. Thanks
# MT4 Expert Advisor Development Rules ## Time Period Definition 1. Allow user to define a specific time period (e.g., 10:00 to 15:00). 2. Identify and store the high and low prices within this period. ## Price Breakout Detection 3. Monitor current price for breakouts above the period high or below the period low. ## Signal Confirmation (signals will be taken on m5 timeframe) 4. After a breakout, wait for a signal

Informações sobre o projeto

Orçamento
10 - 30 USD
IVA (19%): 1.9 - 5.7 USD
Total: 11.9 - 35.7 USD
Desenvolvedor
9 - 27 USD