Money management discussion
Forums › ProRealTime English forum › ProOrder support › Money management discussion
- This topic has 6 replies, 3 voices, and was last updated 2 years ago by GraHal.
Tagged: lot, Lot Management, lotsize, LotSize Management, management, Money, money management, position size
-
-
09/30/2022 at 9:54 AM #201700
Hi,
I have been using static position size for my automatic trading for a while. As I am portfolio focused and I did not want any other system to be outscale another one in positionsize wise. But every system is not equal and performance differently ofcourse. And I want to try some MM strat and if the positionsizes gets to high I can just reset it.
So I am interested to try this MM code for my automatic trading. I have looked around the forum and this seems to be the most simple and efficient (?) one people seem to use.
MM code12345678910111213141516171819MM = 1 // = 0 for optimizationif MM = 0 thenpositionsize = 1ENDIFif MM thenMinSize = 0.2 // IG minimum position size allowedMaxSize = 1150 // IG tier 2 margin limitProfitAccrued = 0 // when restarting strategy, enter profit or loss to date in instrument currencyDD = 600 //MinSize drawdown in instrument currencyMultiplier = 2 //drawdown multiplierCapital = DD * MultiplierEquity = Capital + ProfitAccrued + StrategyProfitPositionSize = Max(MinSize, Equity * (MinSize/Capital))if positionsize > MaxSize thenpositionsize = MaxSizeendifPositionSize = Round(PositionSize*100)PositionSize = PositionSize/100endifNot all systems are equal as I mentioned and also one system is not equal for both and short. How can I split this code into short and long, is it possible?
And can the author or someone else explain the Multiplier part?09/30/2022 at 11:49 AM #201708Dp you mean you want to split STRATEGYPROFIT into two parts, Long and Short ones?
09/30/2022 at 11:51 AM #20171009/30/2022 at 12:37 PM #201712As far as I understand the multiplier is how fast the positionsize will increase, but that does not also make sense. Can someone explain that part?
Because I have some systems that trades far more long than short and viceversa. It would be nice to have a different multiplier (if I understand the correct part of multiplier it increases the positionsize faster with higher multi and viceversa with lower is that correct?)
As some systems have far more long trades it could be nice to have a higher multiplier for short BUT then the strartegyprofit must be split in two parts if that is possible. If a system is more long bias it should not have the same rules in my opinion.
10/01/2022 at 10:43 AM #20172810/03/2022 at 3:30 AM #201804There you go (tested on NASDAQ, US Tech 100 Cash 1€, 1H):
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970// split StrategyProfit into two parts, SHORT and LONG onesONCE LongProfit = 0ONCE ShortProfit = 0IF StrategyProfit <> StrategyProfit[1] AND BarIndex > 0 THENProfitto = StrategyProfit - StrategyProfit[1]IF LongOnMarket[1] THENLongProfit = LongProfit + ProfittoELSIF ShortOnMarket[1] THENShortProfit = ShortProfit + ProfittoELSEp1 = 1p2 = 2IF OnMarket THENp1 = 2p2 = 3ENDIFIF TradePrice(p1) > TradePrice(p2) THENIF Profitto > 0 THENLongProfit = LongProfit + ProfittoELSEShortProfit = ShortProfit + ProfittoENDIFELSIF TradePrice(p1) < TradePrice(p2) THENIF Profitto < 0 THENLongProfit = LongProfit + ProfittoELSEShortProfit = ShortProfit + ProfittoENDIFELSELongProfit = LongProfit + (Profitto / 2)ShortProfit = ShortProfit + (Profitto / 2)ENDIFENDIFENDIF//-----------------------------------------------------------------------ONCE MM = 1 // = 0 for optimizationONCE PositionSizeLong = 1ONCE PositionSizeShort = 1ONCE MinSize = 0.5 // IG minimum position size allowedONCE MaxSize = 1150 // IG tier 2 margin limitONCE ProfitAccrued = 0 // when restarting strategy, enter profit or loss to date in instrument currencyONCE DDlong = 2950 //MinSize drawdown in instrument currencyONCE DDshort = 3000 //MinSize drawdown in instrument currencyONCE Multiplier = 2 //drawdown multiplierONCE CapitalLong = DDlong * MultiplierONCE CapitalShort = DDshort * Multiplierif MM thenEquityLong = CapitalLong + ProfitAccrued + LongProfitEquityShort = CapitalShort + ProfitAccrued + ShortProfitPositionSizeLong = Max(MinSize, EquityLong * (MinSize/CapitalLong))PositionSizeLong = Round(PositionSizeLong*100)PositionSizeLong = PositionSizeLong/100PositionSizeLong = min(PositionSizeLong,MaxSize)PositionSizeShort = Max(MinSize, EquityShort * (MinSize/CapitalShort))PositionSizeShort = Round(PositionSizeShort*100)PositionSizeShort = PositionSizeShort/100PositionSizeShort = min(PositionSizeShort,MaxSize)endif//Sma = average[50,0](close)IF close CROSSES OVER Sma AND Not LongOnMarket THENBUY PositionSizeLong contracts at MarketELSIF close CROSSES UNDER Sma AND Not ShortOnMarket THENSELLSHORT PositionSizeShort contracts at MarketENDIFSET STOP pLOSS 100SET TARGET pPROFIT 400// debugging datagraph LongProfit + ShortProfit AS "Strategy Profit" coloured(0,128,0,155)graph strategyprofit1 user thanked author for this post.
10/03/2022 at 9:01 AM #201815Link to above saved as Log 338 here …
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on