fractal_mtf

fractal_mtf 最新版

官方版 无广告 78

更新日期:2022-03-14 分类标签: 语言:中文 平台:没限制

5 人已下载 手机查看

//+------------------------------------------------------------------+
//| MTF_Fractals.mq4 |
//| ?011 Best-metatrader-indicators.com. All rights reserved |
//| http://www.best-metatrader-indicators.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2011 Best-metatrader-indicators.com."
#property link "http://www.best-metatrader-indicators.com"
//----
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Tomato

extern string TimeFrameNote="TimeFrame =0 - Current Timeframe, =1 - 1MIN, =5 - 5MIN, =5 - 5MIN, =15 - 15MIN, =30 - 30MIN, =60 - 1H, =240 - 4H, =1440 - D1, =10080 - W1, =43200 - MN1";
extern int TimeFrame=0;
double ExtMapBuffer1[];
double ExtMapBuffer2[];
string Copyright="\xA9 WWW.BEST-METATRADER-INDICATORS.COM";
string MPrefix="FI";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,119);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,119);
//---- 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("Fractals "+TimeFrameStr);
DL("001", Copyright, 5, 20,Gold,"Arial",10,0);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ClearObjects();
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+TimeFrame/Period();
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iFractals(NULL,TimeFrame,1,y);
ExtMapBuffer2[i]=iFractals(NULL,TimeFrame,2,y);
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| DL function |
//+------------------------------------------------------------------+
void DL(string label, string text, int x, int y, color clr, string FontName = "Arial",int FontSize = 12, int typeCorner = 1)

{
string labelIndicator = MPrefix + label;
if (ObjectFind(labelIndicator) == -1)
{
ObjectCreate(labelIndicator, OBJ_LABEL, 0, 0, 0);
}

ObjectSet(labelIndicator, OBJPROP_CORNER, typeCorner);
ObjectSet(labelIndicator, OBJPROP_XDISTANCE, x);
ObjectSet(labelIndicator, OBJPROP_YDISTANCE, y);
ObjectSetText(labelIndicator, text, FontSize, FontName, clr);

}

//+------------------------------------------------------------------+
//| ClearObjects function |
//+------------------------------------------------------------------+
void ClearObjects()
{
for(int i=0;i<ObjectsTotal();i++)
if(StringFind(ObjectName(i),MPrefix)==0) { ObjectDelete(ObjectName(i)); i--; }
}
//+------------------------------------------------------------------+

相关资源

暂无评论

暂无评论...