help for creating object

 
Hello friends

I want to implement the FiboFan object on the chart with the help of standard MQL functions. But it seems I forgot something because nothing is displayed. Is it possible to guide me?

#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"

#include  <objectcreateandset.mqh>

#include  <ChartObjects\ChartObjectsFibo.mqh  >

struct StructFibo
  {
   datetime Time1 ;
   datetime Time2 ;
   double Price1  ;
   double Price2  ;

  };
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+

CChartObjectFiboFan  ObjectFiboFan ;
StructFibo  FiboStruct ;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
//---

   FiboModifing("fiboH1", PERIOD_H1); // Filling structure elements by propper values. 

   bool cond =  ObjectFiboFan.Create(0, "fiboH1", 0, FiboStruct.Time1, FiboStruct.Price1, FiboStruct.Time2, FiboStruct.Price2);

   ObjectFiboFan.SetInteger(OBJPROP_COLOR, clrAliceBlue);


  }
//+------------------------------------------------------------------+

 

I had forgotten to assign a value to the variables! I made the changes but the result did not change. Please help me to fix this problem


#property copyright "Copyright 2023, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"


#include  <ChartObjects\ChartObjectsFibo.mqh  >
#include  <BH_include\BH_Object_lib.mqh  >
#include <BH_include\MY_definitions_lib.mqh>


struct StructFibo
  {
   datetime Time1 ;
   datetime Time2 ;
   double Price1  ;
   double Price2  ;

  };
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+

CChartObjectFiboFan  ObjectFiboFan ;
StructFibo  FiboStruct ;
CChartObject  ChartObject ;

const string nameFibo = "FiboFan";
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
//--''BTC-USD 
   FiboStruct.Time1 =  D'2024.02.13 03:00:00' ;
   FiboStruct.Time2 =  D'2024.02.14 00:00:00' ;
   FiboStruct.Price1 = 50405.20 ;
   FiboStruct.Price2 = 49356.52 ;


   bool cond =  ObjectFiboFan.Create(0, nameFibo, 0, FiboStruct.Time1, NormalizeDouble(FiboStruct.Price1, _Digits), FiboStruct.Time2, NormalizeDouble(FiboStruct.Price2, _Digits));

ObjectFiboFan.SetInteger(OBJPROP_TIME, 0, FiboStruct.Time1);
ObjectFiboFan.SetInteger(OBJPROP_TIME, 1, FiboStruct.Time2);
ObjectFiboFan.SetDouble(OBJPROP_PRICE, 0,  FiboStruct.Price1) ;
ObjectFiboFan.SetDouble(OBJPROP_PRICE, 1,  FiboStruct.Price2) ;

ObjectFiboFan.SetInteger(OBJPROP_LEVELCOLOR, 0, clrAliceBlue);
ObjectFiboFan.SetInteger(OBJPROP_LEVELCOLOR, 1, clrAliceBlue);
ObjectFiboFan.SetInteger(OBJPROP_LEVELCOLOR, 2, clrAliceBlue);


ObjectFiboFan.SetInteger(OBJPROP_LEVELSTYLE, 0, STYLE_SOLID);
ObjectFiboFan.SetInteger(OBJPROP_LEVELSTYLE, 1, STYLE_SOLID);
ObjectFiboFan.SetInteger(OBJPROP_LEVELSTYLE, 2, STYLE_SOLID);

}
 
I found the answer. I was hoping someone could help me with that but..
Anyway, the answer for beginners like me who are looking for it is:
It seems that the codes written by the classes are removed from the chart at the end of the script, that's why the graphic object was not displayed. I entered the same codes in an indicator and the object was displayed!
 
Trader.student #:
I found the answer. I was hoping someone could help me with that but..
Anyway, the answer for beginners like me who are looking for it is:
It seems that the codes written by the classes are removed from the chart at the end of the script, that's why the graphic object was not displayed. I entered the same codes in an indicator and the object was displayed!
Good you found a solution.

I would like to point you to this:


I suppose, you get your script working as well, if you use this function at the end.

 
Dominik Egert #:
Good you found a solution.

I would like to point you to this:


I suppose, you get your script working as well, if you use this function at the end.

Thank you for your participation in this matter. In fact, I had tried the function ChartRedraw()  before . The object was displayed for a few milliseconds and at the end the script was quickly removed from the chart.