Results 1 to 1 of 1
  1. #1
    Agent86 is offline Newbie
    Join Date
    Oct 2008
    Posts
    13

    Default Need help to understand this array MQL4

    Hi, coders

    Would anyone care to educate me on arrays slightly
    Or perhaps I'm having more trouble understanding this loop as it pertains to this array.

    int i=Bars;


    #property copyright "Unfinished POS by Agent86"
    double v1[];

    double v2[];

    double val1;

    double val2;


    int start()

    {



    while(i>=0)

    {

    val1=iFractals(NULL, 0, MODE_UPPER,i);



    if (val1 > 0)

    {

    v1[i]=High[i];



    }

    else

    {

    v1[i]=v1[i+1];

    }





    val2=iFractals(NULL, 0, MODE_LOWER,i);



    if (val2 > 0)

    {

    v2[i]=Low[i];

    }

    else v2[i]=v2[i+1];



    i--;



    }


    return(0);

    }



    It's a basic fractal, and yet I can't seem to refer to any elements in the array.

    I want to be able to increment i++ somehow and Print (v1[i]); or print the previous value prior to the 0 or EMPTY_VALUE.
    If I'm even going in the right direction with this.

    I'm having trouble.
    Print (v1[i]): always == 0 and prints 0
    I sort of understand because it's actually looping down to -1 which == 0

    How and where might I put the Print statements so I can see whats going on ?
    I've tried multitudes or methods and re-initialized i=0 to attempt and alternate loop so that I might refer to v1[i] elements but all attempts have failed.

    Basically I want to view the previous fractals or mark them as A high, B low etc. for possible future use in an ABCD scheme type of EA
    For now, mainly I want to Print v1[i] so that I can see what it's doing.
    Perhaps I might design something to select a Previous Fractal such as A_high and/or B_low or some such scheme.

    Am I on the wrong track with this ?

    Please advise
    Thanks
    Last edited by Agent86; 09-19-2011 at 04:36 PM.


Similar Threads

  1. Please help me understand this!!!
    By dpaterso in forum Newbie Island
    Replies: 137
    Last Post: 11-27-2010, 05:32 AM
  2. Help Needed Coding Scalper EA
    By dptrade in forum Expert Advisors and Automated Trading
    Replies: 2
    Last Post: 05-01-2009, 05:00 PM
  3. Please help me checking on this broker
    By tomwillis in forum Forex Brokers
    Replies: 7
    Last Post: 03-29-2009, 11:06 PM
  4. Help needed - Fundamental
    By singaporefx in forum Newbie Island
    Replies: 2
    Last Post: 01-16-2008, 11:55 PM
  5. eSignal Help Needed
    By rsautobroker in forum Newbie Island
    Replies: 0
    Last Post: 07-15-2007, 03:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
"You cannot escape the responsibility of tomorrow by evading it today."
Abraham Lincoln