Creating an Array in an EA to Store new calculated values that can be accessed or used later in other parts of EA when needed

 

How do i create an Array to store the "NewCalculatedValue" values  and access those values when needed ? since the handle is an integer. The New value is Calculated value on every tick and only checked at the Open of every candle ( e.g M15 )


#include <Expert/Expert.mqh>
#include <Trade/SymbolInfo.mqh>
#include <Trade/OrderInfo.mqh>
#include <Trade/HistoryOrderInfo.mqh>
#include <Trade/PositionInfo.mqh>
#include <Trade/DealInfo.mqh>
#include <Trade/TerminalInfo.mqh>    
#include <Object.mqh>
#include <MovingAverages.mqh>
#include <Arrays/ArrayDouble.mqh>


CArrayDouble VRArrayValues;

OnTick()
{
 .....
 ......
 ......
 
    // A different ATR Calculated value on every tick 
    double NewCalculatedValue =  xFactorValue * DifferentIndicatorValue;
        
 
 
    string Filter = CheckAtrFilter(); // works fine 

    if ( Filter == "positive") { //Do something ;}
    if ( Filter == "negative") { //Do Opposite ; } 


 
 .....
 ......
 ........
}



string AtrCheckFilter()
{
        //Create a variable for the filter 
        string filter=""
        
        //create an Array for the prices 
        double myPriceArray[];
        
        //Define the filter handle
        int AtrHandle = iATR(_Symbol, _Period, 14);   // How to use the newly NewCalculatedValue  instead of classic ATR ???
        
        //Sort the prices from the current downwards (descending)
        ArraySetAsSeries(myPriceArray, true);
        
        //Fill the Array with Data 
        CopyBuffer(AtrHandle, 0,0,10, myPriceArray);
        
        //Calculate the value for the current Candle
        double CurrentAtrValue = (myPriceArray[0]);
        
        //Calculate the value for the Previous(Last) Candle
        double PreviousAtrValue = (myPriceArray[1]);
        
        //if filter is Positive 
        if (CurrentAtrValue > PreviousAtrValue ) { filter ="positive" ;}
        
        //if filter is Positive 
        if (CurrentAtrValue < PreviousAtrValue ) { filter ="negative" ;}
        
        //Return to main function 
        return filter;
        
}       
        


Any help is appreciated