I attempted to convert an MT4 multi-timeframe fractal indicator to MT5 but encountered difficulties due to the differences in syntax, particularly with the absence of barshift in MQL5. I'm not acoder, I would greatly appreciate any assistance in implementing the iFractals coding (copy buffer and all) into the code. Thank you.
Below is the intital mt4 file and my mt5 version I tried to do.
Below is the intital mt4 file and my mt5 version I tried to do.
Post automatically merged:
MQL5:
for (int i = 0; i < Maxbar; i++) { datetime fractalTime = iTime(_Symbol, Fractal_Timeframe, i); int barShift = iBarShift(_Symbol, Fractal_Timeframe, fractalTime); int fractalBarIndex = iFractals(_Symbol, Fractal_Timeframe); if (barShift < 3) { if (i < ArraySize(UpBuffer)) UpBuffer[i] = 0; if (i < ArraySize(DoBuffer)) DoBuffer[i] = 0; continue; } CopyBuffer(fractalBarIndex, 0, 0, dif, UpBuffer); CopyBuffer(fractalBarIndex, 1, 0, dif, DoBuffer); if (fractalBarIndex != EMPTY_VALUE && i < ArraySize(UpBuffer)) UpBuffer[i] = UpBuffer[0]; // Change this according to your logic else if (i < ArraySize(UpBuffer)) UpBuffer[i] = 0; if (fractalBarIndex != EMPTY_VALUE && i < ArraySize(DoBuffer)) DoBuffer[i] = DoBuffer[0]; // Change this according to your logic else if (i < ArraySize(DoBuffer)) DoBuffer[i] = 0; } // no idea anymore on how to go about the ifractals