Quick question on a piece of code..

 

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++;
        }
 
Did you look at the chart? Which Symbol() and Period()?
 



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

 
investguy: is there any logic to this ?  
Print variable values before and inside if statements and find out why.
 
investguy:

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

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


 

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]
 

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++;
         }
         
 
 
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... 
 
DeepThought:

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


 


no thats a renko chart.. check it out .. http://bit.ly/1mHQwr0 
 

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!! 

 
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.
Reason: