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

Experts Libraries

Job finished

Execution time 11 days
Feedback from customer
_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!

Specification

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 !


Responded

1
Developer 1
Rating
(473)
Projects
1138
44%
Arbitration
51
31% / 33%
Overdue
500
44%
Free
2
Developer 2
Rating
(187)
Projects
367
56%
Arbitration
45
22% / 56%
Overdue
188
51%
Free
3
Developer 3
Rating
(24)
Projects
98
83%
Arbitration
4
0% / 25%
Overdue
9
9%
Free
Similar orders
If you think you can replicate EA ("reverse engineering") from Metarader's Market, and create a new EA from scratch that works 100% the same - please send an offer. I have already managed to find out many features of that EA (entry times, risk management, averaging, trailing...) but I still miss a few
Candle wick bot The bot will have a set amount of wick length to enter trade at candle open price, there will be a set Amount in points that the candle wick has to be to then enter that opposite of the wick direction Settings will look like this : Timeframe: (meaning which candles you’re using to measure open price from for the wick length ) If set to 5 min it’ll be using 5 min candles , if set to 15 it’ll use 15
Looking for a developer to create an MT4 EA based on a custom currency strength indicator and simple moving average. Will provide currency strength indicator code to the selected developer. Buy rules If the EA added in the EURUSD chart and EUR has a currency strength above or equal to 6 and USD has strength less than 2. Wait for the prices comes back to SMA and open the buy trade if the price closes above SMA. Place
I have an equity reporter. This equity reporter displays the maximum and minimum equity reached over a specific interval. So, if the interval is set to 24 hours, the script will generate data in the format: "Profit ATT" (profit AtThatTime) shows max./min. during the specific interval This specific report shows data in pips. It can also be set to display in price or percentages. The interval is also easily adjustable
Sistema HTF EFECTIVO 30 - 60 USD
Hola, me gustaría que un programador experimentado creea un sistema de trading EA que abra y cierre operaciones muy rápido en segundos (HFT). Sería óptimo tener una opción/botón para activar solo para comprar o solo para vender (operaciones unidireccionales). Con una buena interfaz gráfica de usuario. Se agradece la implementación de su propia experiencia con sistemas de trading HFT. Es para mercados volátiles como
Hello, I would like an experienced programmer to create an EA trading system which opens and closes trades very fast within seconds (HFT). To have an option/button to activate either for only buy or only sell (one way trading) would be optimal. With a nice GUI. Implementing your own experience with HFT trading systems is welcomed. It's for volatile markets such as XAUUSD or US30. Taking advantage of order placements
The strategy is a martingale type . i.e if it hits the stop loss , it will double the lot size and place again in that direction, and when it hits the take profit at any level of the martingale, it will start over from the first lot size used initially
I want you to make me an indicator in Training View. Its idea is very simple, and I want it to have an alarm. Here's a clearer step-by-step guide to checking the last 50 candles on your chart and applying Fibonacci retracement levels based on their colors: Identify Candle Color: Start from the 100th candle from the left on the chart and check its color. If the 100th candle is green (i.e., the close is higher than the
I'm looking for a developer to assist in creating an Expert Advisor (EA) for use in a prop firm. The EA should be designed for the MT4 trading platform and include the following features: Scalping strategy Maximum drawdown of 3% Please let me know if you're interested and capable of handling this project
Hello, is it possible to be made accommodation of provided signal for Forex for mt4? I bought a signal for multiple pairs. it is executing all pair.I want to use it on couple of pairs.Is it possible to be made some modifications?I do not have codes for the signal

Project information

Budget
10 - 30 USD
VAT (19%): 1.9 - 5.7 USD
Total: 11.9 - 35.7 USD
For the developer
9 - 27 USD