Fibonacci levels in MQL4 - page 6

 
Please help me, how can I write Fibonacci lines in my EA from this indicator, for example show me one line.
Files:
 
459275:
Please help me, how to write Fibonacci lines in an EA from this indicator, by showing on one line for example Thank you very much for your help.

Take this part of the code:

   double lowest=1000, highest=0;
   datetime T1,T2;
   for(int i=lookback+lastbar;i>lastbar+1;i--)
   {  
      double curLow0=iLow(Symbol(),Period(),i-2);
      double curLow1=iLow(Symbol(),Period(),i+1);
      double curLow2=iLow(Symbol(),Period(),i);
      double curLow3=iLow(Symbol(),Period(),i-1);
      double curLow4=iLow(Symbol(),Period(),i-2);
      
       double curHigh0=iHigh(Symbol(),Period(),i+2);
       double curHigh1=iHigh(Symbol(),Period(),i+1);
        double curHigh2=iHigh(Symbol(),Period(),i);
         double curHigh3=iHigh(Symbol(),Period(),i-1);
         double curHigh4=iHigh(Symbol(),Period(),i-2);
         
      if(curLow2<=curLow1 && curLow2<=curLow1 && curLow2<=curLow0 )
      {
      if(lowest>curLow2){
         lowest=curLow2;
         T2=iTime(Symbol(),Period(),i);}
      }
      
      if(curHigh2>=curHigh1 && curHigh2>=curHigh3&& curHigh2>=curHigh4)
      {  
         if(highest<curHigh2){
         highest=curHigh2;
         T1=iTime(Symbol(),Period(),i);}
      }
   
   
   }  

Insert into Expert Advisor. Variables highst and lowest will have levels 0 and 100, calculate the remaining levels.

By time from the variables T1 and T2 we can determine 100 above 0, or 0 above 100.

 
I have inserted this part, but I don't have enough brains. I'm just learning. I can do simpler ones, but I can't do this one yet. How do I calculate other levels?
 

Add the range multiplied by a factor to the zero level. The range is the distance between level 0 and 100. The coefficients are there below in the code where the fibo levels are set:

0.236, 0.382, 0.50, 0.618...

It would be better to add a couple of variables: Level0 and Level100, assign them a value depending on T1 AND T2:

if(T1<T2){
   Level0=highest;
   Level100=lowest;
}
else{
   Level100=highest;
   Level0=lowest;
}

Or vice versa:

if(T1<T2){
   Level100=highest;
   Level0=lowest;
}
else{
   Level0=highest;
   Level100=lowest;
}

I'll have to experiment))

All we need to do now is to calculate the levels:

Level=Level0+(Level100-Level0)*K;

For each level (for each K).

 
Dmitry Fedoseev:

Add the range multiplied by a factor to the zero level. The range is the distance between level 0 and 100. The coefficients are there below in the code where the fibo levels are set:

0.236, 0.382, 0.50, 0.618...

It would be better to add a couple of variables: Level0 and Level100, assign them a value depending on T1 AND T2:

Or vice versa:

I'll have to experiment))

All we need to do now is to calculate the levels:

Level=Level0+(Level100-Level0)*K;

For each level (for each K).

 
459275:

...

UsePrint(), Comment(), see what result you get, compare it with the original. As long as you can clearly see that the coefficients are wrong, they should be divided by 100.
 
459275:

Did I do it right? if(T1<T2){

Level0 = highest;

Level100 = lowest;

}

else{

Level100 = highest;

Level0 = lowest;

}

double K=lowest-highest;

double Level2=Level0+(Level100-Level0)*23.6;

double Level3=Level0+(Level100-Level0)*38.2;

double Level4=Level0+(Level100-Level0)*50.0;

double Level5=Level0+(Level100-Level0)*61.8;

double Level6=Level0+(Level100-Level0)*78.6;

 
I divided it by 100. What do I do next? And how do I set the signals from these levels?
 
459275:
I divide it by 100. And then what do I do? And how do I write the signals from these levels?

No one but you knows how you are going to use it. To start with, you have to check that it matches the original.

 
How is this check done?
Reason: