Fractal Code Location

sragone

Active member
Joined
May 23, 2019
Posts
38
Likes
25
Hello,

When I loaded up the study for the William’s fractal indicator into MotiveWave and pressed the “Help” button, I was taken over to the MotiveWave website dealing with the fractal study and at the bottom of the page the following code was displayed:

Code:
for(int i = 2; i LT; size()-2; i++)
    if (isComplete(i)) continue;
    h1 = getHigh(i-2);
    h2 = getHigh(i-1);
    h4 = getHigh(i+1);
    h5 = getHigh(i+2);
    high = getHigh(i);
    if (high MT h1 AND high LT h2 AND high MT h4 AND high MT h5)
    //check for next highest bars on each side
    lmax = Math.max(h1, h2);
    rmax = Math.max(h4, h5);
    if ((lmax MOR= h4 OR lmax MOR= h5) AND (rmax MOR= h1 OR rmax MOR= h2) )
        addFigure(downArrow); ....//sell signal
    else
        l1 = getLow(i-2);
        l2 = getLow(i-1);
        l4 = getLow(i+1);
        l5 = getLow(i+2);
        low = getLow(i);
        if (low LT l1 AND low LT l2 AND low LT l4 AND low LT l5)
            //check for next lowest bars on each side
            lmin = Math.min(l1, l2);
            rmin = Math.min(l4, l5);
            if ((lmin LOR= l4 OR lmin LOR= l5) AND (rmin LOR= l1 OR rmin LOR= l2) )
                addFigure(upArrow); //buy signal
            endIf
        endIf
    endIf

I’m currently learning Java right now, and when I opened up the studies’ code in the SDK that was released for the fractal indicator, none of the above code was found.

I know that I’m just a beginning programmer, but where would the above code that is on the “help” page be located in the study?

Thank you for your time.

Shane
 
Last edited:

sragone

Active member
Joined
May 23, 2019
Posts
38
Likes
25
Now that I look at the above code again, I'm guessing that might be pseudocode, but where in the study is that logic found?
 

igor.s

Well-known member
Joined
May 22, 2019
Posts
289
Likes
153
It is a pseudo code. There is a link posted by MW team to their studies source here in the forum. If a study you are looking for is not there then email them and they will send you the java file.
 

MotiveWave_Joe

Moderator
Staff member
Joined
Mar 26, 2019
Posts
223
Likes
67
Hi,

That is correct. The logic on our webpages for studies is pseudocode.

You can grab the source code here .
 

sragone

Active member
Joined
May 23, 2019
Posts
38
Likes
25
I've got the studies' code. I was merely trying to follow the logic from the pseudocode when I was looking at the code inside of the fractal study. I'm going to come back to this when I get a little more adept at my Java coding. Professional coding styles seem much more sleek than my hackneyed beginner approach.

Anyway, thanks for taking the time to answer my questions.
 
Top