Download MetaTrader 5
To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
Marcos Silva
310
Marcos Silva 2015.01.15 15:22 

Why would FoundFirst always be equal the Low fractal and never update if a high fractal gets updated on this ZigZag scan...

 

      int FoundHigh=0;
      int FoundLow=0;
      double FoundFirst=0;
      int k=0;
      while(FoundHigh<=2 && FoundLow<=2) // LAST x ZIGZAG FRACTALS
        {
         double fractal=iCustom(Symbol(),0,"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,k);
         if(fractal==High[k]) // High[counter]
           {
            FU[FoundHigh]=fractal;
            if(FoundFirst==0 && FoundHigh==0 && FoundLow==0) FoundFirst=fractal;
            FoundHigh++;
           }
         if(fractal==Low[k]) // Low[counter]
           {
            FL[FoundLow]=fractal;
            if(FoundFirst==0 && FoundLow==0 && FoundHigh==0) FoundFirst=fractal;
            FoundLow++;
           }
         
         k++;
        }
Carl Schreiber
6392
Carl Schreiber 2015.01.15 15:55  
Did you look at the chart? Which Symbol() and Period()?
Marcos Silva
310
Marcos Silva 2015.01.15 16:03  



in this chart you will find FL[0] = FoundFirst... is there any logic to this ?  

whroeder1
14239
whroeder1 2015.01.15 18:01  
investguy: is there any logic to this ?  
Print variable values before and inside if statements and find out why.
Halley
198
Halley 2015.01.15 18:57  
investguy:

in this chart you will find FL[0] = FoundFirst... is there any logic to this ?   

 Interesting chart. It isn't M1, is it?


Keith Watford
Moderator
9537
Keith Watford 2015.01.15 19:02  

What is the code for the Comment()?

You will have something like

"FoundFirst="+FoundFirst

 Have you perhaps modified a copy & paste and mistakenly coded

"FoundFirst="+FL[0]
Marcos Silva
310
Marcos Silva 2015.01.15 19:29  

I have tried adding a few things to the code and still only getting the first Lower Fractal.. any other clues??

 

I have tried looking at the results from the Print statements and decided to try and add a few things to the code.. .still not working... is only grabbing the first Lower fractal...

 

      int FoundHigh=0;
      int FoundLow=0;      
      int k=0;
      while(FoundHigh<=2 && FoundLow<=2) // LAST x UPPER ZIGZAG FRACTALS
        {
         double fractal=iCustom(Symbol(),0,"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,k);
         if(fractal==High[k]) // High[counter]
           {
            FU[FoundHigh]=fractal;
            FoundHigh++;
           }
         if(fractal==Low[k]) // Low[counter]
           {
            FL[FoundLow]=fractal;
            FoundLow++;
           }
        //if (fractal !=0 && FoundFirst == 0) FoundFirst=fractal;
         //Print( "FoundFirst=",FoundFirst," FL[FoundLow]=",FL[FoundLow]," FL[FoundHigh]=",FL[FoundHigh]);
         k++;
        }
      
      double FoundFirst=0;  
      int BarCount=0;
      while(BarCount <= Bars)
         {
           if(High[BarCount] == FU[0]) {FoundFirst=FU[0]; break;}
           if(Low[BarCount] == FL[0]) {FoundFirst=FL[0]; break;}
           BarCount++;
         }
         
 
Marcos Silva
310
Marcos Silva 2015.01.15 19:36  
GumRai:

What is the code for the Comment()?

You will have something like

 Have you perhaps modified a copy & paste and mistakenly coded

 

unfortunately no... 
Marcos Silva
310
Marcos Silva 2015.01.15 19:38  
DeepThought:

 Interesting chart. It isn't M1, is it?


 


no thats a renko chart.. check it out .. http://bit.ly/1mHQwr0 
Marcos Silva
310
Marcos Silva 2015.01.15 20:12  

Found my mistake... the logic is right but on the comparison in the if statement i used just "=" and not "=="...

 

wrong ---   if(FoundFirst=FL[0])
              {

right ---   if(FoundFirst==FL[0])
              {

 

so the value changed.. thank you guys!! 

Halley
198
Halley 2015.01.15 20:48  
investguy:
no thats a renko chart.. check it out .. http://bit.ly/1mHQwr0 
I did not notice it was from the tester. You are probably using some tool to align open price to close price, which distorts the chart.
/ /12
To add comments, please log in or register