المؤشر لا يظهر فى ميتاتريدر 5 و لا اعرف السبب و لا الحل ممكن مساعدة
و هذا هو الكود الخاص به بعد عمل برمجة (كومبيلينج) و عدم ظهور اخطاء له
فبرجاء المساعدة
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_label1 "dummy"
double dummyBuffer[];
string fibName = "AutoFibo_0509";
double fibLevels[] = {0.00, 0.50, 1.00, 1.25, 1.50, 2.00, 2.50, 3.00, -0.25, -0.50, -1.00, -1.50, -2.00};
int OnInit()
{
SetIndexBuffer(0, dummyBuffer);
Print("Indicator Initialized");
DrawFiboForSelectedDay();
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[]
)
{
Print("OnCalculate called: ", rates_total, " rates available.");
if (prev_calculated == 0)
{
DrawFiboForSelectedDay();
}
return rates_total;
}
void DrawFiboForSelectedDay()
{
ObjectDelete(0, fibName);
datetime chartDay = TimeCurrent();
MqlDateTime dt;
TimeToStruct(chartDay, dt);
dt.hour = 0;
dt.min = 0;
dt.sec = 0;
datetime dayStart = StructToTime(dt);
datetime tStart = dayStart + 5 * 3600;
datetime tEnd = dayStart + 9 * 3600;
double hi = -DBL_MAX;
double lo = DBL_MAX;
int barsCount = Bars(NULL, PERIOD_H1);
Print("Bars Count: ", barsCount);
for (int i = 0; i < barsCount; i++)
{
datetime barTime = iTime(NULL, PERIOD_H1, i);
if (barTime >= tStart && barTime <= tEnd)
{
double h = iHigh(NULL, PERIOD_H1, i);
double l = iLow(NULL, PERIOD_H1, i);
if (h > hi) hi = h;
if (l < lo) lo = l;
}
}
if (hi == -DBL_MAX || lo == DBL_MAX)
{
Print("No suitable high or low found for the selected period.");
return;
}
Print("High: ", hi, " Low: ", lo);
if (!ObjectCreate(0, fibName, OBJ_FIBO, 0, tStart, hi, tStart, lo))
{
Print("Failed to create Fibonacci object: ", GetLastError());
return;
}
for (int i = 0; i < ArraySize(fibLevels); i++)
{
ObjectSetDouble(0, fibName, OBJPROP_LEVELVALUE, i, fibLevels[i]);
}
ObjectSetInteger(0, fibName, OBJPROP_COLOR, clrLime);
ObjectSetInteger(0, fibName, OBJPROP_WIDTH, 1);
Print("Fibonacci object created successfully.");
}