1. 首页
  2. 易语言 - EasyLanguage
  3. 日线与日内 Daily vs. Intraday

日线与日内 Daily vs. Intraday

The posted code plots the daily intrabar average and daily bar average. The chart image shows that the two values are almost the same. The adjusted daily bar close can be slightly different than the intrabar end of day close.

{ 
Indicator name: F_DailyAvgIntrabarChart 
Plots: Daily average on intrabar daily close is yellow (data1),  
       and Daily average on daily bar is magenta (data2). 
Function called: F_dailyAvgIntrabarChart   
} 
 
input: dailyAvgLength(15),       // length of daily average 
       mySessionCloseTime(1615); // daily close time on intrabar chart  
 
var: dailyIntrabarAvg(0),dailyBarAvg(0,data2); 
 
dailyIntrabarAvg = F_dailyAvgIntrabarChart(dailyAvgLength, mySessionCloseTime);  
dailyBarAvg = average(close of data2, dailyAvgLength); 
 
if dailyIntrabarAvg > 0 then begin 
   plot1(dailyIntrabarAvg,"DailyAvg1",yellow);  // Daily average on intrabar daily close is yellow (data1) 
   plot2(dailyBarAvg,"DailyAvg2",magenta);      // Daily average on daily bar is magenta (data2)  
end; 

If the intraday chart closes earlier than the daily bar, then an exception will be thrown since the two end times do not match. This will be the case for ES if the daily chart is on a @ES.D symbol which has an end exchange time of 1515, and the daily bar has an end time of 1615. If the intraday and daily bar end times are different, then the daily average can be calculated on the daily bar (data2), as the indicator shows.

ELD file contains F_DailyAvgInrabarChart indicator and function called by indicator.

更新于 2020年5月21日

这篇文章对您有帮助吗?

相关的话题

留言评论