mql5, cannot call a function inside onTick() function

 

hello,

can you help me please :)

string CheckFilter(){
   string filter="";
   double myPriceArray[];
   int VolumesDefinition = iVolume(_Symbol,_Period,VOLUME_TICK); 
   ArraySetAsSeries(myPriceArray,true);
   CopyBuffer(VolumesDefinition,0,0,3,myPriceArray);
   float CurrentVolumeValue=(myPriceArray[0]);
   float LastVolumesValue = (myPriceArray[1]);
   
   if(CurrentVolumeValue>LastVolumesValue){
      filter="positive";
   }
   if(CurrentVolumeValue<LastVolumesValue){
      filter="negative";
   }
   
   return filter;
}


void OnTick(){
   string filter = CheckFilter();
   Alert(filter);
} 

It returns me nothing :(

 
abricot911:

hello,

can you help me please :)

It returns me nothing :(

put in an else statement int error=GetLastError() then Print(error) to see why.

 
  1. This is the MT4 forum.
    1. The function does not return a handle.

    2. Your code
       Documentation
         int VolumesDefinition = iVolume(
                  _Symbol,
                  _Period,
                  VOLUME_TICK
         );
      long  iVolume(
         string           symbol,          // symbol
         int              timeframe,       // timeframe
         int              shift            // shift
         );
      Not a proper shift.

    3. There is no copyBuffer, in the language.
    4. There is no VOLUME_TICK, in the language.

  2. In MT5, the function is: iVolumes, with a "s."
              Technical Indicators / iVolumes - Reference on algorithmic/automated trading language for MetaTrader 5
 
GetLastError returns me 4807 :/ 
 
William Roeder:
  1. This is the MT4 forum.
    1. The function does not return a handle.

    2. Your code
       Documentation
      long  iVolume(
         string           symbol,          // symbol
         int              timeframe,       // timeframe
         int              shift            // shift
         );
      Not a proper shift.

    3. There is no copyBuffer, in the language.
    4. There is no VOLUME_TICK, in the language.

  2. In MT5, the function is: iVolumes, with a "s."
              Technical Indicators / iVolumes - Reference on algorithmic/automated trading language for MetaTrader 5
MT5 forum is down sorry
 
Moving topic....
 
abricot911:
MT5 forum is down sorry
That doesn't make sense. mql4/MT4 forum is a sub-forum of mql5 on the same domain. So if "MT5 forum is down, MT4 is down too".