Good afternoon Mr Tools, how are you?mrtools wrote: Wed Nov 27, 2024 7:52 am Hello, wouldn't that be the same or similar to Mladen's atr probability?
Can you convert this code please? if possible with MTF?
//+------------------------------------------------------------------+
//| ATR Grid Indicator from Daily |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Orange
#property indicator_color3 Yellow
#property indicator_color4 Yellow
#property indicator_color5 Orange
#property indicator_color6 Red
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1
#property indicator_width5 1
#property indicator_width6 1
//--- Input parameters
input int daily_atr_len = 15;
double lvl1 = 0.5;
double lvl2 = 0.7;
//--- Buffers for storing ATR values
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
double Buffer6[];
int OnInit()
{
SetIndexBuffer(0, Buffer1, INDICATOR_DATA);
SetIndexBuffer(1, Buffer2, INDICATOR_DATA);
SetIndexBuffer(2, Buffer3, INDICATOR_DATA);
SetIndexBuffer(3, Buffer4, INDICATOR_DATA);
SetIndexBuffer(4, Buffer5, INDICATOR_DATA);
SetIndexBuffer(5, Buffer6, INDICATOR_DATA);
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexStyle(2, DRAW_LINE);
SetIndexStyle(3, DRAW_LINE);
SetIndexStyle(4, DRAW_LINE);
SetIndexStyle(5, DRAW_LINE);
IndicatorShortName("ATR Grid from Daily");
return(INIT_SUCCEEDED);
}
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int limit;
if(prev_calculated == 0)
limit = rates_total - daily_atr_len;
else
limit = rates_total - prev_calculated;
// Daily ATR calculation
for(int i = limit; i >= 0; i--)
{
double dailyATR = iATR(NULL, PERIOD_D1, daily_atr_len, i);
double dailyClose = iClose(NULL, PERIOD_D1, i);
Buffer1[i] = dailyClose + dailyATR;
Buffer2[i] = dailyClose + dailyATR * lvl2;
Buffer3[i] = dailyClose + dailyATR * lvl1;
Buffer4[i] = dailyClose - dailyATR * lvl1;
Buffer5[i] = dailyClose - dailyATR * lvl2;
Buffer6[i] = dailyClose - dailyATR;
}
return(rates_total);
}
I believe it will be of great value for measuring Take Profit and OBOS situations using the ATR. Shouts to Master XARD
In fact, I think it's a similar request to this one. post1295528866.html#p1295528866
Thank you very much again
