Can't draw fibonacci with custom levels

 

Hello I need help.

Im trying to draw fibonacci with my custom levels (0.0, 50.0, 100, 150.0, 200.0) and it does draw only the first (zero level) line. I tried many things.

Could anyone help?

Here's the extract from the code:

 void FiboCreate(color clr, datetime t1, double p1, datetime t2, double p2)
{
   ObjectCreate(Name, OBJ_FIBO, 0, t1, p1, t2, p2);
   ObjectSet(Name, OBJPROP_FIBOLEVELS, FiboLevels); //FiboLevels is an external int param = 5
   
   double level = 0.0;
   for(int i = 0; i < FiboLevels; i++)
   {
      level = i * FiboDelta;    //FiboDelta is an external double param = 50.0
      ObjectSet(Name, OBJPROP_FIRSTLEVEL + i, level);
      ObjectSetFiboDescription(Name, i, StringConcatenate("(", DoubleToStr(level, 1), ") - %$"));
   }

   ObjectSet(Name, OBJPROP_LEVELCOLOR, clr);
   ObjectSet(Name, OBJPROP_COLOR, clr);
   ObjectSet(Name, OBJPROP_LEVELWIDTH, 2);
}

Thanks

 
Try FiboDelta = 0.50
void Fibo(  string name, datetime T0, double P0, datetime T1, double P1,
            color clr){
    if (!Show.Objects)  return;                 // #define WINDOW_MAIN 0
    if      (ObjectMove( name, 0, T0, P0 ))     ObjectMove(name, 1, T1, P1);
    else if(!ObjectCreate( name, OBJ_FIBO, WINDOW_MAIN, T0, P0, T1, P1 ))
        Alert("ObjectCreate(",name,",FIBO) failed: ", GetLastError() );
    else{
      ObjectSet(name, OBJPROP_RAY,           false );
      ObjectSet(name, OBJPROP_BACK,          true);
      ObjectSet(name, OBJPROP_STYLE,         STYLE_SOLID);
        ObjectSet(name, OBJPROP_FIBOLEVELS,  6);
        ObjectSet(name, OBJPROP_FIRSTLEVEL+0,   0.000);
        ObjectSet(name, OBJPROP_FIRSTLEVEL+1,   0.250);
        ObjectSet(name, OBJPROP_FIRSTLEVEL+2,   0.382);
        ObjectSet(name, OBJPROP_FIRSTLEVEL+3,   0.618);
        ObjectSet(name, OBJPROP_FIRSTLEVEL+4,   0.750);
        ObjectSet(name, OBJPROP_FIRSTLEVEL+5,   1.000);
        ObjectSetFiboDescription (name, 0, "0.0");
        ObjectSetFiboDescription (name, 1, "25.0");
        ObjectSetFiboDescription (name, 2, "38.2");
        ObjectSetFiboDescription (name, 3, "61.8");
        ObjectSetFiboDescription (name, 4, "75.0");
        ObjectSetFiboDescription (name, 5, "100.0");
      //   TF2+" High -  %$" displays Hourly High - 1.5191
   }
    if (!ObjectSet(name, OBJPROP_COLOR, clr )) // Allow color change
        Alert("ObjectSet(", name, ",Color) [5] failed: ", GetLastError());
}
 

Thanks mate @WHRoeder. I resolved the issue but I still have one problem. Im obtaining the value of an indicator on 4H_TF and if Im on the 4H_TF it allows me to draw fibonacci, but I need to obtain the value of the indicator on 4H_TF and draw it on 30M_TF. I cannot do that. Could you help?

stoch_m_1 = iCustom(Symb, 240, " StochAlert ", KPeriod, DPeriod, SPeriod, 0, 0, StoMASignal, 3, -30, 30, 4, 2);
stoch_m_0 = iCustom(Symb, 240, "StochAlert", KPeriod, DPeriod, SPeriod, 0, 0, StoMASignal, 3, -30, 30, 4, 1);

That's the code which obtains the value of the indicator. If I write 30 in place of 240, Im unable to draw Fibo on 30M_TF.

Thanks in advance

 
mkheidzedavid:


If I write 30 in place of 240, Im unable to draw Fibo on 30M_TF.

Why ? these values are not using in your Fib function . . . what is their relevance to the Fib ?
 

Thanks for the quick reply. That's why Im confused. Here's the full indicator code, its so simple:


Thanks

 
Ooh thanks I resolved it. Sorry for disturb. It draws it the only reason is that the scale is on 4H because it obtains the values of prices on 4H and draws it on 30M which is not visible. Thanks again
 
mkheidzedavid:
Ooh thanks I resolved it. Sorry for disturb. It draws it the only reason is that the scale is on 4H because it obtains the values of prices on 4H and draws it on 30M which is not visible. Thanks again

Yep, when working with Objects and they are not where you think they should be get into the habit of checking the Objects list (Ctrl + B)