Position size relative to account size
Forums › ProRealTime English forum › ProOrder support › Position size relative to account size
- This topic has 15 replies, 6 voices, and was last updated 3 months ago by pabo_swe.
-
-
05/05/2024 at 10:09 AM #232331
Hi you all good programers.
I want to buy n contracts that will require x % of my account in security.
As every trade will change my account up/down then I still want next trade to require X % of that new account size as security.
By doing this I hopefully get my account growing even faster😁
05/05/2024 at 12:56 PM #23233505/05/2024 at 1:48 PM #23233605/05/2024 at 2:23 PM #232337buy n contracts that will require x % of my account
Could work if use xamount allocated to any particular Algo then use strategyprofit (after each trade) to increase or decrease this xamount accordingly.
05/05/2024 at 2:28 PM #232338Hi
I’ve got this far but I want to take it a step further but I need some help!!
STARTINGCAPITAL = 1000 //1k €
SIZE = 1 / STARTINGCAPITAL //divide your initial contract size by startingcapital
CAPITAL = STARTINGCAPITAL + STRATEGYPROFIT //current capital
K = CAPITAL * SIZE //calculate position size
positionsize=K05/05/2024 at 2:55 PM #232339Could work if use xamount allocated to any particular Algo then use strategyprofit (after each trade) to increase or decrease this xamount accordingly.
Plus a lot of coffee to restart each of those algos at the moment it finishes a trade, put the new total accumulated value in that xamount variable and …
Can’t work.
Better buy and sell coffee and have it too ? … that also can’t work. 🙂05/05/2024 at 3:10 PM #23234005/05/2024 at 3:27 PM #232341Hi,
Assuming you’re not trying to find a way around getting access to other codes gains/losses to include in contracts size calculation (can’t see any to this day), then when using only gains/losses of considered code, maybe Roberto’s lines 1-16 in following post might be what you’re after?
https://www.prorealcode.com/topic/reinvestissement-des-gains/#post-199841
05/05/2024 at 3:29 PM #232342Anyway what Instrument are you trading OMXet?
All my codes buy x Contracts not a cash amount so surely you need, for example, 0.2 £1 Contracts on DJI = £8K.
Or do you want code working at required margin cost (not full contract price)?
Few things to think about before a kind helpful coder spots this thread.
05/05/2024 at 5:08 PM #232346Hi
I trade NASDAQ Tech100.
My intention was to trade each trade at a level X contracts that will require 50% of my account for security. That will generate a nice leverage. I have done that manually this year and it has really worked nice ;>))) As some days I hit 0.5% movement then it generats 5 % to my account!
All of your answers are of interest but somehow I feel you don’t quite understand what I mean. Or maybe I’m just not good enough for programming = I’ll have to stick to the manuel trading.
05/05/2024 at 5:41 PM #23234705/05/2024 at 5:55 PM #232348Hi GraHal
Yep, my mistake. I obviously took that for granted. I have two accounts at IG, one for autotrading/only 1 algo, and the second for manual trading.
BTW: This year algo going down and manuel +xxx% ;>))….e.i. much work/time spent but rewarding
05/05/2024 at 6:07 PM #23234905/09/2024 at 7:45 PM #232519Ther is no way to use you total account, but you can use the command stratergyprofit so incresee your positions. I made a code for just this some time ago 🙂
IF STRATEGYPROFIT[1] < 100 THEN
XX = 10
ELSE
XX = ROUND(STRATEGYPROFIT[1] / 100)
ENDIFIF XX < 10 THEN
XX = 10
ENDIFXX is number off contract and 100 is the amount off profit needed before it adds to XX, and do so by devide the total profit and round it to closes even number.
I trade on IG markets and in this case 100$ is just over the margin i need for 1 contract.
09/17/2024 at 9:15 PM #237734A while back I wanted a MM method that was more risk based, and if you ask me I ended up with this smart little script 😉
The thesis was that I only wanted to risk 1% of portfolio per trade, (if account is not too small and minimum trading size makes the risk higher). So based on my StopLoss, the script decide position size…
and when position size is bigger than 10 contract, I stick to full contracts.
enjoy!
MM in risk perspective123456789101112131415161718192021// STRATEGY SETTINGSMMactivate = 1MMstartCapital = 3000 // Account size in asset currency, during start of algoMMriskPercent = 2.0MMminPosSize = 1mySL = 0.360 // in percent// MONEY MANAGEMENTIF MMactivate THENpositionSizeMM = ((MMriskPercent / 100) * (MMstartCapital + strategyProfit)) / (MySL/100*close) / pointsizeIF positionSizeMM < MMminPosSize THENpositionSizeMM = MMminPosSizeENDIFIF positionSizeMM > 10 THENpositionSize = ROUND(positionSizeMM,0)ELSEpositionSize = ROUND(positionSizeMM,1)ENDIFENDIF -
AuthorPosts
Find exclusive trading pro-tools on