Hi,
I would like to take a positionsize of 1% out of total equity in every trade, how would a code look to define that in a strategy?
How would the code look if the system takes a positionsize of 1% of initial capital?
Best regards,
Sebastian B
Do not double post. Ask your question only once and only in one forum. All double posts will be deleted anyway so posting the same question multiple times will just be wasting your own time and will not get you an answer any quicker. Double posting just creates confusion in the forums.
Thank you 🙂
CAPITAL = XXXXXXXX//Your initial Capital
OPPERC = 1 //Percent of your equity you want to use in each trade
POSITIONSIZE = (CAPITAL+STRATEGYPROFIT)*(OPPERC/100)/CLOSE
IF.....(condiciones de compra)
BUY POSITIONSIZE CONTRACT AT MARKET
ENDIF
Please take into consideration:
- If the active is in a different currency that your “CAPITAL” it won´t work properly
- The Equity (CAPITAL+STRATEGYPROFIT) is calculated for each system you operate, I don´t think is possible to do it for your whole equity from all your systems
Good luck
Thanks for the help!
Best regards,
Sebastian B