# Slow trading…

February 27, 2011 5 Comments

With the exception of one trade in December 2010, MCNP_EA V.mafr.3.64 has been very quiet. It appears that it is using extremely conservative settings and it’s proving to be as exciting as staring at the wall. I’m giving 3.64 a new roomate (MCNP_EA V.dma.3.89). This new variant is much more trigger-happy, and runs on the 1M scale as opposed to the 5M scale as 3.64. On the other hand, it runs close to real-time, so there’s no practical way to backtest it — especially since MT4 is not multithreaded so there is no simple way to make use of multi-core parallelization.

I removed some of the limitations that make 3.64 behave in a more prudent manner. At the same time, however, working on a smaller timescale should allow it to react to changing market conditions more swiftly. In addition, the two higher order reference timeframes used for statistical quantification are the 5m and 15m timeframes as setup. I’m also allowing it to cancel all open transactions the moment the bias turns the other way, as opposed to forcing either an SL or TP as was the case with 3.64.

All in all, I would expect this version to trade a lot more often. We will evaluate this for some time as a forward test and see how it goes.

Hey,

Interesting EA, I myself started studying the book Evidence Based Technical Analysis and I’m very interested in the Monte Carlo method.

Could you please explain in more detail how your EA works exactly? From what I read the Monte Carlo Permutation is used to build a probability curve, to reject or accept and hypothesis about existing rules.

Not sure how you use the MCP from the start?

I’m using the Monte Carlo method in much the same way it is used to track the outcome of random individual events that conform to an underlying probability density function (PDF). Whenever you have a PDF, you can integrate it, invert it, and express it as a function of a random number with a uniform distribution. This is what is referred to as the “fundamental formulation of monte carlo” (FFMC). The FFMC allows you to produce a sampling function to simulate each individual “random” event alluded to earlier.

I have applied this approach in the study of radiation shielding and design of nuclear systems back in my college days, but it has other applications as well. In addition to writing a Monte Carlo routine from scratch, there are a number of software packages that make use of the Monte Carlo method for radiation transport (MCNP 4C, MCNP 5, KENO 3D, etc). But they all work pretty much the same way.

In Monte Carlo Simulation, you sample a number of histories. Each history consists of a number of sequential random samples. For instance, the delta between the opening prices of a given number of sequential bars. Each bar’s opening price depends on the previous bar’s open price and the random delta sampled. In addition, every new open changes the underlying properties of the market as determined by the technicals of your choice, thus changing the underlying PDF along the way for each history depending on how you segment the market (by MA delta, RSI, WPR, etc). You run a very large number of histories, and now you have a mean and standard deviation for your final open price and every bar along the way.

Once you have the results of your simulation, you can send them to a trading subroutine to determine entry and exit points as well as risk-adjusted position sizing if desired. You do have to run these simulations continuously in order to have a functional EA, and this approach is much more demanding than a simple indicator based EA, so you need to allocate sufficient resources to this task.

Sounds awesome, not that I really understood too much of what you said!

So basically the EA adapts its parameters to fit the latest history? I myself am studying chemical engineering but have never heard of Monte Carlo before, don’t think it is part of our syllabus.

I’m really really interested in learning more, I have programmed hundreds of EA’s in my life and they all eventually fail, this sort of mathematics is what I need to learn to improve my methods.

If you know of any resources/papers/books that can help me please send me the links…

Appreciate your help!

That’s right, the EA calculates the PDF for each market state based on the actual market history , and it is weighted so that recent data is worth more than old data.

Most of the resources I have are class notes and C++ projects I did while getting my master’s. I looked for something by my professor, Alireza Haghighat, but I couldn’t find any textbooks by him. I’m sure there’s plenty of info online, though. I found something that looks promising by having a quick look through amazon:

A Monte Carlo Primer: A Practical Approach to Radiation Transport

I’d recommend starting with that, and then if you like, you could read Monte Carlo Methods in Financial Engineering (Stochastic Modelling and Applied Probability) (v. 53) because financial-specific MonteCarlo methods often make use of only one type of probability density function and overlook the fact that as you progress through each history the PDF ought to change in response.

Excellent thanks for the suggestions, will start studying as soon as I get my hands on the right material.

I’ll be visiting your blog often to read on how it goes with your EA!

All the best