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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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);
}
//+------------------------------------------------------------------+