You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Mladen,
I want to do some similarity analysis in forex data.
I mean , I want to find out the most corrrelated 1 hourly bar ( same or most similar value in OHLC) bar to LAST 1 hourly bar(OHLC) in 20.000 bar(OHLC) history .
Is Pearson correlation coef. enough to find out the similarity of last bar value in 20.000 bar history?Is this possible to do this analysis in metatradervith a script(or EA) ?Thanks.
dear mlade:
i make my first MTF indicator
but color is black
how to fix it?
thank's very much
dear mlade:
i make my first MTF indicator
but color is black
how to fix it?
thank's very much
Hi Mladen,
I want to do some similarity analysis in forex data.
I mean , I want to find out the most corrrelated 1 hourly bar ( same or most similar value in OHLC) bar to LAST 1 hourly bar(OHLC) in 20.000 bar(OHLC) history .
Is Pearson correlation coef. enough to find out the similarity of last bar value in 20.000 bar history?Is this possible to do this analysis in metatradervith a script(or EA) ?Thanks.
Mladen,
Any comment on that?
Mladen,
Any comment on that?
Set the #property indicator_color1 to desired color (it is set to Black now)
mr mladen:
i do it but only have one color
i need two color for bull &bear market
mr mladen:
i do it but only have one color
i need two color for bull &bear market
Then you have to code it differently (you have to use two buffers not just one for two color histogram)
is it correct sir?
//+------------------------------------------------------------------+
//| MTF_xb4d.mq4 |
//|------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_width1 2
#property indicator_color2 PaleVioletRed
#property indicator_width2 2
//---- input parameters
/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------*/
extern int TimeFrame=0;
extern int period = 10;
extern int AppliedPrice=0;
extern bool SoundAlerts=false;
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexStyle(1, DRAW_HISTOGRAM);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexBuffer(1, ExtMapBuffer1);
//---- name for DataWindow and indicator subwindow label
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(" MTF_xb4d ( "+TimeFrameStr+" ) ");
return(0);
}
//----
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit= Bars-1;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator time frame
Rule 3: Use 'y' for your indicator's shift value
**********************************************************/
ExtMapBuffer1[i]=iCustom(Symbol(),TimeFrame,"xb4d",period,0,y);//iRSI(Symbol(),TimeFrame,period,AppliedPrice,y);
}
if(GlobalVariableGet(Symbol()+"previndicator")<0 && ExtMapBuffer1[0]>=0)
if(SoundAlerts){Alert("Buy Alert " + Symbol() + " [" + Period() + "] ");PlaySound("alert.wav");}
if(GlobalVariableGet(Symbol()+"previndicator")>=0 && ExtMapBuffer1[0]<0)
if(SoundAlerts){Alert("Sell Alert " + Symbol() + " [" + Period() + "] ");PlaySound("alert.wav");}
GlobalVariableSet(Symbol()+"previndicator",ExtMapBuffer1[0]);
return(0);
}
//+------------------------------------------------------------------+
is it correct sir?
//+------------------------------------------------------------------+
//| MTF_xb4d.mq4 |
//|------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LimeGreen
#property indicator_width1 2
#property indicator_color2 PaleVioletRed
#property indicator_width2 2
//---- input parameters
/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------*/
extern int TimeFrame=0;
extern int period = 10;
extern int AppliedPrice=0;
extern bool SoundAlerts=false;
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexStyle(1, DRAW_HISTOGRAM);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexBuffer(1, ExtMapBuffer1);
//---- name for DataWindow and indicator subwindow label
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(" MTF_xb4d ( "+TimeFrameStr+" ) ");
return(0);
}
//----
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit= Bars-1;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator time frame
Rule 3: Use 'y' for your indicator's shift value
**********************************************************/
ExtMapBuffer1[i]=iCustom(Symbol(),TimeFrame,"xb4d",period,0,y);//iRSI(Symbol(),TimeFrame,period,AppliedPrice,y);
}
if(GlobalVariableGet(Symbol()+"previndicator")<0 && ExtMapBuffer1[0]>=0)
if(SoundAlerts){Alert("Buy Alert " + Symbol() + " [" + Period() + "] ");PlaySound("alert.wav");}
if(GlobalVariableGet(Symbol()+"previndicator")>=0 && ExtMapBuffer1[0]<0)
if(SoundAlerts){Alert("Sell Alert " + Symbol() + " [" + Period() + "] ");PlaySound("alert.wav");}
GlobalVariableSet(Symbol()+"previndicator",ExtMapBuffer1[0]);
return(0);
}
//+------------------------------------------------------------------+
Is it showing colors the way you wanted it?
dear mladen:
i find mtf of it at https://www.forex-tsd.com/forum/debates-discussions/1131-multi-timeframe-indicators/page762#comment_1831838
thanks very much for your help to all member's
god bless your life