Coding help - page 731

 

Dear mladen,

Attached ea freezing when saving settings and i have to restart mt4!

Is there a problem the codes?

Thank you. 

 
oguz:

Dear mladen,

Attached ea freezing when saving settings and i have to restart mt4!

Is there a problem the codes?

Thank you. 

No apparent problem that could cause that
 
mladen:
No apparent problem that could cause that

Thank you for your interest.

 

@mladen,

Attached ea very profitable. But it has a lot of error(s) on latest mt4.

Would you please fix them?

Thank you.

 

 

Files:
 
oguz:

Thank you for your interest.

 

@mladen,

Attached ea very profitable. But it has a lot of error(s) on latest mt4.

Would you please fix them?

Thank you.

 

 

Try it out (the same is valid for this one too : I don't know if it will work because of some of the warnings remained in the code)
Files:
 
mladen:
Try it out (the same is valid for this one too : I don't know if it will work because of some of the warnings remained in the code)

I will test it :)

Thank you for what you have done.

 

Hi ,

I'm trying to get the signal from gann hilo but isn't working.

for example:
 I set the hilo gan = 30 minutes and 4 smoothed , because I want to see the trade direction,

but I'm nothing getting the buy or sell signal correctly from indicator to the EA. 

the "Hilo_Handle" is not get the correct value ;-(

//+------------------------------------------------------------------+
//|                                                      ea-hilo.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

//------- input -----------------------------------------------------+
input ushort                           Hilo_Periodo=4;
input ENUM_MA_METHOD                   Hilo_Metodo=MODE_SMA;

//------- global variables ------------------------------------------+
double Hilo_Handle = INVALID_HANDLE; //Hilo Handle
double Hilo_ma[1]; //hilo ma
double Hilo_cl[1]; //hilo close
int    Shift=1;    //Bar on which indicators are checked: 0 - shaped bar, 1 - the first shaped bar
datetime ctm[1];
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   if(CopyTime(_Symbol,PERIOD_CURRENT,0,1,ctm)==-1)
     {
      return(false);
     }

     //---- get Hilo Moving Average
     Hilo_Handle=iCustom(_Symbol,PERIOD_CURRENT,"gann_hi_lo_activator_ssl",Hilo_Periodo,Hilo_Metodo);
     if(Hilo_Handle!=INVALID_HANDLE)
        ChartIndicatorAdd(0,(int)ChartGetInteger(1,CHART_WINDOWS_TOTAL),Hilo_Handle);  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
        if(CopyBuffer(Hilo_Handle,0,Shift,1,Hilo_ma)==-1 ||
            CopyClose(_Symbol,PERIOD_CURRENT,0,1,Hilo_cl)==-1
            //CopyClose(_Symbol,PERIOD_CURRENT,Shift,1,Hilo_cl)==-1
            ) return;
            
         //Hilo Buy
         if (Hilo_cl[0]>Hilo_Handle) {
         Comment ("BUY SIGNAL "+Hilo_cl[0]+">"+Hilo_Handle);
         return;
         }
         else
         //Hilo Sell
         if (Hilo_cl[0]<Hilo_Handle) {
         Comment ("SELL SIGNAL "+Hilo_cl[0]+"<"+Hilo_Handle);
         return;
         }
         Comment ("NO SIGNAL");
  }
//+------------------------------------------------------------------+
 

Dearest MLADEN

  Here is an error issue,and it can be removed by all 2 way ..... adding "t" before (tdelete) and by adding "pendingorder"  (deletependingorder) after delete ...... my question is,which one is the best proper way ?

your guidance and opinion is most authenticated.

regards


 
baraozemo:

Hi ,

I'm trying to get the signal from gann hilo but isn't working.

for example:
 I set the hilo gan = 30 minutes and 4 smoothed , because I want to see the trade direction,

but I'm nothing getting the buy or sell signal correctly from indicator to the EA. 

the "Hilo_Handle" is not get the correct value ;-(

//+------------------------------------------------------------------+
//|                                                      ea-hilo.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

//------- input -----------------------------------------------------+
input ushort                           Hilo_Periodo=4;
input ENUM_MA_METHOD                   Hilo_Metodo=MODE_SMA;

//------- global variables ------------------------------------------+
double Hilo_Handle = INVALID_HANDLE; //Hilo Handle
double Hilo_ma[1]; //hilo ma
double Hilo_cl[1]; //hilo close
int    Shift=1;    //Bar on which indicators are checked: 0 - shaped bar, 1 - the first shaped bar
datetime ctm[1];
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   if(CopyTime(_Symbol,PERIOD_CURRENT,0,1,ctm)==-1)
     {
      return(false);
     }

     //---- get Hilo Moving Average
     Hilo_Handle=iCustom(_Symbol,PERIOD_CURRENT,"gann_hi_lo_activator_ssl",Hilo_Periodo,Hilo_Metodo);
     if(Hilo_Handle!=INVALID_HANDLE)
        ChartIndicatorAdd(0,(int)ChartGetInteger(1,CHART_WINDOWS_TOTAL),Hilo_Handle);  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
        if(CopyBuffer(Hilo_Handle,0,Shift,1,Hilo_ma)==-1 ||
            CopyClose(_Symbol,PERIOD_CURRENT,0,1,Hilo_cl)==-1
            //CopyClose(_Symbol,PERIOD_CURRENT,Shift,1,Hilo_cl)==-1
            ) return;
            
         //Hilo Buy
         if (Hilo_cl[0]>Hilo_Handle) {
         Comment ("BUY SIGNAL "+Hilo_cl[0]+">"+Hilo_Handle);
         return;
         }
         else
         //Hilo Sell
         if (Hilo_cl[0]<Hilo_Handle) {
         Comment ("SELL SIGNAL "+Hilo_cl[0]+"<"+Hilo_Handle);
         return;
         }
         Comment ("NO SIGNAL");
  }
//+------------------------------------------------------------------+
Why are you comparing value with a handle? Handle is a handle - it can not be compared to value
 
mntiwana:

Dearest MLADEN

  Here is an error issue,and it can be removed by all 2 way ..... adding "t" before (tdelete) and by adding "pendingorder"  (deletependingorder) after delete ...... my question is,which one is the best proper way ?

your guidance and opinion is most authenticated.

regards


delete is reserved word in new metatrader 4. If a function, variable or any code part except for the regular new delete operator uses that name it needs to be renamed - adding "t" is just a quick fix, but any name except "delete" will do
 
mladen:
delete is reserved word in new metatrader 4. If a function, variable or any code part except for the regular new delete operator uses that name it needs to be renamed - adding "t" is just a quick fix, but any name except "delete" will do

Dearest MLADEN

Thanks for guide help.it is clear now,thanks.

and how we do remove this kind warnings ? ..... and if leave those warnings as is/are,do it effect the functionality of the code.

"check operator precedence for possible error; use parentheses to clarify precedence"

what to add and or do with ?

regards


Reason: