//--- 寻找活动时段的开始柱 //--- 形式为时间序列for(int bar=0;bar<rates_total;bar++) { //--- 选中的柱的时间 datetime curr_bar_time=time[bar]; user_date.DateTime(curr_bar_time); //--- 选中的柱的日期 datetime curr_bar_time_of_day=user_dat
基于当前时间帧的时间序列进行计算,其处理的价格数据随着计算类型而变化。 int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long ...
如果选择小周期值5,那么大周期值10的K线数量就不够。start=prev_calculated-1,能够保持最新K线波动时,均值能够更新。如果使用start=prev_calculated,最新K波动一次的时候读取price[prev_calculated-i]只能读取波动的那一次。再次波动的时候for循环不会再执行,因为prev_calculated已经不小于rates_total。这样这两种计算...
for(int i=start; i<rates_total && !IsStopped(); i++){double haOpenVal =(haOpen[i-1]+haClose[i-1])/2;double haCloseVal=(open[i]+high[i]+low[i]+close[i])/4;double haHighVal =MathMax(high[i],MathMax(haOpenVal,haCloseVal));double haLowVal =MathMin(low[i],MathMin(ha...
(0); } //+---+ //| 自定义指标迭代函数 | //+---+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], 我们来检查一下编写彩色指标的细节: #property indicator_buffers 2 ///指...
{return(rates_total); } 版本2: intOnCalculate(constintrates_total,constintprev_calculated,constintbegin,constdouble&price[]) {return(rates_total); } 此函数的第一个版本的参数中包括 time[] 数组,而该数组中的元素则包含所有柱的时间。 使用第二个版本时,以及编制 EA 程序、安排对于从指标到其它时间...
MQL5真是大势所趋啊,很高级,很智能
for(int i=start;i<rates_total;i++) { if(bMaBuffer[i]>close[i-1]) bColorBuffer[i]=1.0; else bColorBuffer[i]=0.0; if(bMaBuffer1[i]>close[i-1]) bColorBuffer1[i]=1.0; else bColorBuffer1[i]=0.0; } return(rates_total); ...
(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int ...
int OnCalculate(const int _rates_total, const int _prev_calculated, const int _begin, const double& _price[ ] ){ int start, i;// 如果屏幕上的柱数少于平均周期,计算无法进行: if( _rates_total < maperiod="" ) ="" { ="">return( 0 ); }// 确定指标缓冲区计算的初始柱: if( _prev...