Forex
Google

Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


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 01-31-2007, 11:03 AM
spence's Avatar
spence spence is offline
Member
 
Join Date: Jan 2007
Posts: 36
spence is on a distinguished road
ADXcrosses EA suggestion

hi @ all

in front of all - sorry for my bad english

i used the ADXcrosses indi i attached, on h1/h4 EURUSD and have a lot of profit in metatrader demo account.
now i tryed to code an EA for backtest...

i try to realize it with icustom() (only 2 buffers)


//----
double value1=iCustom(NULL, 0, "ADXcrosses",50,0,0);

double value2=iCustom(NULL, 0, "ADXcrosses",50,1,0);
//----


but it only gives the same value for both buffers every time --> 2147483647

the ADXcrosses uses arrows as signals and no lines could this be the
source of error?

did anybody know?

i will be grateful for every help.
Attached Files
File Type: mq4 ADXcrosses.mq4 (3.4 KB, 41 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-31-2007, 11:18 AM
ralph.ronnquist's Avatar
ralph.ronnquist ralph.ronnquist is offline
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
You should realise that bar number 0 is always in the process of being formed, and you should, in my opinion, never ever attempt to us it for indicator readings. You may use bar open, because that won't change, but bar close as well as high and low will or may change as new tick comes in, until that bar becomes bar number 1 (when a new bar number 0 begins being developed).

Therefore, I would suggest that you change the last argument in the iCustom calls to 1.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-31-2007, 11:30 AM
spence's Avatar
spence spence is offline
Member
 
Join Date: Jan 2007
Posts: 36
spence is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist
You should realise that bar number 0 is always in the process of being formed, and you should, in my opinion, never ever attempt to us it for indicator readings. You may use bar open, because that won't change, but bar close as well as high and low will or may change as new tick comes in, until that bar becomes bar number 1 (when a new bar number 0 begins being developed).

Therefore, I would suggest that you change the last argument in the iCustom calls to 1.

thanks for suggestion, it sounds plausibly

but the value is still the same
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-31-2007, 11:41 AM
ralph.ronnquist's Avatar
ralph.ronnquist ralph.ronnquist is offline
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Yes, your are right; my concern was different.

The value you see is the EMPTY value, i.e. that there is no value assigned for the indicator at the bar. From looking at the code, apparently the indicator only assigns value at the bars where the arrows appear, and leav the value as EMPTY otherwise.

It could make sense to add "SetIndexEmptyValue(0,0);" and "SetIndexEmptyValue(1,0);" in the init() function, and thereby define the unassigned value to read as 0.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-31-2007, 11:57 AM
spence's Avatar
spence spence is offline
Member
 
Join Date: Jan 2007
Posts: 36
spence is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist
Yes, your are right; my concern was different.

The value you see is the EMPTY value, i.e. that there is no value assigned for the indicator at the bar. From looking at the code, apparently the indicator only assigns value at the bars where the arrows appear, and leav the value as EMPTY otherwise.

It could make sense to add "SetIndexEmptyValue(0,0);" and "SetIndexEmptyValue(1,0);" in the init() function, and thereby define the unassigned value to read as 0.

you are right - it works
but the value is not at the same time as the indi draws the arrow,
not even similarly
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-31-2007, 12:23 PM
ralph.ronnquist's Avatar
ralph.ronnquist ralph.ronnquist is offline
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by spence
you are right - it works
but the value is not at the same time as the indi draws the arrow,
not even similarly
Which simulation mode do you use? "every tick" or "open bars only"?

What do you mean more exactly? How do you observe the timing difference between that an arrow is placed and that your EA notices it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-01-2007, 12:43 PM
spence's Avatar
spence spence is offline
Member
 
Join Date: Jan 2007
Posts: 36
spence is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist
Which simulation mode do you use? "every tick" or "open bars only"?

What do you mean more exactly? How do you observe the timing difference between that an arrow is placed and that your EA notices it?
i'm using "every tick"

for example
look at the attachement and compare it with the journal:

24.01.2007 - 25.01.2007 EURUSD H1

SIGNAL 1 short

14:04:05 2007.01.24 15:00 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3027
...
...
...
14:04:05 2007.01.24 15:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3027



SIGNAL 2 long
14:04:05 2007.01.25 08:01 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2938
...
...
...
14:04:05 2007.01.25 08:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2938



SIGNAL 3 short
14:04:05 2007.01.25 15:18 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3007
...
...
...
14:04:05 2007.01.25 15:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3007



SIGNAL 5 short
14:04:05 2007.01.25 17:32 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3001
...
...
...
14:04:05 2007.01.25 17:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value2 1.3001



SIGNAL 6 long
14:04:05 2007.01.25 18:08 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.294
...
...
...
14:04:05 2007.01.25 18:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.294



Signal 7 long
14:04:05 2007.01.25 19:00 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2957
...
...
...
14:04:05 2007.01.25 19:59 ADX_CROSSES_ICUSTOM EURUSD,H1: _____________________________value1 1.2957


3 signals in the chart and 7 in the journal
it works sometimes but not everytime

thank u very much
Attached Images
File Type: gif ADXcrossesSIGNALS.GIF (86.3 KB, 103 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-01-2007, 01:09 PM
et_phonehome_2 et_phonehome_2 is offline
Senior Member
 
Join Date: Feb 2006
Posts: 1,076
et_phonehome_2 is on a distinguished road
I'm just bookmarking this for now, I will get back to you as to whatelse you can use for confirmation, I trade manually so I hope you can incorporate in your alert.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-01-2007, 02:01 PM
ralph.ronnquist's Avatar
ralph.ronnquist ralph.ronnquist is offline
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
Ok; firstly, of course, the displayed indicator is a different instance of that indicator from the instance that the EA uses. You would like them to present the same indications, but they don't, for a relatively simple but highly technical reason; namely that they are invoked in different ways.

If we fast-forward past the long-winded explanation, you end up with the concern I brought up initially; namely that through the EA, the indicator is queried again and again and with changing result while the most recent bar is being built. In particular, it makes signals as soon as the condition holds, even if it doesn't hold when the bar is complete.

The displayed indicator appears to only use the completed bar data.

Actually from looking mor closely at the code, I think the combined indicator is doubly weird in that it for bar 0 pulls iADX values relating to the close of bar -1 as well as close of bar 0. Does iADX predict bar close that well? The close of bar -1 is almost 2 hours from now, at least when bar 0 is just started.

Basically "close of bar 0" is the always changing "last tick price", until this bar becomes bar 1. And bar -1 is a figment of imagination whose close price is (highly?) uncertain.

Thus, as I understand it, the combined indicator should be changed to not set signals on bars 1 and 0, but it should set it on bar 2 (if the condition holds). As a consequence, the EA can only discover such a signal 2 bars behind, i.e. 1 hour after the close of the bar that is marked; i.e., it should look for the bar 2 signal.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-01-2007, 03:08 PM
mangman mangman is offline
Senior Member
 
Join Date: Nov 2005
Posts: 169
mangman is on a distinguished road
Ok, this should work
Attached Files
File Type: mq4 ADXcrosses_v2.mq4 (3.4 KB, 70 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
My suggestion for E.A. forex_for_life Suggestions for Trading Systems 23 10-08-2007 01:13 PM
Property Level Problem - Need Suggestion! iscuba11 Indicators - Metatrader 4 1 06-09-2007 05:24 AM
Suggestion for an expert advisor, please help :) multa Expert Advisors - Metatrader 4 8 04-18-2006 09:45 AM


All times are GMT. The time now is 12:27 AM.