Drawdowns safety
Forums › ProRealTime English forum › ProOrder support › Drawdowns safety
- This topic has 31 replies, 6 voices, and was last updated 4 years ago by Fran55.
-
-
11/01/2020 at 6:57 PM #14919511/01/2020 at 7:36 PM #14920611/01/2020 at 8:00 PM #14921111/01/2020 at 8:05 PM #149213
You could try this MM by Vonasi. You can set it to go back to the starting positionsize after a certain % drawdown.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556//MONEY MANAGEMENT VonasiCapital = 10000MinSize = 1 //The minimum position size allowed for the instrument.MM1stType = 0 //Starting type of moneymanagement. Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.MM2ndType = 1 //Type of money management to switch to after TradesQtyForSwitch number of trades and ProfitNeededForSwitch profit has occurredTradesQtyForSwitch = 10 //Quantity of trades required before switching to second money management choice.ProfitNeededForSwitch = 3 //% profit needed before allowing a money management type change to MM2ndType.DrawdownNeededToSwitch = 5 //% draw down from max equity needed before money management type is changed back to MM1stType.DrawdownNeededToQuit = 35 //% draw down from max equity needed to stop strategyOnce MoneyManagement = MM1stTypeEquity = Capital + StrategyProfitmaxequity = max(equity,maxequity)if equity < maxequity * (1 - (DrawdownNeededToSwitch/100)) thenenoughtrades = 0tradecount = 0moneymanagement = MM1stTypeendifif equity < maxequity * (1 - (DrawdownNeededToQuit/100)) thenquitendifif not EnoughTrades thenif abs(countofposition) > abs(countofposition[1]) thentradecount = tradecount + 1endifif tradecount > TradesQtyForSwitch and maxequity >= Capital * (1 + (ProfitNeededForSwitch/100)) thenEnoughTrades = 1MoneyManagement = MM2ndTypeendifendifIF MoneyManagement = 1 THENPositionSize = Max(MinSize, Equity * (MinSize/Capital))ENDIFIF MoneyManagement = 2 THENPositionSize = Max(LastSize, Equity * (MinSize/Capital))LastSize = PositionSizeENDIFIF MoneyManagement <> 1 and MoneyManagement <> 2 THENPositionSize = MinSizeENDIFPositionSize = Round(PositionSize*100)PositionSize = PositionSize/100// Size of POSITIONSPositionSizeLong = 1 * positionsizePositionSizeShort = 1 * positionsize11/02/2020 at 3:17 PM #149297The bot must remember at what price it entered the last trade.
And if this operation is negative, operate in the following operations with half until it exceeds the drawdown.Once the drawdown has been overcome, return to operating with what it operated before the drawdown occurred.
Example:
The bot is trading with € 3.5 and earning in the historical € 20,000.
The bot loses a trade and starts a drawdown.
The bot is still operating, but at € 1.75.
Time passes, the bot once again exceeds the historical € 20,000.
The bot operates again at € 3.5.This is what I would like to do, I don’t know if it’s possible.
11/02/2020 at 3:26 PM #149298That’s exactly what my code does https://www.prorealcode.com/topic/drawdowns-safety/#post-148910.
Why don’t you use it?
11/03/2020 at 10:21 AM #149357Okay, another problem Roberto.Your code works.
The Minsize = € 0.5, but if in the first operations of the strategy there are losses, for example when it operates at € 0.75, the half is € 0.37, and since the minimum of IG to operate dax is € 0.5 the strategy stops.Solution???
11/03/2020 at 11:01 AM #149363Solution???
Start off at $1 then it will go to $0.5 after a loss … not hard is it?
You will be testing in Demo anyway so starting at $1 is not a problem?
11/03/2020 at 11:40 AM #149371It’s like trying to spare on car wheels, you buy 3 instead of 4, but it’s impossible to make it move…. buy 4 or use a bike!
1 user thanked author for this post.
11/03/2020 at 1:52 PM #14938011/03/2020 at 7:36 PM #14940911/04/2020 at 4:58 PM #149474Joking apart, you can use this snippet, modified to make the number of contracts not to drop below the minimum od 0.5:
1234567Once MaxProfit = 0Once InitialSize = 1MaxProfit = max(MaxProfit,StrategyProfit)LotSize = InitialSizeIf MaxProfit > StrategyProfit ThenLotSize = max(0.5,InitialSize / 2)Endif11/05/2020 at 8:21 PM #14958611/05/2020 at 8:34 PM #149589You can try using ROUND(), but this will remove decimals.
To be able to tell exactly you should post your code.
11/07/2020 at 2:20 PM #149773 -
AuthorPosts
Find exclusive trading pro-tools on