Hi guys, I would like to know If and how it’s possible to set a target profit or a stop loss based on a certain percentage of the position size.
For example, on a system that has 100 euros positions, I would like a 20% target profit and a 10% stop loss based on those position sizes.
Thanks.
Using the symbol % with PROFIT and LOSS ensures your profit or loss is a percentage of the price, no matter whether you traded 1, 2 or 100 lots.
If you are trading something having a value of € X you first have to compute the value of your positions with:
TradedValue = pointvalue * abs(countofposition)
TradedValue is the value for each pip/point.
If that value is, say, € 1, you need to set a stop loss of 10 pips to risk € 10 and twice that as your target.
The fact is that i would like to have a method in order to standardize sl and tp for every assett on which i use an unique strategy.
The tradedvalue it would be different between two different assets (as well as sl% and tp%), and so i have to optimize values in order to achieve the same result (i.e. 20%)
For that i thought to a margin based solution (of course using the same margin amount for every assett)
Is there a solid way to standardize it?
Searching for MONEY you can find many code snippets, strategies and examples worth while reading.
You can start from this one https://www.prorealcode.com/blog/learning/money-management-prorealtime-code/.
At the end i decided to manually find a solution, supposing that i run a system on two different assets, i put at first the same position size:
Assett 1: 1.5 contracts= 1100$
Assett 2: 3.5 contracts= 1100$
Then simply
set target $profit 220
set stop $loss 110
Which is 20% and 10% of the margin.
Then i just have to manage the number of contracts in order to have it fixed around 1100€ considering price changes of the assetts through weeks and market movings.