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 05-28-2006, 01:50 AM
Junior Member
 
Join Date: May 2006
Posts: 2
Kesh is on a distinguished road
Arrow ZigZag

How would I go about getting data from the default custom indicator "ZigZag" in my expert advisor? I know how to use the iCustom function, but don't know what to use for the last 3 variables.

Any help would be greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-28-2006, 09:05 AM
elihayun's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Quote:
Originally Posted by Kesh
How would I go about getting data from the default custom indicator "ZigZag" in my expert advisor? I know how to use the iCustom function, but don't know what to use for the last 3 variables.

Any help would be greatly appreciated.
the last patameter to iCustom is the bar shift, the one before it is the indicator buffer (starting from 0).
Before the last 2 parameters (that I just describe, u enter the values of all the extern values of the indicator. In your case look at the indicator and find the lines
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];


as u can see there are 3 values and 2 buffers.

the line of code should look like:

double zzUpper = iCustome(NULL,0,"ZigZag",12,5,3,0,0); // from 1st buffer
double zzLower = iCustome(NULL,0,"ZigZag",12,5,3,1,0); // from 2nd buffer

Most of the values will be 0 (when there is no zigzag value)

Hope it will help you

Eli
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-28-2006, 09:57 PM
Junior Member
 
Join Date: May 2006
Posts: 2
Kesh is on a distinguished road
Quote:
Originally Posted by elihayun
the last patameter to iCustom is the bar shift, the one before it is the indicator buffer (starting from 0).
Before the last 2 parameters (that I just describe, u enter the values of all the extern values of the indicator. In your case look at the indicator and find the lines
//---- indicator parameters
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- indicator buffers
double ExtMapBuffer[];
double ExtMapBuffer2[];


as u can see there are 3 values and 2 buffers.

the line of code should look like:

double zzUpper = iCustome(NULL,0,"ZigZag",12,5,3,0,0); // from 1st buffer
double zzLower = iCustome(NULL,0,"ZigZag",12,5,3,1,0); // from 2nd buffer

Most of the values will be 0 (when there is no zigzag value)

Hope it will help you

Eli
Thanks for your help!

I have gotten my expert advisor to output data from the indicator, but am having trouble making sense of it. It usually outputs 0 for both upper and lower, but sometimes it displays a value (i.e. 1.3423) for the upper and occasionaly the lower. When does it output data? What is the diffrence beetween upper and lower?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-29-2006, 05:01 AM
elihayun's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
ZigZag is a serial of upper and lower values. If u see a line from one price to another, then in the indicator you will get the lower price in the "lowpricebuffer" and the higher price in the "highpricebuffer" . So, between the low and high u get zeros.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-18-2007, 02:25 PM
Senior Member
 
Join Date: May 2007
Posts: 150
dvarrin is on a distinguished road
Hi,

I want to code an EA based on the Zigzag indicator. So if I want to know the last high or the last low, then I can simply create a loop, increasing the shift, and stop as soon as I get a value? Is that right?

What do the ZigzagBuffer, HighMapBuffer and LowMapBuffer contain? in the example above, mode should be 1 and 2 instead of 0 and 1 for the mode, no?

cheers,
Daniel

Last edited by dvarrin; 07-18-2007 at 02:32 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 07-18-2007, 09:34 PM
Senior Member
 
Join Date: Nov 2006
Location: Ukraine
Posts: 491
Shinigami is on a distinguished road
Please somebody who knows the code for it, simply post the code for the usage of ZigZag to find last 6 values of ZigZag custom indicator. I think it will be interesting to many. 6 because we ignore the last value (it is being redrawn) and need 2 last highs and 2 last lows. 6-th value just in case.
__________________
MQL4 programming is easy ^^
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-22-2007, 06:04 AM
Junior Member
 
Join Date: Oct 2006
Posts: 1
zsqabca is on a distinguished road
zigzag

Quote:
Originally Posted by Kesh View Post
How would I go about getting data from the default custom indicator "ZigZag" in my expert advisor? I know how to use the iCustom function, but don't know what to use for the last 3 variables.

Any help would be greatly appreciated.
int n, i;
double zag, zig;
i=0;
while(n<2)
{
if(zig>0) zag=zig;
zig=iCustom(NULL, 0, "ZigZag", 0, i);
if(zig>0) n+=1;
i++;
}now you have two numbers zig -- last value and zag -- value before that
if(zag>zig) indicator shows down
if(zig>zag) indicator shows up
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-22-2007, 06:26 AM
bigbear3391's Avatar
Senior Member
 
Join Date: Dec 2006
Location: California USA!!!
Posts: 373
bigbear3391 is on a distinguished road
Zig-zag Ea

Hey There,

I to am trying to find someone to help me build an EA with a non-lagging zig-zag indicator & a zig-zag pointer.

I have been using them manually with pretty good results.

The can be used on short term charts but are way better on 4 hour or higher.

I can show you how its works if you are interested.

Any reply would be greatly appreciated.


Bear-
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-22-2007, 09:04 AM
hexadecimal's Avatar
Member
 
Join Date: Apr 2006
Posts: 52
hexadecimal is on a distinguished road
Quote:
Originally Posted by bigbear3391 View Post
Hey There,

I to am trying to find someone to help me build an EA with a non-lagging zig-zag indicator & a zig-zag pointer.

I have been using them manually with pretty good results.

The can be used on short term charts but are way better on 4 hour or higher.

I can show you how its works if you are interested.

Any reply would be greatly appreciated.


Bear-

I`ve been always a fan of Zig Zag indicators can you pls share Non lagging Zig Zag indicator. Thx.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Tags
zigzag, ZigZag Pointer, zigzag forex

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
Zigzag indicators newdigital Indicators - Metatrader 4 139 07-08-2008 11:45 PM
DT-Zigzag EA pitch67 Suggestions for Trading Systems 16 03-20-2008 02:14 PM
Zigzag newdigital General Discussion 51 03-06-2008 10:21 AM
ZigZag EA SeeCube Metatrader 4 2 01-26-2007 11:36 AM


All times are GMT. The time now is 03:19 PM.



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