Having built many systems that use a flat contract size ive now started to look at building systems that remain fully invested and have hit a stumbling block . So far i have come up with what i think is the correct code to acheive this but i need some help identifying the right terms that PRT will identify
My code thus far would look like this
//automated contract number
n = INITIALCAPITAL/close
w = STRATEGYPROFIT
c = Close x = n + w/c
‘x’ will be the number of shares/contracts traded . Strategyprofit is recognized fine but i am yet to find the correct term for initial capital thats identified correctly by PRT
Appreciate any help Regards and thanks Pete
x = TOTALEQUITY/close
The other alternative is to make x = TOTALEQUITY/close but once again im struggling to find the term that PRT uses . I’d prefer to use the first code sample if possible but either way id love to know the terms for both initialcapital and totalequity
Sorry how messy this all looks , please forgive me as im new to posting code in here .. Thanks
Having built many systems that use a flat contract size ive now started to look at building systems that remain fully invested and have hit a stumbling block . So far i have come up with what i think is the correct code to acheive this but i need some help identifying the right terms that PRT will identify My code thus far would look like this //automated contract number n = INITIALCAPITAL/close w = STRATEGYPROFIT c = Close x = n + w/c ‘x’ will be the number of shares/contracts traded . Strategyprofit is recognized fine but i am yet to find the correct term for initial capital thats identified correctly by PRT Appreciate any help Regards and thanks Pete
//automated contract number
n = INITIALCAPITAL/close
w = STRATEGYPROFIT
c = Close
x = n + w/c
I must be missing something. If your variable INITIALCAPITAL is what it seems to be i.e. your initial starting capital then you know that number so you can just assign it to the variable e.g. INITIALCAPITAL = 5000?
I must be missing something. If your variable INITIALCAPITAL is what it seems to be i.e. your initial starting capital then you know that number so you can just assign it to the variable e.g. INITIALCAPITAL = 5000?
I realise that and thats what i have been doing but due to the fact i do a lot of testing and use a lot of different testing on varying %ages of capital Id like something that does the job ‘ automatically ‘ if possible . Thanks for pointing out what i already knew …
Hi
Please find a code for position sizing for 1% risk of initial and 3% of risk of market money (=strategyprofit)
equity=10000+3*STRATEGYPROFIT
risk=0.01
TF=4
DailyRange=max(abs(Dhigh(1)-Dlow(1)),max(abs(Dhigh(1)-Dclose(2)),abs(Dlow(1)-Dclose(2))))
DailyATR=wilderaverage[20*TF](DailyRange)
PositionSize = round((equity*risk)/(DailyATR*pointvalue))
There is an interesting book on position sizing
Van Tharp’s : Defenitive guide to position sizing
If you want to manage % stop loss of position with 1% of your equity risk
equity=10000+3*STRATEGYPROFIT
risk=0.01
strategyrisk= 2 //percent
PositionSize = round((equity*risk)/(close*pointvalue*strategyrisk/100))
set stop %loss strategyrisk
Thanks Yannick appreciate that , will definitely use that
Hi Yannick, the first example from Van Tharp looks great, the second one doesn’t look right to me for setting the stop loss. If the intention is to place the stop loss to allow no more than 2% of your equity to be at risk then it should be based on 2% of the equity in a similar way to the way the position size is calculated. The attachments show 2 very different outcomes for 2 ways of setting the stop loss and you can see that %ploss is related to the size of the total position size, the HS is at about 29000 currently so 29000/50 = 580 is about the level of stop loss being set.