I have been writing a strategy to back-test today and am getting a little stuck around the money management side with the incorrect number of shares opening for example using a 10,000 balance, 2% risk and an ATR of .912 I am expecting (RISK/ATR STOP LOSS) 100/1.824 = 548 shares. When backtesting though the position size taken is much larger.
Money Management
From a money management view I am trying to size positions based on a percentage of my account:
Example Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Parameters
RISK=2
EQUITY=CAPITAL+STRATEGYPROFIT
RISKCALC=(EQUITY/100)*RISK
ATR=AverageTrueRange[14](close)
ATRSL=(ATR*2)
// Oreder Management - Shares to Purchase
//POSITIONSIZE= RISKCALC/ATRSL
// Open Long Position
IFNOTLongOnMarketANDc1THEN
BUYPOSITIONSIZESHARESATMARKET
ENDIF
Position Accumulation
I am looking to add to a position where a condition has been met, marking a Flag to signify if the original position has already been added to. It currently does not look to add to an existing position.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue