Calculation of other TimeFrames

 

Is the ATR-indicator from Timeframe 10 Minutes and Period 14 the same as

from Timeframe 5 Minutes and Period 28??

 
sunshineh:

Is the ATR-indicator from Timeframe 10 Minutes and Period 14 the same as

from Timeframe 5 Minutes and Period 28??


no
 
How can I calculate the right value? I don't need the optical only the calculated value.
 
sunshineh:
How can I calculate the right value? I don't need the optical only the calculated value.


https://www.metatrader5.com/en/terminal/help/indicators/oscillators/atr

https://docs.mql4.com/indicators/iATR

The higher the Timeframe the higher the value can be

If you know what it is true range of a bar ...... then you didn't start this topic

 

I have another idea.


Can I save for example the last 28 bars from the 5 Min Chart in

High-Array[14] (highest value form bar 13 and 12, highest value form bar 11 and 10, ...)

Low-Array[14]

Open-Array[14]

Close-Array[14]

and use my normal ATR oder RSI Calculation with that Arrays.


I need only the actual values from the 10min-Chart

 
sunshineh:

Can I save for example the last 28 bars from the 5 Min Chart in

High-Array[14] (highest value form bar 13 and 12, highest value form bar 11 and 10, ...)

and use my normal ATR oder RSI Calculation with that Arrays.

I need only the actual values from the 10min-Chart

You can't use the normal iATR at all. It ONLY functions on the standard periods. You can use the iATROnArray if it existed, but it doesn't. You must write one.

You can't use the normal RSI at all. It ONLY functions on the standard periods. You can use the iRSIOnArray if you have M10 arrays. You must generate them.

Not compiled, not tested
// Calculate ATR on array
double iATROnArray(double H[], double L[], double C[], int length, int shift=0){
    double sum = 0;
    for (iBar = shift+length-1; iBar >= shift; iBar--){
        double  TR  = MathMax(H[iBar], C[iBar+1]) - MathMin(L[iBar], C[iBar+1]);
        sum += TR;
    }
    return(sum/length);
}
////////////////////////////////////////////////////////////////////////////
#define M10_RSI   14
#define M10_ATR   14
#define M10_SIZE  15    // At least one more than the maximum rsi, ATR
double   HighM10[M10_SIZE]; ArraySetAsSeries( HighM10[M10_SIZE], true);
double    LowM10[M10_SIZE]; ArraySetAsSeries(  LowM10[M10_SIZE], true);
double   OpenM10[M10_SIZE]; ArraySetAsSeries( OpenM10[M10_SIZE], true);
double  CloseM10[M10_SIZE]; ArraySetAsSeries(CloseM10[M10_SIZE], true);
// I assume you are running on the M5 chart. If not replace High[] with
// iHigh(M5) etc.
for(int iM10 = 0; iM10 < M10_size; iM10++){
    int iM5 = iM10 * 2;
     OpenM10[iM10]  = Open[iM5+1];
    CloseM10[iM10]  = Close[iM5];
     HighM10[iM10]  = MathMax(High[iM5+1], High[iM5]);
      LowM10[iM10]  = MathMin( Low[iM5+1],  Low[iM5]);
}
double  ATRM10  = iATROnArray(HighM10, LowM10, CloseM10, M10_ATR);
double  RSIM10  = iRSIOnArray(CloseM10, M10_SIZE, M10_RSI, 0);
Reason: