iMACD parameters on MQL5 - page 2

Marco vd Heijden
Moderator
13581
Marco vd Heijden  
for(int s=0;s<SymbolsTotal(false);s++){
Print(SymbolName(s,0));
}
There can be many dead symbolnames on the server they are frozen and do not have a active price feed.
David Diez
2366
David Diez  
Marco vd Heijden:
There can be many dead symbolnames on the server they are frozen and do not have a active price feed.

Look it in a simpler way, I'm having no signals.

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart(){
   double Main[],Signal[];
   ArraySetAsSeries(Main,true);
   ArraySetAsSeries(Signal,true);
   for(int i=0;i<SymbolsTotal(true);i++){
      string SName=SymbolName(i,true);
      int MACD=iMACD(SName,PERIOD_H4,12,26,9,PRICE_CLOSE);
      CopyBuffer(MACD,0,0,100,Main);CopyBuffer(MACD,0,0,100,Signal);
      if(Main[1]<0&&Main[1]>Signal[1]){Alert(SName," BUY");}
      if(Main[1]>0&&Main[1]<Signal[1]){Alert(SName," SELL");}
      }
   }
Fabio Cavalloni
13606
Fabio Cavalloni  

You are not handling possible errors.

Check if MACD is != INVALID_HANLDE and copybuffer>0.

And also, you are copying the same buffer to both Main and Signal.

Marco vd Heijden
Moderator
13581
Marco vd Heijden  

https://www.mql5.com/en/articles/81

About 3/4 through there is an example of MQL4 vs MQL5 

Migrating from MQL4 to MQL5
Migrating from MQL4 to MQL5
  • www.mql5.com
Practical Application Of Databases For Markets Analysis Working with data has become the main task for modern software - both for standalone and network applications. To solve this problem a specialized software were created. These are Database Management Systems (DBMS), that can structure, systematize and organize data for their computer...
David Diez
2366
David Diez  
Fabio Cavalloni:

You are not handling possible errors.

Check if MACD is != INVALID_HANLDE and copybuffer>0.

How I do this, please?
Fabio Cavalloni
13606
Fabio Cavalloni  
Fabio Cavalloni:

You are not handling possible errors.

Check if MACD is != INVALID_HANLDE and copybuffer>0.

And also, you are copying the same buffer to both Main and Signal.

Read it.

David Diez
2366
David Diez  
Fabio Cavalloni:

Read it.

Ok, that's the fail. I got it, very thank you Fabio and Marco.
Marco vd Heijden
Moderator
13581
Marco vd Heijden  

You made a script maybe you used the wrong template.

Try again with the indicator template.

David Diez
2366
David Diez  
Marco vd Heijden:

You made a script maybe you used the wrong template.

Try again with the indicator template.

It seems too complicated, must be an easier way.

Marco vd Heijden
Moderator
13581
Marco vd Heijden  
Yes build an EA directly.