Again Moneymanagement calculate
Forums › ProRealTime English forum › ProOrder support › Again Moneymanagement calculate
- This topic has 8 replies, 3 voices, and was last updated 11 months ago by JohnScher.
Tagged: calculation, gain, loss, lot size, lotsize, money management, moneymanagement, position management, position size, positionsize, Profit, size management
-
-
09/30/2023 at 12:44 PM #221866
Moneymangement again
Calculating the position sizeMy account is 3.2% in the minus of 100% (100% = 10.000 Euro).
There is only 1 trading system running.
Position size = 1.
TP of the trading system is 2%.Tradingsystem example
If close > highest [20] then
buy at market
Endif
set target %profit 2How do I calculate the position size so that when the trade runs in the TP my account grows to 101%,
10/01/2023 at 9:30 AM #221885You will have to make these calculations:
- A = initial Capital (10000 in this case,which is 100%)
- B = current Capital which is 9580 (10000 – 3.2%)
- C = current target profit with 1 lot (2% of the entry price)
- D = A+1% – B (which is the target profit to reach A + 1%, i.e. 10100)
- LotSize = D / C
If your entry price is, say, 16000, the above calculations will be:
- A = 10000
- B = 9580
- C = 320 (2% target profit, with 1 lot)
- D = 420 (A+1% – B)
- LotSize = 420 / 320 which yields 1.3125 lots (you may round it)
So, if you BUY 1.3125 lots at 16000 and your planned Target Profit is reached, your current Capital at that time will be 10100 (the initial Capital + 1%).
10/01/2023 at 9:32 AM #221887Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums. Thank you 🙂
I moved it from the German forum.
1 user thanked author for this post.
10/03/2023 at 11:43 AM #221984Also a thanks for the reminder with the wrong forum. It happened me too from time to time that I ended up in the wrong forum. I try very hard to keep it, sometimes it still does not work. I am sorry for that.
1 user thanked author for this post.
10/03/2023 at 4:13 PM #221998First a very big thank you for doing this for me. For me, it will be a difficult ride to squeeze the calculation into the PRT code. I would like to be allowed to put it in here and you look over it again that fits? Will take 1,2 weeks, maybe more. I would like to come back to you.
10/03/2023 at 6:45 PM #222007Ok, take your time, I will read and test your code when available.
1 user thanked author for this post.
10/28/2023 at 12:33 PM #222999Hello Roberto.
Here I am back and I would like to use your help again.
I have created the code as below. I think it could work like this, but please, can you check once or twice if the code is correct?
123456789101112131415161718defparam cumulateorders= falseonce lotsize = 1once capital = 10000 // AactualCapital = capital + strategyprofit // BtpTrade = close/100 * 0.2 // CtpCapital = (capital + capital*0.01) - actualCapital // Dlotsize = round(tpCapital/tpTrade,2) // lotsizeIf longcond thenIF actualcapital < capital thenbuy lotsize contracts at marketelsif actualCapital >= capital thenbuy 1 contract at marketendifEndifset target profit tpTrade11/08/2023 at 12:14 PM #223361I changed the code a little bit, adding the variable named maxcapital and the Stop Loss, then I moved boith SL and TP inside the IF…ENDIF block. I also made the calculation of C, D and lotsize only when Not OnM arket.
This code seems to be working fine:
12345678910111213141516171819202122defparam cumulateorders= falseonce lotsize = 1once capital = 10000 // AactualCapital = capital + strategyprofit // Bmaxcapital = max(capital,actualcapital)IF Not OnMarket THENtpTrade = close/100 * 0.2 // CtpCapital = (maxcapital + maxcapital*0.01) - actualCapital // Dlotsize = round(tpCapital/tpTrade,2) // lotsizeENDIFlongcond = Not Onmarket AND average[10] CROSSES OVER average[20]If longcond thenIF actualcapital < maxcapital thenbuy lotsize contracts at marketelsif actualCapital >= maxcapital thenbuy 1 contract at marketendifset target profit tpTradeset stop loss tpTradeEndifgraph tpCapital coloured("Green")graph tpTrade coloured("Red")1 user thanked author for this post.
11/12/2023 at 9:02 AM #223569Hello Roberto.
I see we have the same thing here as here.
I suggest we merge the discussion and continue here.
https://www.prorealcode.com/topic/capital-curve-as-an-indicator/
I have tested your code above. It does not work properly. I am sorry. The maxcapital curve cannot point downwards, the highest capital ever reached cannot decrease as it is always the highest ever reached.
If I test your code and bring in “graph maxcapital”, you can see that maxcapital is decreasing, and is not in the spirit of the thing
123456789101112131415161718192021222324252627defparam cumulateorders= falseonce lotsize = 1once capital = 10000 // AactualCapital = capital + strategyprofit // Bmaxcapital = max(capital,actualcapital)IF Not OnMarket THENtpTrade = close/100 * 0.2 // CtpCapital = (maxcapital + maxcapital*0.01) - actualCapital // Dlotsize = round(tpCapital/tpTrade,2) // lotsizeENDIFlongcond = Not Onmarket AND average[10] CROSSES OVER average[20]If longcond thenIF actualcapital < maxcapital thenbuy lotsize contracts at marketelsif actualCapital >= maxcapital thenbuy 1 contract at marketendifset target profit tpTradeset stop loss tpTradeEndif//graph tpCapital coloured("Green")//graph tpTrade coloured("Red")graph maxcapital -
AuthorPosts