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 07-24-2007, 10:03 AM
Junior Member
 
Join Date: Dec 2006
Posts: 2
daniel.tiru is on a distinguished road
help with my expert advisor

I'm trying to program my first expert advisor..
And I want to use 2 indicators. -- MACD and Stochastic..
I want to use them on 2 different time periods. --
The MACD on daily chart (iMACD(1440,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0))
and the Stochastic on 1 hour chart (iStochastic(60,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)).
I want to set the buying and selling signals using the results of those two indicators.
In back-testing, I'm supposed to establish the period of back-testing -- And I cannot choose both daily chart for MACD and also hourly chart for Stochastic.

If I'm using back-testing on the Daily chart, MetaTrader loads both the MACD and the Stochastic with daily parameters (AND I DON'T KNOW WHY...), and thus, I cannot use different time periods. -- I have tested the stochastic with both the 60 minutes time interval and 1440 time interval and obtained the same resuts (

Does anyone know:
1. How I can perform back-testing for 2 different time periods for the 2 indicators I want to use in my EA?
2. If I'm using this kind of expert advisor in forward testing, when comparing the results of the indicator, MetaTrader shall use the time periods stated by me in the EA code, or it shall use the time period of the chart the EA is set on?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-24-2007, 11:00 AM
Member
 
Join Date: Nov 2005
Posts: 85
fxd01 is on a distinguished road
Quote:
Originally Posted by daniel.tiru View Post
I'm trying to program my first expert advisor..
And I want to use 2 indicators. -- MACD and Stochastic..
I want to use them on 2 different time periods. --
The MACD on daily chart (iMACD(1440,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0))
and the Stochastic on 1 hour chart (iStochastic(60,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)).
Daniel,

Function call is wrong. The first parameter is the currency pair and the second parameter is the time frame. The defaults are NULL-Current chart (first parameter) and 0-current chart time frame (second parameter).

Change your code,

iMACD(1440,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0)
iStochastic(60,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)

To

iMACD(NULL,1440,12,26,9,PRICE_CLOSE,MODE_MAIN,0)
iStochastic(NULL,60,5,3,3,MODE_SMA,0,MODE_MAIN,0)

Hope it helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-24-2007, 11:00 AM
Senior Member
 
Join Date: Nov 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
PERIOD_D1
PERIOD_H1
Try those instead of 1440 and 60. I use them and they work.
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-24-2007, 11:31 AM
Junior Member
 
Join Date: Dec 2006
Posts: 2
daniel.tiru is on a distinguished road
Quote:
Originally Posted by fxd01 View Post
Daniel,

Function call is wrong. The first parameter is the currency pair and the second parameter is the time frame. The defaults are NULL-Current chart (first parameter) and 0-current chart time frame (second parameter).

Change your code,

iMACD(1440,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0)
iStochastic(60,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)

To

iMACD(NULL,1440,12,26,9,PRICE_CLOSE,MODE_MAIN,0)
iStochastic(NULL,60,5,3,3,MODE_SMA,0,MODE_MAIN,0)

Hope it helps.
Thanks a lot..
It seems it's working.. (I mean, -- I get different results .. if I use the daily and hourly charts)
but the .. the EA still loses money.. --- I need to learn more to make it work.

Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-24-2007, 04:23 PM
Member
 
Join Date: Oct 2006
Location: Ekb, Russia
Posts: 54
Silem is on a distinguished road
Hi!

never use current bar in your ea (last parameter - shift). You should use at least last closed bar: shift - 1. In other case your tests won't be valid
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
RSI Expert Advisor TF2K Suggestions for Trading Systems 4 03-21-2007 12:52 PM
50-34 Expert advisor geisebhum Suggestions for Trading Systems 4 12-20-2006 05:45 PM
CCI Expert Advisor rodrigokaus Expert Advisors - Metatrader 4 10 09-29-2006 06:31 PM
expert advisor ? swirly Expert Advisors - Metatrader 4 3 08-30-2006 07:04 AM
What Expert Advisor are they using? fikko Expert Advisors - Metatrader 4 4 07-01-2006 08:47 AM


All times are GMT. The time now is 09:14 PM.



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