Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-13-2006, 05:51 AM
Junior Member
 
Join Date: Sep 2006
Posts: 3
mattes12 is on a distinguished road
Talking ArtTrader v1.5, need help testing

Hi All,

I'm quite new to the whole forex biz. My friend's traded live with Oanda and had some success (he got me into this), but I found manual trading to be too emotional. The idea of expert advisors fascinated me, so I wrote a few of my own. The one included is the one that works the best so far. It's intended to work with a spread of 2.0 on EUR/USD (I plan on using FXDD) and is only meant to work on the H1 timeframe.

I've been programming for twelve years (I'm 22), so I just threw together this EA in about four hours. Its main goal is the simplest approach of trading: buy low, sell high. It basically scalps on trends of EMA 11 on the H1 timeframe, but buys/sells at the lowest/highest possible points. Over the course of the last two months (MT4 backtest), it makes 43.5% with one lot. The code with comments and adjustable variables is included, as well as the HTM and GIF results from MT4 (build 197, just got updated today). It wins 87% of the time in these last two months!

These results were actually published in Linux. I'm running Wine on Fedora Core 5 so that I can use Microsoft programs. Unfortunately, I can't see any menu item labels, and the optimizer won't work. But when I change my OS to Windows 2000, I can't simulate past a month ago. I'm very frustrated with MT4, and I even wrote a separate C program to simulate the less-successful ArtTrader v1.4. Am I doing something wrong? Why doesn't the "Use date" function work? When I try to select a year-span, it just sits there calculating but doesn't put through any orders. This EA needs all the ticks it can get because of the way it works; perhaps M1 data isn't available from a year ago in the simulator? Seems odd.

If someone who knows how to work MT4 (or even MT3) could put through a yearly simulation/backtest, that would be very helpful. Optimization is also strongly encouraged.


Technical comments:
- This program only works with one order at a time. Nothing complex occurs at all (no order modification). If other EAs are running, this program will not work properly. KISS principle.
- The current NUM_LOTS is 1.0. I found this to be a nice standard for testing. If anyone simulates, please use this lot size of 1.0 for easy comparison.
- EMA_SPEED is self-explanatory.
- I find that when big jumps occur, from news or whatnot, that it's best to ignore them because they're unpredictable. This is what the JUMP variables are for.
- STOP_LOSS is the intelligent order-ender. It waits MINUTES_END to check whether the current price is relatively high or low, if a loss is being incurred.
- EMERGENCY_LOSS is the stop-loss value passed to OrderSend.
- TAKE_PROFIT is also passed to the ordering function. It is the only way to end a positive order (and it seems to work well at 25 pips).
- SLOPE_SMALL/LARGE are derivative (dy/dt) limits of the EMA, with dy being EMA_new-EMA_old, and dt being one hour. The units are of course pips/hour. No orders will be entered if the slope is outside these values (positive or negative).
- MINUTES_BEGIN waits this many minutes to compare the current price with the high or low point of the current, incomplete candlestick.
- SLIP_BEGIN/END are used when entering/exiting orders, to measure the acceptable distance between the current price and the incomplete candlestick high/low price.
- If MIN_VOLUME is -1.0, no orders will ever be ended by the measure of volume. If it's 0.0, all orders end on the weekend (or at dead times).
- I don't know what to make of SLIPPAGE. It's there if you need it. It's the variable passed to OrderSend. The help gave 3.0 as an example, so I used it.
- When making the spread detect automatic, I accidentally put the (Bid-Ask) the wrong way and noticed a higher profit. I fixed the problem but added a variable to supplement this. The difference is +3.37% in two months with ADJUST=1.0 as opposed to 0.0.


From the code:
extern double NUM_LOTS=1.0; // How many lots to deal with (may be less than one)
extern double EMA_SPEED=11.0; // The period for the averager
extern double BIG_JUMP=30.0; // Check for too-big candlesticks (avoid them)
extern double DOUBLE_JUMP=55.0; // Check for pairs of big candlesticks
extern double STOP_LOSS=20.0; // A smart stop-loss
extern double EMERGENCY_LOSS=50.0; // The trade's stop loss in case of program error
extern double TAKE_PROFIT=25.0; // The trade's take profit
extern double SLOPE_SMALL=5.0; // The minimum EMA slope to enter a trade
extern double SLOPE_LARGE=8.0; // The maximum EMA slope to enter a trade
extern double MINUTES_BEGIN=25.0; // Wait this long to determine candlestick lows/highs
extern double MINUTES_END=25.0; // Wait this long to determine candlestick lows/highs
extern double SLIP_BEGIN=0.0; // An allowance between the close and low/high price
extern double SLIP_END=0.0; // An allowance between the close and low/high price
extern double MIN_VOLUME=0.0; // If the previous volume is not above this, exit the trade
extern double SLIPPAGE=3.0; // This is for the OrderSend command
extern double ADJUST=1.0; // A strange but functional imaginary spread adjustment


Thanks!
- Arthur Matteson
Attached Images
File Type: gif StrategyTester_v1_5.gif (5.3 KB, 123 views)
Attached Files
File Type: htm StrategyTester_v1_5.htm (13.3 KB, 138 views)
File Type: mq4 arttrader_v1_5.mq4 (5.9 KB, 167 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-13-2006, 06:03 AM
Senior Member
 
Join Date: Sep 2006
Posts: 189
tomstaufer is on a distinguished road
Post EA test

Hi Arthur,
I will try your EA. What pairs do you recommend ?
Also I see modeling quality of 58%. Try to get better quality data for backtests.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-13-2006, 06:11 AM
Junior Member
 
Join Date: Sep 2006
Posts: 3
mattes12 is on a distinguished road
It seems to work well on EUR/USD. I think because it has the least spread, and a good variation per day. Feel free to try any others; you may need to optimize the ADJUST variable if the spread is not 2 pips. I really haven't tried much.

How would I get better quality data?

I did find a spot for some Forex data, but can it be imported into MT4?
http://www.piptrader.com/export_data.asp

- Arthur
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-13-2006, 11:20 AM
deepdrunk's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 310
deepdrunk is on a distinguished road
go to alpari site and download M1 data it should give better modeling quality around 80 %
i will test this EA live next days
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-13-2006, 11:22 AM
deepdrunk's Avatar
Senior Member
 
Join Date: Apr 2006
Posts: 310
deepdrunk is on a distinguished road
forgot to say this :don't trust mt4 backtest results,let it trade live on demo acc. for some time
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-13-2006, 12:27 PM
Senior Member
 
Join Date: Mar 2006
Posts: 787
Maji is on a distinguished road
Arthur,

I am not sure if this was your intention or not, but when you use "[0]", it means the current bar that is being formed. If you want to mean the bar just completed, you have to use [1] and for the one previous to that, [2].

Also, you have to think about using MagicNumbers and order symbols to count your open orders. Otherwise, it will be a pain in the behind to trade it live.

Good luck and thanks for sharing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-14-2006, 02:03 AM
foxxx's Avatar
Junior Member
 
Join Date: Mar 2006
Posts: 16
foxxx is on a distinguished road
Hello Fellows,

attached you will find backtesting results from 2001 until now (90% quality)

hope this helps
Attached Images
File Type: gif ArtTrader15_EURUSD_1h_noMM.gif (5.8 KB, 81 views)
Attached Files
File Type: htm ArtTrader15_EURUSD_1h_noMM.htm (402.9 KB, 62 views)
__________________
foxxx

expect the unexpected
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 09-14-2006, 04:06 PM
Junior Member
 
Join Date: Sep 2006
Posts: 3
mattes12 is on a distinguished road
New version

I improved it a bit. Here's v1.6.

Where did you get data for back to 2001, Foxxx? The Alpari data only covers to 2004. I would like to find as far back data as possible for all pairs, really.

Thanks!
- Arthur
Attached Files
File Type: mq4 arttrader_v1_6.mq4 (7.7 KB, 87 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 09-14-2006, 04:38 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,311
Blog Entries: 106
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by mattes12
I improved it a bit. Here's v1.6.

Where did you get data for back to 2001, Foxxx? The Alpari data only covers to 2004. I would like to find as far back data as possible for all pairs, really.

Thanks!
- Arthur
One or two months ago I published the data:
- back to 2001 for 4 majors;
- back to the beginning of 2004 of any others.

Somebody posted in in this threadby link I need data for Metrader 4
It should be back to 2001 (if i remember). I did it for raff1410 because he wanted to develop something about two months ago.

Last edited by newdigital; 09-14-2006 at 04:46 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 09-22-2006, 03:34 PM
Junior Member
 
Join Date: Nov 2005
Posts: 5
Weasel is on a distinguished road
Quote:
I can't simulate past a month ago
Hi Arthur,

If the tester will function under Linux but will only go back a month or so, I would suspect that the test data isn't making it into the tester. There is a thread somewhere (I believe it is on this forum) regarding effective use of the MT4 testing module. I'll take a look and see if I can find it. Unfortunately the tester behaves differently depending on which version you are running.

Good luck,

Wally

Just found the testing link: http://strategybuilderfx.com/showthread.php?t=15309

Last edited by Weasel; 09-22-2006 at 03:36 PM. Reason: Addition
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
testing EA ? martym General Discussion 5 06-10-2007 05:58 PM
the ea I am testing martym General Discussion 4 05-12-2007 04:04 PM
Need help with EA for testing colnc Post and compare Trades 0 12-20-2006 07:50 PM


All times are GMT. The time now is 11:32 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.