Indicator problem

 
Hi:

I cut and past one of the indicator from this site and inbed it in my expert. However, I have a difficulty geting it to work.

Here is the setup.
// -------------------------Property---------------------------------
#property indicator_color1 Blue // Medium at max or min
#property indicator_chart_window
#property indicator_buffers 1

// ------------------------Indicator buffer--------------------------
double MediumBuff[];







int init()
{
string mat;
// MA
IndicatorBuffers(1);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, MediumBuff);
SetIndexDrawBegin(0, MediumFreq);
}



int mediumMaxMin()
{

if(Bars <= MA_timeframe)
return(0);
int fixed_bars = IndicatorCounted();
if(fixed_bars < 0)
return(-1);
if(fixed_bars > 0)
fixed_bars--;
int limit = Bars - fixed_bars;
for(int i = 0; i < limit ; i++)
{
MediumBuff[i] = 1.9000; // test number
}
return(0);
}


I made a call to mediumMaxMin() from my main program. Help is appriciated.
 
I am having same problem. Let me know if anyone helps you. Thanks, Stdummy
 
This source is not an indicator. Each indicator must have the function start(), that is called on every tick, but there is not it.
Rename function mediumMaxMin() to start() and try again. See help.
 
Rosh wrote:
This source is not an indicator. Each indicator must have the function start(), that is called on every tick, but there is not it.
Rename function mediumMaxMin() to start() and try again. See help.

Rosh, I cannot get my indicators to work after I download on to MT4 platform. It will show on chart but the indicator will not work. Thanks PS. The indicators I am referring to are from this website. 
 
I'm crying above this code, where are you get it :(

//+------------------------------------------------------------------+
//|                                               black_building.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
// -------------------------Property---------------------------------
#property  indicator_chart_window
#property  indicator_color1  Blue        // Medium at max or min
#property  indicator_buffers 1
 
int MediumFreq=10;
int MA_timeframe;
// ------------------------Indicator buffer--------------------------
double MediumBuff[];
 
 
 
 
 
 
 
int init()
  {
   string mat;
   MA_timeframe=Period();
   IndicatorBuffers(1);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, MediumBuff);
   SetIndexDrawBegin(0, MediumFreq);
}
 
 
 
int start()
  {
 
   if(Bars <= MA_timeframe)
       return(0);
   int fixed_bars = IndicatorCounted();
   if(fixed_bars < 0)
       return(-1);
   if(fixed_bars > 0)
       fixed_bars--;
   int limit = Bars - fixed_bars;
   for(int i = 0; i < limit ; i++)
     {
       MediumBuff[i] = 1.9000; // test number
     }  
    return(0);
  }


Now it works (draws linie at price 1.9000 GBPUSD chart

)
 
Rosh wrote:
I'm crying above this code, where are you get it :(

//+------------------------------------------------------------------+
//|                                               black_building.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net// |
//+------------------------------------------------------------------+
// -------------------------Property---------------------------------
#property  indicator_chart_window
#property  indicator_color1  Blue        // Medium at max or min
#property  indicator_buffers 1
 
int MediumFreq=10;
int MA_timeframe;
// ------------------------Indicator buffer--------------------------
double MediumBuff[];
 
 
 
 
 
 
 
int init()
  {
   string mat;
   MA_timeframe=Period();
   IndicatorBuffers(1);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, MediumBuff);
   SetIndexDrawBegin(0, MediumFreq);
}
 
 
 
int start()
  {
 
   if(Bars <= MA_timeframe)
       return(0);
   int fixed_bars = IndicatorCounted();
   if(fixed_bars < 0)
       return(-1);
   if(fixed_bars > 0)
       fixed_bars--;
   int limit = Bars - fixed_bars;
   for(int i = 0; i < limit ; i++)
     {
       MediumBuff[i] = 1.9000; // test number
     }  
    return(0);
  }


Now it works (draws linie at price 1.9000 GBPUSD chart

)

 
Thank for all of the comments, Rosh and stdummy. I was able to hack my way and make it works. I realy appricicate all of the comments.
Reason: