Fix MT5 array declaration issues in OrdersEA_Smart_Grid

Changed dynamic arrays to fixed-size arrays:
- MqlRates rates[] -> rates[1]
- double rsiBuf[] -> rsiBuf[1]
- double adxBuf[] -> adxBuf[1]
- double atrBuf[] -> atrBuf[1]
- Removed ArraySetAsSeries calls (not needed for fixed arrays)

This fixes common 'array out of range' errors in MT5.
This commit is contained in:
2026-03-24 14:52:42 -04:00
parent f0b8653420
commit a74b5db8f7

View File

@@ -119,8 +119,7 @@ bool S1HitToday = false;
//+------------------------------------------------------------------+
void CalculatePivotPoints()
{
MqlRates rates[];
ArraySetAsSeries(rates, true);
MqlRates rates[1];
int copied = CopyRates(_Symbol, PERIOD_D1, 1, 1, rates);
if(copied < 1)
@@ -144,8 +143,7 @@ void CalculatePivotPoints()
double atr = 0;
if(ATRHandle != INVALID_HANDLE)
{
double atrBuf[];
ArraySetAsSeries(atrBuf, true);
double atrBuf[1];
if(CopyBuffer(ATRHandle, 0, 0, 1, atrBuf) > 0)
atr = atrBuf[0];
}
@@ -173,8 +171,7 @@ bool IsRangingMarket()
if(UseRSIFilter && RSIHandle != INVALID_HANDLE)
{
double rsiBuf[];
ArraySetAsSeries(rsiBuf, true);
double rsiBuf[1];
if(CopyBuffer(RSIHandle, 0, 0, 1, rsiBuf) > 0)
{
double rsi = rsiBuf[0];
@@ -188,8 +185,7 @@ bool IsRangingMarket()
if(UseADXFilter && ADXHandle != INVALID_HANDLE && isRanging)
{
double adxBuf[];
ArraySetAsSeries(adxBuf, true);
double adxBuf[1];
if(CopyBuffer(ADXHandle, 0, 0, 1, adxBuf) > 0)
{
double adx = adxBuf[0];