Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1368

 
Alexey Viktorov:

Is this checked? )))))

I've got it like this:

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 8:4.236 423.6

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 7:2.618 261.8

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 6:1.618 161.8

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 5:1 100.0

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 4:0.618 61.8

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 3:0.5 50.0

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 2:0.382 38.2

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 1:0.236 23.6

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: 0:0 0.0

2021.01.29 17:22:20.869 uthyeba 3 GBPUSD,M15: Alert: Fibo levels before = 9


 
Galim_V:

I do:

Where are the prices?

 
Alexey Viktorov:

Where are the prices?

I ran the script Alex suggested. And yes, that's what I said, I want to take it, not count it. Everything I need for the bot I will never be able to calculate on my own. Besides, I trust the guys at metquotes. Don't you?

 
Galim_V:

I ran the script suggested by Alex. And yes, that's what I said, I want to take it, not count it. Everything I need for the bot I will never be able to calculate by myself. Besides, I trust the guys at metquotes. Don't you?

I think I got it.

   //---  а сколько у нас Фибо-уровней ?
   double pr,lpr;
   int levels=ObjectGetInteger(0,"Fibo",OBJPROP_LEVELS);
   Print("Fibo levels before = ",levels);
   //---выведем в Журнал=> номер уровня:значения описание_уровня
   for(int f=0; f<levels; f++) 
     {
      pr=ObjectGetDouble(0,"Fibo",OBJPROP_PRICE,0)-ObjectGetDouble(0,"Fibo",OBJPROP_PRICE,1);
      lpr=(ObjectGetDouble(0,"Fibo",OBJPROP_LEVELVALUE,f)*pr)
         +ObjectGetDouble(0,"Fibo",OBJPROP_PRICE,0);
         Print(f,":",ObjectGetDouble(0,"Fibo",OBJPROP_LEVELVALUE,f),":",DoubleToString(lpr,Digits));
     }
Tweaked it a bit, but for some reason the internal and negative levels don't count
 
Galim_V:

I ran the script suggested by Alex. And yes, that's what I said, I want to take it, not count it. Everything I need for the bot I will never be able to calculate by myself. Besides, I trust the guys at metquotes. Don't you?

There's no other option. Just counting...

 
MakarFX:

I think it's working.

Tweaked it a bit, but for some reason the internal and negative levels don't count

Thank you, Makar!

 
Galim_V:

Thank you, Makar!

I recommend using mathematical price finding based on the two main Fibo levels.
 
MakarFX:

It seems to work.

Not much tweaking, but for some reason the internal and negative levels do not count

It does not work, because the zero level is not correctly defined and therefore you must not only add to the zero level, but also subtract from it if the fibre is stretched downwards. In general, it all depends on the position of the zero level relative to the single, 100% level.

 
Alexey Viktorov:

It does not count because the zero level is not correctly defined and therefore not only has to be added to the zero level, but also subtracted from it if the fibre is stretched from top to bottom. In general, it all depends on the position of the zero level in relation to the single, 100 per cent level.

You're right
 

I finished it)

Now all the levels are counting correctly

   //---  а сколько у нас Фибо-уровней ?
   int levels=ObjectGetInteger(0,"Fibo",OBJPROP_LEVELS);
   Print("Fibo levels before = ",levels);
   //---выведем в Журнал=> номер уровня:значения описание_уровня
   for(int f=0; f<levels; f++) 
    {
     if(f>=0)
      {
      Print(f,":",ObjectGetDouble(0,"Fibo",OBJPROP_LEVELVALUE,f),":",ObjectGetDouble(0,"Fibo",OBJPROP_LEVELVALUE,f)
      *(NormalizeDouble(ObjectGetDouble(0,"Fibo",OBJPROP_PRICE1,f),Digits)
      -NormalizeDouble(ObjectGetDouble(0,"Fibo",OBJPROP_PRICE2,f),Digits))
      +NormalizeDouble(ObjectGetDouble(0,"Fibo",OBJPROP_PRICE2,f),Digits));
      }
    }