This EA concept works in much the same way as a Monte Carlo simulation of subatomic particles in a scattering medium, only much simpler. Instead of using an energy-dependent scattering cross-section as the PDF/CDF for the sampling function, we have market state-dependent sampling functions, and instead of sampling the scattering angle and distance to next interaction, we’re only sampling a price movement. The basic procedure is as follows:

  1. The EA reads chart data, dices the market into a number of quantum market states and then collects price movement statistics inside each state.
  2. These statistics then feed a sampling function for each market state
  3. A Monte Carlo simulation is run to obtain a projection for n-periods into the future
  4. A mean and standard deviation is obtained from this projection, and are fed into a trade decision subroutine.
  5. The trader sub uses this information to enter the market when conditions are favorable and exit when conditions turn for the worse.
  6. Take-Profit (TP) and Stop-Loss (SL) levels are set dynamically based on the projected means and standard deviation and the desired risk level (user input as a percentage of the account balance)

I should note that the robot is defenseless against pivot points, fibonacci levels, rapid increases in volatility, news releases, changes in monetary policy, central bank interest rates, etc. In real trading I would turn this EA off when there are scheduled news releases that are expected to impact currency markets. If a large event occurs that shifts the balance of monetary policy in a forex pair, the prudent thing to do would be to stay out of the market for a few weeks to allow the statistics to redefine themselves before jumping back in.

In spite of all the drawbacks previously mentioned, I should say that backtest results have been encouraging. The V.mafr.3.56 configuration variant resulted in a 112% return from 12/1/09 through 9/28/2010 with a 21% maximal drawdown in that period. This equates to a return to drawdown (RTD) ratio of 5.4. The V.mafr.3.64 configuration achieved an RTD of 8.1 over the same period. By contrast, the S&P 500 SPDR during the same period had a gain of 3% and a maximum drawdown of 16% (RTD = 0.2).

I’d like to test over a wider period, but each of these backtests take weeks to run because of the nature of the monte carlo method. In addition, MT4 has its own set of memory limitations. Regardless, I do plan on continuing a back-testing program in parallel with the forward testing activities.

MCNP_EA V.mafr3.56 (RTD = 5.4)

MCNP_EA V.mafr3.64 (RTD = 8.1)


3 Responses to MCNP_EA

  1. mfeldt says:

    Could you be a bit more explicit on how you define your “quantum market states”? Are these based on indicators? Candle Patterns? Price Action? How many states do you use? I guess this is quite crucial for the outcome of the excercise…

  2. gatornuke says:

    Yes, it is quite crucial indeed. The quantum states are how the market is segmented. For example, say you wanted to use two moving averages; you’d then have two states — when the fast MA is above or below the slow MA. Now say you were using two MAs on three different timeframes, now you have 8 different states. If you add another indicator, like three RSI states, for instance, now you have 216 states. The more states you have, the better defined the market is, but also the less data you have within each state. You could use just about anything to define a market state, just as long as it’s a function of price.

    I chose to use a combination of moving average fans and RSI for my “mafr” series (729 states) and the “dma” series uses a combination of moving average derivatives (24 states). I really can’t say which is better. As you can gather, these backtests take an ungodly long amount of time to complete, and for every 4 hour projection on the 1m chart, like what’s currently streaming live, it takes a minute or more to run (cycle time). There’s really no practical way to backtest the 1M performance. The best I can do is test the 5M charts.

  3. mfeldt says:

    Thx for the quick answer….

    I did a similar thing once, though without the MC part as I restricted myself to forecasting only a single period. I didn’t do a strict segmenting of market states, rather determined the N most similar states according to candle patterns. Basically, I filled a vector with the high, low, close of M candles (or ratios to the last close, actually) and compared it to all other such vectors that occured before in the time series.

    From the N most similar patterns, I determined the PDFs of the following bar, but I restricted myself to calculating the percentiles with which certain levels were supposed to be hit.

    The outcome was in some sense impressive, but I never found a way to trade it profitably… Maybe I’ll try again basing the whole similarity thing on indicators… maybe one of the problems was also that I never really ran it on small timeframes and long vectors due to the awful computation time involved…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: