Median Retrace System

 

Hi,

I'm developing an auto trading system in Ninja Trader, mainly because I can program in Ninja Trader Script. However, I want to run it in MT4, but can't get a grasp on the MQL language. I only have playback data in Ninja from 3 -14 October 2011, and this strategy has great promise (See attached picture of trades). This is Long Trades only, I'll be adding the Short Trades once the Long Trades are working perfectly. Here's the description of the method.

1. Assumption: All bars will eventually retrace to their Median, or beyond.

Time Frame is H1 on EURUSD (other pairs might work, but this is what I'm testing right now)

2. Long Entry Rules:

If Close[0] <= Median[0] - X Pips, Enter Long (market) X is an integer Variable.

Profit Target is set to Median[0]

Since Median[0] is a Price, the difference between Median[0] and Close[0] will need to be converted from a double to an

integer (at least in Ninja it does). Maybe MQL will allow a price profit target??

The profit target needs to be submitted at the same time as the Entry since many targets are hit on the same bar the position

was entered.

3. Short Entry Rules:

if Close[0] >= Median[0] + X pips, Enter Short (market).

Profit target is Median[0]

For the test on Live recorded data in the picture, I used 10 pips from Median. Starting Lot size of 0.1 If the Close was less

than or equal to the Median - 10 pips, it entered Long. It set the Profit Target at the Median of the qualifying bar. If the

Spread is 2 pips, that will mean a profit of at least 8 pips, often a lot more.

4. Allow Multiple entries:

Each entry must be independent of the others. Each must have it's own profit target and stop. With ECN brokers, the

positions will still produce the same net profit, even when FIFO is enforced. With Non ECN brokers, the positions will close

independently of each other. Right now, I allow 3 entries in the same direction, but will expand that I'm sure.

5. Hedging: We want to be able to Enable or Disable Hedging to accommodate different brokers and to trade both directions

simultaneously for brokers that allow hedging. I use HotForex, which allows hedging.

6. Enable Long and Shorts: Menu Option to allow setting to trade only Long, only Short, or Both. (obviously we don't want to

trade both if hedging is not allowed).

7. Martingale: Enable or Disable. I used the standard 1, 2, 4 in my test (picture) and it only entered the 3d position one time.

But we all know what COULD happen so we want to be able to use Martingale or not.

8. Money Management: Allow to use percentage of account to determine lot size, or choose a fixed lot size.

9. Optional goodie: Have the strategy print the Maximum DD on the screen. Not needed for the strategy to work, but handy

when long term testing on recorded data to see how much DD has been incurred during the running period. IWin autostrat

does this and I found it really nice in testing. It gave me a good idea on needed account size to run the strat.

10. Stop Loss: We'll need some catastrophe Stop set. Personally, I think choosing a percentage of the account would work the

best. I use 10%. So, if we start with $5000, all positions would close if drawdown reached $500.

11. Spread: I haven't taken spread into account since EURUSD is usually around 2. It can be added to the strategy as a

qualifier if it's really needed.

12. Code for standard 5 digit brokers.

13. Trailing Stop: We DON'T want one for this strategy.

14. Filters: None needed. IF we decide to add one later, it should be a good trend indicator. In real life, I found these

kind of filters don't really help much, since trends always change.

That's about everything I can think of.

Is anyone willing to turn this strategy into an MT4 auto strategy? I can provide the Ninja Code if you think that might help.

Joe

pecunix@comcast.net

Files: