iBolls()函数获取布林指标数据
Wen Tao Xiong:
iBolls()函数获取布林指标数据
iBolls()函数获取布林指标数据
谢谢回复,不过MT5没有这个函数。这个函数可能是mt4的吧?
供参考:
//+------------------------------------------------------------------+ //| test_iBands.mq5 | //| Copyright 2021,fxMeter | //| https://www.mql5.com/zh/users/fxmeters | //+------------------------------------------------------------------+ #property copyright "Copyright 2021,fxMeter" #property link "https://www.mql5.com/zh/users/fxmeters" #property version "1.00" input int bands_period = 20; // period for average line calculation input double deviation = 2.0; // number of standard deviations input ENUM_APPLIED_PRICE applied_price = PRICE_CLOSE; // type of price or handle int handle = -1; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- handle = iBands(Symbol(),PERIOD_CURRENT,bands_period,0,deviation,applied_price); if(handle == -1) { return(INIT_FAILED); } //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- //1.获取最近3个K线的布林线上轨 double upper[]; ArraySetAsSeries(upper,true); if(CopyBuffer(handle,UPPER_BAND,0,3,upper) == 3) { } //2.获取最近3个K线的布林线下轨 double lower[]; ArraySetAsSeries(lower,true); if(CopyBuffer(handle,LOWER_BAND,0,3,lower) == 3) { } } //+------------------------------------------------------------------+
附加的文件:
test_iBands.mq5
5 kb
Ziheng Zhuang:
感谢启发,已解决,谢谢你!!!
供参考:
mt5 当前布林线上线的值如何获取?代码?
我想实现当价格上穿布林线上线时自动买进,请高手不吝赐教。谢谢!