PaPP v2 export: fix compile (array MA 2D non valido in MQL5 -> struct MABuf)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -27,6 +27,9 @@ int gDays[7] = {365,182,121,30,14,7,3};
|
||||
string SER[NSER]= {"PRICE","MED","MA365","MA182","MA121","MA30","MA14","MA7","MA3"};
|
||||
int gHor[5] = {1,3,5,10,20};
|
||||
|
||||
//--- contenitore per un buffer MA dinamico (MQL5 non permette double ma[7][])
|
||||
struct MABuf { double v[]; };
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
int TimeToBarsD1(string sym,int d)
|
||||
{
|
||||
@@ -79,7 +82,7 @@ void OnStart()
|
||||
|
||||
//--- carico tutta la storia D1 (indice 0 = piu' vecchio)
|
||||
datetime tm[]; double cl[],hi[],lo[],atr[];
|
||||
double ma[7][];
|
||||
MABuf ma[7];
|
||||
ArraySetAsSeries(tm,false); ArraySetAsSeries(cl,false);
|
||||
ArraySetAsSeries(hi,false); ArraySetAsSeries(lo,false);
|
||||
ArraySetAsSeries(atr,false);
|
||||
@@ -90,8 +93,8 @@ void OnStart()
|
||||
if(CopyBuffer(hATR,0,0,total,atr)<=0) { Print("CopyATR KO"); return; }
|
||||
for(int m=0;m<7;m++)
|
||||
{
|
||||
ArraySetAsSeries(ma[m],false);
|
||||
if(CopyBuffer(hMA[m],0,0,total,ma[m])<=0) { Print("CopyBuffer MA KO m=",m); return; }
|
||||
ArraySetAsSeries(ma[m].v,false);
|
||||
if(CopyBuffer(hMA[m],0,0,total,ma[m].v)<=0) { Print("CopyBuffer MA KO m=",m); return; }
|
||||
}
|
||||
int n = ArraySize(cl);
|
||||
|
||||
@@ -101,7 +104,7 @@ void OnStart()
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
double mv[7];
|
||||
for(int m=0;m<7;m++) mv[m] = ma[m][i];
|
||||
for(int m=0;m<7;m++) mv[m] = ma[m].v[i];
|
||||
S[i][0] = cl[i]; // PRICE
|
||||
S[i][1] = Median7(mv); // MED
|
||||
for(int m=0;m<7;m++) S[i][2+m] = mv[m]; // MA365..MA3
|
||||
|
||||
Reference in New Issue
Block a user