Need Clarification on My Renko

 
extern int RenkoSize=20;

//Declare valuables
double LastRenkoValue=0;
double RenkoOpen[1000000]; //Place holder
double RenkoClose[1000000]; //Place holder
int ArrayIndex=2;

void OnTick()
{
double Delta=0;

//Calculate pips for renko box
if(LastRenkoValue==0)
        {
        LastRenkoValue=Bid;
        }else{
        Delta=(Bid-LastRenkoValue)/Point;
        }

//Create renko box
if(MathAbs(Delta)>RenkoSize)
     {
        RenkoOpen[ArrayIndex]  = LastRenkoValue;
        RenkoClose[ArrayIndex] = Bid;
        
        //Reset renko for next
        LastRenkoValue=0;
        //Add index for next
        ArrayIndex++;
     }

//Buy on consecutive bullish renko
if(RenkoClose[ArrayIndex-2]>RenkoOpen[ArrayIndex-2] && RenkoClose[ArrayIndex-1]>RenkoOpen[ArrayIndex-1])
        {
        Ticket=OrderSend(_Symbol,OP_BUY,Lots,Ask,0,0,0);
        
        //Reset valuables accordingly
        RenkoOpen[0] = RenkoOpen[ArrayIndex-2];
        RenkoOpen[1] = RenkoOpen[ArrayIndex-1];
        RenkoClose[0] = RenkoClose[ArrayIndex-2];
        RenkoClose[1] = RenkoClose[ArrayIndex-1];
        ArrayIndex=2;
        }
}


Here is the renko code I coded here and there with snippets found online.

As you can see, I have no intension of drawing the renko as chart. I just need arrays of renko's open and close.

This code seems to be working but it looks kind of ugly and I feel like there is a better way. For example, how my place holder is huge and how I try to reset the arrays so program doesn't run out of memories.

If you have some tips and advice, I am more than grateful. Thanks in advance.

Reason: