Capture the exact CCI indicator value at the specific highest price

 

Highest price is successfully registered, but I would like to keep the fixed CCI value corresponding to the highest until future changes.


void OnTick()
{
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   
   int Data = CopyRates(Symbol(),Period(),0,10,rates);
   int CCI = iCCI(Symbol(), Period(),14,PRICE_CLOSE);
   
   int HighestCandle;
   double High[];
   double HighCCI[];
   float valueCCI;
   
   ArraySetAsSeries(High,true);
   ArraySetAsSeries(HighCCI,true);
   
   CopyHigh(Symbol(),Period(),0,10,High);
   
   CopyBuffer(CCI,0,0,3,HighCCI);
   
   HighestCandle = ArrayMaximum(High,0,10);
   
   valueCCI = HighCCI[0];
   
   ObjectCreate(Symbol(),"Line1",OBJ_HLINE,0,0,rates[HighestCandle].high);
   
   ObjectSetInteger(0,"Line1",OBJPROP_COLOR,clrMagenta);
   
   ObjectSetInteger(0,"Line1",OBJPROP_WIDTH,3);
   
   ObjectMove(Symbol(),"Line1",0,0,rates[HighestCandle].high);
   
   Comment("Highest candle: ",HighestCandle,"\n", "Highest Price ",rates[HighestCandle].high,"\n", "CCI VALUE ",valueCCI);
}