Page 1 of 1

Cluster box fix

Posted: Mon Aug 07, 2017 2:29 am
by society
this indi displays digits when zoomed in the numbers are unreadable I would like to change it so it will display as a solid box or even points
i think the fix is here but i am not sure what to change 'digits' too
any help would be appreciated

Re: Cluster box fix

Posted: Mon Aug 07, 2017 2:33 am
by society
something like this or dot or XXX anything would be great

Re: Cluster box fix

Posted: Mon Aug 07, 2017 2:52 am
by mladen
society wrote: Mon Aug 07, 2017 2:29 am this indi displays digits when zoomed in the numbers are unreadable
digits.GIF
I would like to change it so it will display as a solid box or even points
i think the fix is here
Capture.GIF
but i am not sure what to change 'digits' too
any help would be appreciated
That would not change the display
Check the ShowText() function and change it to show objects you need there

Re: Cluster box fix

Posted: Fri Aug 14, 2020 4:09 pm
by TradeG
Did you make it? I am trying to code a signal in it but I do not know about Indicators' coding yet.
I have tried giving it 2 buffers and getting the signal from:

Code: Select all

void PreviousBarTotals(int limit,double &lowPrice,int &arraySize)
  {
//--- Opening a tick history file
   bool fileClose = false;
   int hTicksFile = FileOpen(Symbol() + ".tks", FILE_BIN | FILE_READ | FILE_SHARE_READ | FILE_SHARE_WRITE);
   if(hTicksFile<1)
      fileClose=true;

//--- Search for the first tick belonging to the limit bar or any later bar
   TickStruct tick;
   tick.time= Time[limit];
   tick.bid = Open[limit];
   while(!IsStopped() && !fileClose)
     {
      if(!IsReadTimeAndBidAskOfTick(hTicksFile,tick))
         return;

      if(tick.time>=Time[limit])
         break;
     }

//--- Displaying data
   datetime extremeTime=Time[0]+PeriodSeconds();
   while(tick.time<extremeTime && tick.time!=0)
     {
      int barIndex=iBarShift(NULL,0,tick.time);
      SumDataForOneBar(hTicksFile,tick,lowPrice,arraySize,fileClose);
      SumDataFirstHalf(hTicksFile,tick,lowPrice,arraySize,fileClose);
      SumDataSecondHalf(hTicksFile,tick,lowPrice,arraySize,fileClose);
      //ShowBarHistogramms(barIndex,lowPrice,arraySize);
     }

   if(!fileClose)
      FileClose(hTicksFile);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SumDataForOneBar(int hTicksFile,TickStruct &tick,double &lowPrice,int &arraySize,bool &fileClose)
  {
//--- Reading ticks belonging to one candlestick
   int ticksCount=1;
   g_ticksPrice[0]=CastPriceToCluster(tick.bid);
   if(!fileClose)
      ReadTicksFromFile(hTicksFile,PeriodSeconds(),tick,ticksCount,fileClose);

   if(fileClose) // This is not an error - else is not needed, because after ReadTicksFromFile execution, fileClose may change
      AddDataFromBuffer(PeriodSeconds(),tick,ticksCount);
 
   ArrayMaximum(g_ticksPrice,ticksCount);

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SumDataFirstHalf(int hTicksFile,TickStruct &tick,double &lowPrice,int &arraySize,bool &fileClose)
 {
//--- Reading ticks belonging to one candlestick
   int ticksCount=1;
   g_ticksPrice[0]=CastPriceToCluster(tick.bid);
   if(!fileClose)
      ReadTicksFromFile(hTicksFile,(PeriodSeconds()/2),tick,ticksCount,fileClose);

   if(fileClose) // This is not an error - else is not needed, because after ReadTicksFromFile execution, fileClose may change
      AddDataFromBuffer((PeriodSeconds()/2),tick,ticksCount);

   ArrayMaximum(g_ticksPrice,ticksCount);

  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void SumDataSecondHalf(int hTicksFile,TickStruct &tick,double &lowPrice,int &arraySize,bool &fileClose)
  {
//--- Reading ticks belonging to one candlestick
   int ticksCount=1;
   g_ticksPrice[0]=CastPriceToCluster(tick.bid);
   if(!fileClose)
      ReadTicksFromFile(hTicksFile,(PeriodSeconds()-(PeriodSeconds()/2)),tick,ticksCount,fileClose);

   if(fileClose) // This is not an error - else is not needed, because after ReadTicksFromFile execution, fileClose may change
      AddDataFromBuffer((PeriodSeconds()-(PeriodSeconds()/2)),tick,ticksCount);

   ArrayMaximum(g_ticksPrice,ticksCount);

  }