Results 1 to 6 of 6
 0 Attachment(s)    

Thread: Extracting Data from ZigZag

  1. #1
    Junior Member v4vendetta's Avatar
    Join Date
    Jun 2009
    Posts
    18

    Default Extracting Data from ZigZag

    Hey All,

    Can someone point me to some info on extracting data from the ZigZag indicator? I tried the standard iCustom() but all I get is zeros.

    I'm trying to use it to find the last swing high and swing low so I can code my EA to place stops at this point, but I must be missing something.

    Here's the code I have:

    PHP Code:
    double swhigh iCustom (NULL0"ZigZag"125310);
    double swlow iCustom (NULL0"ZigZag"125320); 
    This is think should give me the goods but alas, not so much.

    Thanks.

    V

  2. #2

    Default ZigZag parameters

    How many parameters does the ZigZag indicator take? I'm asking because the second to the last parameter for the iCustom() function is 'mode' and it looks like you're using it as a parameter for ZigZag (you have it set to 1 for the first line and 2 for the second). I'm just speculating here, but maybe you need one more parameter for 'mode'?

  3. #3
    Junior Member v4vendetta's Avatar
    Join Date
    Jun 2009
    Posts
    18

    Default

    Those are the Buffer Indexes from the indicator.

    1: upper mode
    2: lower mode

    Should be right, but who knows.

  4. #4

    Default

    Quote Originally Posted by v4vendetta View Post
    Those are the Buffer Indexes from the indicator.

    1: upper mode
    2: lower mode

    Should be right, but who knows.
    Exactly. I'm saying you need one more parameter ... this is what you have:
    Code:
    double swhigh = iCustom (NULL, 0, "ZigZag", 12, 5, 3, 1, 0);
    double swlow = iCustom (NULL, 0, "ZigZag", 12, 5, 3, 2, 0);
    And here's what I think you might need:
    Code:
    double swhigh = iCustom (NULL, 0, "ZigZag", 12, 5, 3, 1, 2, 0);
    double swlow = iCustom (NULL, 0, "ZigZag", 12, 5, 3, 2, 2, 0);
    I used '2' in my example because when I used the iCustom() command I tried 0, then 1, and 2 finally worked. Not sure why, but it did.

    Paul

  5. #5
    Junior Member
    Join Date
    Oct 2009
    Posts
    11

    Default

    Paul you are great

  6. #6
    Junior Member
    Join Date
    Mar 2011
    Posts
    4

    Default

    Quote Originally Posted by v4vendetta View Post
    Hey All,

    Can someone point me to some info on extracting data from the ZigZag indicator? I tried the standard iCustom() but all I get is zeros.

    I'm trying to use it to find the last swing high and swing low so I can code my EA to place stops at this point, but I must be missing something.

    Here's the code I have:

    PHP Code:
    double swhigh iCustom (NULL0"ZigZag"125310);
    double swlow iCustom (NULL0"ZigZag"125320); 
    This is think should give me the goods but alas, not so much.

    Thanks.

    V

    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

Similar Threads

  1. WTI incorrect data with Tick Data Downloader
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 12-16-2015, 22:38
  2. ZigZag with pivotal data
    By Metatrader7 in forum Indicators
    Replies: 1
    Last Post: 09-13-2009, 21:05
  3. History data fr MQ/ difference with broker data
    By Erts in forum Expert advisors backtesting
    Replies: 1
    Last Post: 03-16-2009, 07:56

Tags for this Thread

color, high, indicator, low

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •