Hello,
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:
//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
IF NOT LongOnMarket AND c1 THEN
BUY POSITIONSIZE SHARES AT MARKET
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.
// Parameters
FLAG1 = 0
IF LONGONMARKET AND c1 AND OMFLAG1 <> 1 THEN
BUY POSITIONSIZE SHARES AT MARKET
OMFLAG1 = 1
ENDIF
Any help would be greatly appreciated.
Thank you