Dear All,
I have modified one indicator to form a overlay basket of the price levels of EU,EJ & UJ. This indicator is calculating and showing the desired results while offline. When we go for live it is keep on updating and showing no price difference between these basket. I am attaching the indicator herewith can anyone modify the indicator basket so that it would not recalculate continuously.
//+------------------------------------------------------------------+
//| FlatTrend.mq4 |
//| Kirk Sloan |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Kirk Sloan"
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 LimeGreen
#property indicator_color3 Gold
//---- input parameters
extern string Pair ="EURJPY";
extern bool ShowPair1= false;
extern string Pair1="USDJPY";
extern bool ShowPair2= false;
extern string Pair2="EURUSD";
extern int Minutes=0;
extern int MA_Duration=1;
extern int MaxBarsToCount = 120;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double Ma;
double PADX,NADX,CLLO,HILO;
string TimeFrameStr;
int digit = 1;
int i,limit;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
SetIndexLabel(0,Pair);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1, LimeGreen);
SetIndexLabel(1,Pair1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1, Gold);
SetIndexLabel(2,Pair2);
SetIndexBuffer(2,ExtMapBuffer3);
IndicatorDigits(2);
switch(Minutes)
{
case 1 : 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"; Minutes=0;
}
IndicatorShortName(" Correlation Trend ("+Pair+")");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
limit = IndicatorCounted();
if(limit < 0) return(0);
if(limit > 0) limit--;
limit = MathMin(Bars - limit, MaxBarsToCount);
for(i=limit;i>=0; i--){
ExtMapBuffer1[i]=0;
ExtMapBuffer2[i]=0;
ExtMapBuffer3[i]=0;
Ma+=iMA(Pair1,Minutes,1,0,MODE_SMA,PRICE_CLOSE,i)-iMA(Pair1,Minutes,1,0,MODE_SMA,PRICE_OPEN,i);
PADX+=iMA(Pair,Minutes,1,0,MODE_SMA,PRICE_CLOSE,i)-iMA(Pair,Minutes,1,0,MODE_SMA,PRICE_OPEN,i);
NADX+=iMA(Pair2,Minutes,1,0,MODE_SMA,PRICE_CLOSE,i)-iMA(Pair2,Minutes,1,0,MODE_SMA,PRICE_OPEN,i);
double digits=1/(MarketInfo(Pair,MODE_POINT)*10);
double digits1=1/(MarketInfo(Pair1,MODE_POINT)*10);
double digits2=1/(MarketInfo(Pair2,MODE_POINT)*10);
ExtMapBuffer1[i]=(PADX*digits);
if (ShowPair1){
ExtMapBuffer2[i]=(Ma*digits1);
}else{
ExtMapBuffer2[i]=EMPTY_VALUE;
}
if (ShowPair2){
ExtMapBuffer3[i]=NADX*digits2;
}else{
ExtMapBuffer3[i]=EMPTY_VALUE;
}
}
//----
return(0);
}
//+----------------------------------------------------------------------------------------------------+
I have modified one indicator to form a overlay basket of the price levels of EU,EJ & UJ. This indicator is calculating and showing the desired results while offline. When we go for live it is keep on updating and showing no price difference between these basket. I am attaching the indicator herewith can anyone modify the indicator basket so that it would not recalculate continuously.
//+------------------------------------------------------------------+
//| FlatTrend.mq4 |
//| Kirk Sloan |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Kirk Sloan"
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 LimeGreen
#property indicator_color3 Gold
//---- input parameters
extern string Pair ="EURJPY";
extern bool ShowPair1= false;
extern string Pair1="USDJPY";
extern bool ShowPair2= false;
extern string Pair2="EURUSD";
extern int Minutes=0;
extern int MA_Duration=1;
extern int MaxBarsToCount = 120;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double Ma;
double PADX,NADX,CLLO,HILO;
string TimeFrameStr;
int digit = 1;
int i,limit;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
SetIndexLabel(0,Pair);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1, LimeGreen);
SetIndexLabel(1,Pair1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,1, Gold);
SetIndexLabel(2,Pair2);
SetIndexBuffer(2,ExtMapBuffer3);
IndicatorDigits(2);
switch(Minutes)
{
case 1 : 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"; Minutes=0;
}
IndicatorShortName(" Correlation Trend ("+Pair+")");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
limit = IndicatorCounted();
if(limit < 0) return(0);
if(limit > 0) limit--;
limit = MathMin(Bars - limit, MaxBarsToCount);
for(i=limit;i>=0; i--){
ExtMapBuffer1[i]=0;
ExtMapBuffer2[i]=0;
ExtMapBuffer3[i]=0;
Ma+=iMA(Pair1,Minutes,1,0,MODE_SMA,PRICE_CLOSE,i)-iMA(Pair1,Minutes,1,0,MODE_SMA,PRICE_OPEN,i);
PADX+=iMA(Pair,Minutes,1,0,MODE_SMA,PRICE_CLOSE,i)-iMA(Pair,Minutes,1,0,MODE_SMA,PRICE_OPEN,i);
NADX+=iMA(Pair2,Minutes,1,0,MODE_SMA,PRICE_CLOSE,i)-iMA(Pair2,Minutes,1,0,MODE_SMA,PRICE_OPEN,i);
double digits=1/(MarketInfo(Pair,MODE_POINT)*10);
double digits1=1/(MarketInfo(Pair1,MODE_POINT)*10);
double digits2=1/(MarketInfo(Pair2,MODE_POINT)*10);
ExtMapBuffer1[i]=(PADX*digits);
if (ShowPair1){
ExtMapBuffer2[i]=(Ma*digits1);
}else{
ExtMapBuffer2[i]=EMPTY_VALUE;
}
if (ShowPair2){
ExtMapBuffer3[i]=NADX*digits2;
}else{
ExtMapBuffer3[i]=EMPTY_VALUE;
}
}
//----
return(0);
}
//+----------------------------------------------------------------------------------------------------+