顺水外汇EA交易网MT4
标题:
【求助】请牛版/大侠修改此布林带上下轨穿越提示指标
[打印本页]
作者:
古月大师
时间:
2018-1-11 15:03
标题:
【求助】请牛版/大侠修改此布林带上下轨穿越提示指标
请牛版/大侠修改此布林带上下轨穿越提示指标。
望能给予帮助,谢谢!
说明:Bollinger Bands的参数,我的需求中设置的为:
时间周期:34,平移:-3,偏差:3,应用于:close
[attach]21236[/attach]
现有CVN Signal.mq4指标可以用做参考并据其修改。
该指标,用于对布林带上下轨被穿越时进行文字提示。其布林参数代码中为:(时间周期:20,平移:0,偏差:2).
[attach]21237[/attach]
该指标,源代码为:
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, GVC"
#property link "http://www.metaquotes.net"
#property indicator_chart_window
extern int xAxis = 0;
extern int yAxis = 60;
extern int FontSize = 10;
extern string FontType = "Comic Sans MS" ; //"Comic Sans MS";
extern string note2 = "Default Font Color";
extern color FontColor = Yellow;
extern int SizeBackGround = 50; // Size for background
extern int AlertCandle = 0; //
extern bool ShowChartAlerts = false; //
extern string AlertEmailSubject = ""; //
//
datetime LastAlertTime = -999999; //
//
string AlertTextCrossUp = "BUY"; //---- type your desired text between the quotes //
string AlertTextCrossDown = "SELL"; //---- type your desired text between the quotes //
//
//
//
// ============================================================================================================================================
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorShortName("Converge Signal");
//ExpertName=IndicatorShortName("Converge Signal");
//---- indicators
//Background
if(ObjectFind("Background")==-1)
{
ObjectCreate("Background",OBJ_LABEL,0,0,0);
ObjectSet("Background",OBJPROP_BACK,FALSE);
ObjectSet("Background",OBJPROP_YDISTANCE,11);
ObjectSet("Background",OBJPROP_XDISTANCE,0);
ObjectSetText("Background","g",SizeBackGround,"Webdings",CadetBlue);
}
if(ObjectFind("Background")==-1)
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll(0,OBJ_LABEL);
Comment(" " );
ObjectDelete("Background");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
double ibb0 = iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, 0);
double ibb1 = iBands(Symbol(), 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, 0);
string ls_12 = "BOB: ";
string ls_13 = " NoS";
if (High[0] > ibb0)ls_13= " Sell";
if (Low[0] 80) ls_15 = " Sell";
if (ist 75) ls_17 = " Sell";
ls_16 = ls_16 + ls_17;
//----------------------------------------------------------------------------------------------------------
// double l_iac = iAC(NULL, 0, 0);
// double l_iac1 = iAC(NULL, 0, 1);
// string ls_18 = "AC: ";
// string ls_19 = "No Signal ";
// if (l_iac1 l_iac) ls_19 = " Sell";
// ls_18 = ls_18 + ls_19;//
//---------------------------------------------------------
string ls_20 = "No Signal";
if (High[0] > ibb0 && ist > 80 && Irs1 > 75) ls_20 = "SELL";
if (High[0] > ibb0 && ist > 80 && Irs1 > 75)Alert(Symbol() + "---"+ DoubleToStr(Ask, Digits) + "---"+"Open Sell");
if (Low[0] < ibb1 && ist < 20 && Irs1 < 25) ls_20 = "BUY";
if (Low[0] < ibb1 && ist < 20 && Irs1 < 25)Alert(Symbol() + "---"+ DoubleToStr(Bid, Digits) + "---"+"Open Buy");
ObjectCreate("Signal", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Signal", ls_20, FontSize, FontType, FontColor);
//ObjectSet("Market_Price_Label", OBJPROP_CORNER, WhatCorner);
ObjectSet("Signal", OBJPROP_XDISTANCE, xAxis);
ObjectSet("Signal", OBJPROP_YDISTANCE, yAxis);
Comment("========","\n",
ls_12
+ "\n"
+ ls_14
+ "\n"
+ ls_16
+ "\n"
// + ls_18
+ "\n");
//----
//
//
return(0);
}
//+------------------------------------------------------------------+
前述,我的需求中,需将布林带设置为:时间周期:34,平移:-3,偏差:3,应用于:close。
问题:若直接将上面指标的源码,布林带部分修改为:
double ibb0 = iBands(Symbol(), 0, 34, 3, -3, PRICE_CLOSE, MODE_UPPER, 0);
double ibb1 = iBands(Symbol(), 0, 34, 3, -3, PRICE_CLOSE, MODE_LOWER, 0);
发现该指标就不起做作用了,并不能得到正确的提示信息。目测问题在于,获取布林上线轨的值出错。(平移为-3时,貌似获取上下轨值的方法不对?)
请牛版/大侠们,提供帮助,以解决我的问题,谢谢!~
基于源码修改,或重制作类似指标,都可以,最好能上传一下正确的mq4格式指标。
上面提到的CVN Signal.mq4指标如附件,请参考。
谢谢!~期待牛版/大侠您的帮助和回复啊!~
作者:
jiuhongzhi
时间:
2018-1-11 16:14
发现该指标就不起做作用了,并不能得到正确的提示信息。目测问题在于,获取布林上线轨的值出错。
作者:
SJH
时间:
2018-1-11 16:56
期待牛版/大侠您的帮助和回复啊!~
作者:
cxszzw
时间:
2018-1-11 17:53
谢谢分享
作者:
pszwgk@163.com
时间:
2018-1-11 18:31
谢谢分享
作者:
黄小溪
时间:
2018-1-11 20:00
来自安卓客户端
作者:
zrtzrt
时间:
2018-1-11 20:48
没看明白
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2