Download MetaTrader 5

Help needed with indicator that will not refresh

To add comments, please log in or register
No time for trading? Subscribe to signals!
davidvb
6
davidvb 2016.02.07 01:00 

Hi There.

I made this indicator which works OK on historical charts, but will not refresh when new ticks come along. The only way I can get it to refresh is to switch time frames. 

Any help would be greatly appreciated 

 

David

 

 #property  copyright "Copyright © 2004, MetaQuotes Software Corp."

#property  link      "http://www.metaquotes.net/"


#property  indicator_separate_window

#property  indicator_buffers 1

#property  indicator_color1  Silver

#property  indicator_width1  2


double     Buffer[];


 int period = 15;

 int Mode = 0;           // 0= MA, 1=EMA, 2=SMMA, 3=LWMA

 int Price = 5;    //0=Close, 4=Median, 5=Typical, 6=Weighted


 int init()

  {


   IndicatorBuffers(1);

   

   SetIndexStyle(0,DRAW_HISTOGRAM);

   SetIndexDrawBegin(0,9);

   IndicatorDigits(Digits+2);

   SetIndexBuffer(0,Buffer);

   return(0);

  }

  


  int deinit()

 {

   return(0);

  }

 

 int start()

  {

   

   int limit;

   int counted_bars=IndicatorCounted(); 

   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;


   for(int i=0; i<limit; i++)

     

             {

     

     Buffer[i]= iClose("EURJPY",0,i) - (iClose("AUDUSD",0,i) *     

                (iMA("EURJPY",0,period,0,Mode,Price,i+1) / iMA("AUDUSD",0,period,0,Mode,Price,i+1)));

           

          }

      return(0);

     }

//+------------------------------------------------------------------+

MetaTrader 5 Trading Platform / MetaQuotes Software Corp.
  • www.metaquotes.net
MetaTrader 5 trading platform designed to arrange brokerage services in Forex, CFD, Futures, as well as equity markets
To add comments, please log in or register