As you know, when trading on the Forex market, unprofitable trades are inevitable. You need to know in advance how much you can lose with each trade. It is highly undesirable to open a position with a trading lot selected at random, so you need to know the size of the risk in the percentage of the deposit. In conservative trading, we recommend placing a risk value of 1-3 on a trade, this rule has repeatedly saved our accounts from a complete loss.
Your attention seems to be a very simple script, the purpose of which is to correctly and quickly calculate the trading lot of the future order depending on the currency pair, the volume of the tick and stop Loss.
|The size of The Loss Stop in old paragraphs
|Risk percentage per trade
An example of how the script works:
Suppose we want to open a deal with Stop Loss equal to 100 old items. We are not willing to risk more than 1 of the deposit on this transaction. We set the script for a pair of GBPUSD (the cost of the tick is 1 for ease of calculation) and get a message:
With a balance of $4000, the script calculated our trading lot, it is 0.04. Let’s check on the calculator:
(Balance * Risk Percentage / 100) / Stop Loss in New Items/Cost tick.
(4000$ * 1 /100) / 1000 / 1 = 0.04
As you can see, it all fits together.
Simplicity is the key to success!