Randomize 20 positions / 5% Equity (portfolio simulation mode)
Author: eralbanese
Creation Date: 8/27/2020 12:13 PM
profile picture

eralbanese

#1
Hello,

When I run my strategy in portfolio mode (5% equity) it always returns the same trades and the same number of trades. Is there a way to have the software randomize different positions and trades so I can get a better understanding of how the system fares over the long run with different trade possibilities? I want to hold the 20/5 relationship.

Thank you,
Eric
profile picture

Eugene

#2
Users are asking for the exact opposite (usually) because Wealth-Lab will randomize the trades as per the User Guide chapter on Strategy Window > Backtesting Strategies > 100% of Equity Sizing.

You can reach what you just expressed with either a Position.Priority assigned in your Strategy code or by having activated "Use worst trades in portfolio simulation" in WL's Preferences > Backtest settings. With the 20/5 relationship, randomization is hardly possible to avoid unless using AtClose(bar) orders.

There are ways to randomize but first let's develop a better understanding of your strategy. Are you saying that there are NO trades excluded due to insufficient capital (you can look the number up on the Trades tab > status bar)?
profile picture

eralbanese

#3
Eugene,

My strategy returns 3000 trades when running in raw profit mode (from 1994 to today). When running in portfolio mode (5% equity) it returns 200 trades broken down by winners and losers and overall APR. If I run the same strategy (in portfolio mode) over and over I get the same exact trades with my strategy from 1994. What I want to do is have the software give me a different mix of those 200 trades out of the 3000 possible from raw profit so I can get an idea of high/low/avg returns.

It only returns missed trades when running in portfolio mode using the 5% equity parameter.

Thanks
Eric
profile picture

Cone

#4
@Eric,
Install the Extra Performance Visualizers Extension.
1. Before you open your strategy, add Monte Carlo to the Visualizers in Preferences (F12)
2. Open your strategy and run a simulation
3. On the Monte Carlo tab, go to Settings and select the Same Date Scramble.
4. Click Go!

See User Guide > Monte Carlo-Lab chapter for more information
profile picture

Eugene

#5
Eric, please note that Monte Carlo Lab is a premium feature for Wealth-Lab customers. It's not available during free trial.
profile picture

eralbanese

#6
Understood. Is there anything I can do to mimic that simulation without the Monte Carlo premium feature?
profile picture

Eugene

#7
As I gather it, you get 200 trades from the list of 3000 candidates in RP mode. This is WL's randomization in action. On free trial, you can affect WL's choice for the trades it picks programmatically via the Position.Priority property. Also programmatically you could delay the entry/exit dates N bars to the future as shown here: Setups, Triggers, Delays, and Timeouts.
profile picture

eralbanese

#8
Thanks Eugene. Is there a specific location that dives into detail on the position.priority code?
profile picture

Eugene

#9
It's called the QuickRef tool. Hit F12 key in WL to invoke.

The Priority can be randomized but the most close approximation could probably be accomplished with a random trade delay in the code. Let me come up with a quick sample code...
profile picture

Eugene

#10
Here's something for you. The entry on a crossover of Close/SMA is delayed randomly by 1-5 bars:

CODE:
Please log in to see this code.
profile picture

eralbanese

#11
Thank you Eugene.
profile picture

Eugene

#12
You're welcome.
profile picture

eralbanese

#13
A few follow up questions. I have the pro version now so I am going to test the Monte Carlo sim as Cone mentioned above.

Is the same date scramble the best option for what I want? My assumption is that just uses the same date range and randomizes the trade selections.

Is the 5% equity actually limiting my trades to 20 total trades when selected in portfolio mode? Or do I need to put a limit of number of open positions somewhere in my code?

Thank you,
Eric
profile picture

Eugene

#14
Eric, congrats on becoming a customer. Thanks.

QUOTE:
Is the 5% equity actually limiting my trades to 20 total trades when selected in portfolio mode? Or do I need to put a limit of number of open positions somewhere in my code?

Yes it does. Usually there may be even less than 20 open positions with 5% equity as suggested in post #2.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).