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