客服热线:18391752892

MT4授课11月19日 趋势线对象的应用 课堂实例代码

   日期:2019-01-12     浏览:965    
马上注册,结交更多好友,下载更多资源

您需要 登录 才可以下载或查看,没有帐号?注册 //+------------------------------------------------------------------+
//| 指标举例.mq4 |
//| Copyright ?2007, 520FX Corp. |
//| http://www.520fx.com |
//+------------------------------------------------------------------+
#property copyright Copyright ?2007, 520FX Corp.
#property link http://www.520fx.com
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 White
#property indicator_color2 Yellow
#property indicator_color3 Yellow
#property indicator_color4 Yellow
#property indicator_color5 Yellow
extern int Ma=12;
extern int Ma1=36;
double MaLine[],Ma1Line[],Up[],Dn[],Tmp[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(5);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(3,DRAW_ARROW);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(0,MaLine);
SetIndexBuffer(1,Ma1Line);
SetIndexBuffer(2,Up);
SetIndexBuffer(3,Dn);
SetIndexBuffer(4,Tmp);
SetIndexArrow(2,233);
SetIndexArrow(3,234);
//CreatTrendLine( 趋势线 ,15,High[15],5,Low[5],Yellow);
for(int i=0;i=0;i--)
{
MaLine=iMA(NULL,0,Ma,0,MODE_SMA,PRICE_CLOSE,i);
Ma1Line=iMA(NULL,0,Ma1,0,MODE_SMA,PRICE_CLOSE,i);
}
for (i=limit-1;i i--)
{
if(MaLine[i+1]Ma1Line)
{
Up=Low-2*Point;
}
if(MaLine[i+1] Ma1Line[i+1] MaLine=0;i--)
{
Tmp=Low[iLowest(NULL,0,MODE_LOW,18,i)];
}
//----
return(0);
}
//+------------------------------------------------------------------+
void writetext(string Labelname,string data,int x,int y,color ColorValue,int FontSize)//通过Object写文字
{
ObjectDelete(Labelname);
ObjectCreate(Labelname, OBJ_LABEL, 0, 0, 0);
ObjectSetText(Labelname, data, FontSize, Arial , ColorValue);
ObjectSet(Labelname, OBJPROP_CORNER, 0);
ObjectSet(Labelname, OBJPROP_XDISTANCE, x);
ObjectSet(Labelname, OBJPROP_YDISTANCE, y);
}
void CreatText(string objName,int i,double data,string Chars)//画K线文字
{
ObjectDelete(objName);
ObjectCreate(objName, OBJ_TEXT, 0, Time, data);
ObjectSetText(objName, Chars, 10, Arial ,DodgerBlue);
}
void CreatLine(string objName,double Data,color Cl)
{
ObjectDelete(objName);
ObjectCreate(objName,OBJ_HLINE,0,Time[0],Data);
ObjectSet(objName,OBJPROP_COLOR,Cl);
}
void CreatTrendLine(string objName,int x,double Data,int y,double data1,color Cl)
{
ObjectDelete(objName);
ObjectCreate(objName,OBJ_TREND,0,Time[x],Data,Time[y],data1);
ObjectSet(objName,OBJPROP_COLOR,Cl);
}

外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!


特别提示:本信息由相关企业自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


0相关评论
相关行情
推荐行情
点击排行