| / | Forum |
|
paulan
2006.08.15 15:29
Hello,
Does someone knows the code/script for compounding? I'd like to test when it's the best time to compound (per how many trades or days). Manually testing it is going to cost a lot of time I think (when you consider that I have some experts which make around a thousand trades per year).. And I thought the code shouldn't be too difficult... Thanks in advance, Paulan van Nes PS: Sorry for my English |
|
Program Folder of MetaTrader 4 Client Terminal The article describes the contents of the program folder of MetaTrader 4 Client Terminal. The article will be useful for those who have already started to grasp into the details of the client terminal operation. |
|
ScottB
2006.08.15 23:06
paulan, double positions = 0; d = 8 * (increase / delta); if (currentBalance >= minimumBalance) if (positions == 0) return(positions); |
|
paulan
2006.08.17 19:17
ScottB wrote: Hello Scott,paulan, double positions = 0; d = 8 * (increase / delta); if (currentBalance >= minimumBalance) if (positions == 0) return(positions); I'm sorry, but I don't know what to do now... I don't think you know what I want, I want something like: Every 30 (or whatever) trades the EA calculates what's 0. 001% of the account balance and uses that number as amount of lots for the next 30 trades... I am not familiar with programming.. thank you for your effort, Paulan PS: I won't have more than 1 position. |
|
ScottB
2006.08.18 20:29
paulan wrote: Hello Scott, I'm sorry, but I don't know what to do now... I don't think you know what I want, I want something like: Every 30 (or whatever) trades the EA calculates what's 0. 001% of the account balance and uses that number as amount of lots for the next 30 trades... I am not familiar with programming.. thank you for your effort, Paulan PS: I won't have more than 1 position. Paulan, The code I posted is meant to calculate a position based on a fixed fractional money management model. You would run it as a script with the parameters: initialBalance = the starting balance of when you turned the system on for the first time currentBalance = the balance prior to entering this position delta = how much money each position has to make prior to taking a larger position minimumBalance = how much margin does it take to have even one position (one full 100,000 lot would take $1,000 usd to have a full position) You run the code as a script (attach to chart) and the alert statement would pop up telling you the answer to the number of positions. I am sorry that I wasn't more clear in my earlier post. Scott |
|
paulan
2006.08.22 15:11
ScottB wrote: Hello Scott,Paulan, The code I posted is meant to calculate a position based on a fixed fractional money management model. You would run it as a script with the parameters: initialBalance = the starting balance of when you turned the system on for the first time currentBalance = the balance prior to entering this position delta = how much money each position has to make prior to taking a larger position minimumBalance = how much margin does it take to have even one position (one full 100,000 lot would take $1,000 usd to have a full position) You run the code as a script (attach to chart) and the alert statement would pop up telling you the answer to the number of positions. I am sorry that I wasn't more clear in my earlier post. Scott I don't think I can use your code to test when it's the best time to compound, can I? (well, maybe, but not faster than without it) thank you for your explanation though, Paulan |
|
ScottB
2006.08.22 15:54
Hello Scott, I don't think I can use your code to test when it's the best time to compound, can I? (well, maybe, but not faster than without it) thank you for your explanation though, Paulan Paulan, With this formula, reaching the delta value (profit value) per position will result in the number of positions going up. What you may be asking is how to best set the delta value. It is normally set at some ratio of your largest expected drawdown. If my system has a maximum expected drawdown of 200 pips, I would set the delta at 300 pips. So for the EURUSD trading every time the system made 300 pips PER EXISTING POSITION, therefore if trading 3 positions the system would have to produce 900 pips before adding another position. It is very important to realize that the profit is per position, not per trade. This will mathematically guarantee that your largest loss will result in only moving back 1-2 levels in your position size. The mistake that is often made is overleaveraging to the point where a large loss leaves you unable to trade anywhere near the same number of positions as before the loss. This puts you in the situation of taking much longer to regain the amount you lost because you are now trading a lot smaller number of positions. Hope this helps Scott |
|
paulan
2006.08.27 04:15
ScottB wrote: I don't want a script for calculating the amount of positions (or lots or watever).
.Paulan, With this formula, reaching the delta value (profit value) per position will result in the number of positions going up. What you may be asking is how to best set the delta value. It is normally set at some ratio of your largest expected drawdown. If my system has a maximum expected drawdown of 200 pips, I would set the delta at 300 pips. So for the EURUSD trading every time the system made 300 pips PER EXISTING POSITION, therefore if trading 3 positions the system would have to produce 900 pips before adding another position. It is very important to realize that the profit is per position, not per trade. This will mathematically guarantee that your largest loss will result in only moving back 1-2 levels in your position size. The mistake that is often made is overleaveraging to the point where a large loss leaves you unable to trade anywhere near the same number of positions as before the loss. This puts you in the situation of taking much longer to regain the amount you lost because you are now trading a lot smaller number of positions. Hope this helps Scott I may be doing that but I first want to test how good my system works with what I explained earlier... I know how the (your) script works, and maybe that is better. I have a system that wins aproximately 50% but the wins are 1.3 times as good |