custom indicator such as MTF_Moving average AutoRefresh cannot be correctly compiled and used in the version 851 !!!!!

Back to topics list To post a new topic, please log in or register
avatar
13
zh_mingbo 2015.08.03 05:29
 
attached
Attached files:
  moving_average_mtf.mq4  (3.20 KB)
avatar
13
zh_mingbo 2015.08.03 05:30 #
 
autorefresh
Attached files:
  autorefresh.mq4  (1.22 KB)
avatar
13009
WHRoeder 2015.08.03 16:00 #
 
Nothing to do with 851 (you get these errors on 840 also)
int deinit()  
   {
   return;
   }
function must return a value autorefresh.mq4
You can't figure out what to do about that? learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
   int    i,shift,limit,y=0,counted_bars=IndicatorCounted();
variable 'shift' not used moving_average_mtf.mq4
You can't figure out what to do about that? learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.

avatar
13
zh_mingbo 2015.08.03 16:39 #
 
it's a warning message, not a error, so pass the compiler, and output is correct oin 840, i'm the user, i'm get the output, buddy
avatar
13
zh_mingbo 2015.08.03 16:52 #
 
//+------------------------------------------------------------------+
//|                                                  AutoRefresh.mq4 |
//|                                                           Ttomas |
//|                                                 TradeLikeAPro.ru |
//+------------------------------------------------------------------+
#property copyright "Ttomas"
#property link      "TradeLikeAPro.ru"

#define  WM_COMMAND                    0x0111
#property indicator_chart_window
#import "user32.dll"
   int   RegisterWindowMessageA(string lpstring);
   int   PostMessageA(int  hWnd,int  Msg,int  wParam,string lParam);
#import
extern int PeriodSec=30;
static int tic=0;
int init()
   {
   PeriodSec*=1000;
   return(0);
   }
int deinit()  
   {
   return;
   }
int start()
   {
   if (tic==0) tic=GetTickCount();
   int k=GetTickCount();
   if (MathAbs(k-tic)>PeriodSec)
      {
      PostMessageA (WindowHandle (Symbol(), Period()), WM_COMMAND, 33324, 0);
      PostMessageA (WindowHandle (Symbol(), 0), RegisterWindowMessageA ("MetaTrader4_Internal_Message"), 2, 1);
      tic=GetTickCount();
      }
   return(0);
   }
//+------------------------------------------------------------------+

avatar
13
zh_mingbo 2015.08.03 16:53 #
 
//+------------------------------------------------------------------+
//|                                            MTF_MovingAverage.mq4 |
//|      Copyright ?2011 Forex-indikatoren.com. All rights reserved |
//|                                 http://www.forex-indikatoren.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2011 Forex-indikatoren.com."
#property link      "http://www.forex-indikatoren.com"

//----
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- input parameters

extern string TimeFrameNote="TimeFrame =0 - Current Timeframe, =1 - 1MIN, =5 - 5MIN, =15 - 15MIN, =30 - 30MIN, =60 - 1H, =240 - 4H, =1440 - D1, =10080 - W1, =43200 - MN1";
extern int TimeFrame=240;
extern int MAPeriod=13;
extern int ma_shift=0;
extern int ma_method=MODE_SMA;
extern int applied_price=PRICE_CLOSE;
//----
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label   
   switch(ma_method)
     {
      case 1 : short_name="MTF_EMA("; break;
      case 2 : short_name="MTF_SMMA("; break;
      case 3 : short_name="MTF_LWMA("; break;
      default : short_name="MTF_SMA(";
     }
   switch(TimeFrame)
     {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
     }
   IndicatorShortName(short_name+MAPeriod+") "+TimeFrameStr);
    
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,shift,limit,y=0,counted_bars=IndicatorCounted();
   // Plot defined timeframe on to current timeframe   
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
//----
   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
     {
      if (Time[i]<TimeArray[y]) y++;
      //----
      ExtMapBuffer1[i]=iMA(NULL,TimeFrame,MAPeriod,ma_shift,ma_method,applied_price,y);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Back to topics list  

To add comments, please log in or register