< All Topics

TradeStation/MultiWalk Runs Out Of Memory

TradeStation is a 32-bit application, which means it is subject to a 2GB memory limit no matter how much memory you have in your computer. Since MultiWalk is written within the TradeStation platform as a TradingApp, it, too, will subject to this limitation.

MultiWalk has built-in safeguards when memory consumption starts to approach this 2GB limit. If it is exceeded, TradeStation will crash. If you are getting “not enough memory” errors from either TradeStation or MultiWalk, there are some things you can do in order to reduce the memory needs of your MultiWalk project:

1. Reduce number of threads

More threads will consume more memory.  If you are hitting memory limits, then try to reduce the max thread count.

Another option is to increase the memory limit.  This is not recommended, but I have found it possible to “push” this memory limit beyond the traditional 2GB limit up to 3.7GB on my system.  I suspect that TS is attempting to change their platform to work within a 4GB memory space. But if you find that increasing this limit leads to a crash, then reduce it back to 1.9GB.

2. Disable LIBB (Look Inside Bar Backtesting)

Either disable LIBB as above, or increase the bar resolution.  LIBB, especially 1-minute bars, consume a great deal of memory and not all stragies need that fine resolution.

3. Reduce number of iterations

Every iteration compounds the amount of memory needed.  Let’s say that you have 1000 iterations.  During MultiWalk’s processing it will need to load all those iterations into memory which could exceed the amount of available memory.  Kevin Davey suggests to keep the number of iterations well below 1000, or even less than 100.

4. Reduce number of trades

If any of your iterations are producing an extraordinary number of trades (such as 20,000 or more), then the memory consumption will be greatly compounded when MultiWalk needs to process all the iterations.  Since MultiWalk make its possible to test a wide variety of parameters for a strategy, some of those parameter values could make the strategy produce an unual and unexpected number of trades and trigger MultiWalk’s memory checks.  It is highly unlikely that these high-trade volume strategies would be tradable or profitable.  In order to reduce the likelihood of that happening in your strategy, you could try the following ideas to limit trade volume:

Use EntriesToday(date) to limit number of trades. So, for example, place this IF statement around your buy/sell orders:

if ( EntriesToday(date) <= 0 ) then

This would limit the trades to one per day.  That might not work if you have (and want) several reversals in one day.  So you can make the limit whatever makes sense for your strategy (such as <= 1). This way all the extra processing time could be shortened and memory usage reduced by limiting the number of trades per day.

Another idea is to define a boolean “CanTrade” that will just turn the strategy “off” if it is trading too much:

bool CanTrade(true);
if ( TotalTrades > 10000 ) then
CanTrade = false    // stop trading if unreasonable number of trades occurring
CanTrade = true;
If ( CanTrade ) then


Table of Contents