MQL4自编指标学习4-OnCalculate()参数的学习

OnCalculate()函数在自定义指标中用于根据Calculate事件计算指标值,通常在接收到新tick时触发。open[], high[], low[], close[]参数包含当前时间帧的开盘价、最高价、最低价和收盘价数组。time[]包含开盘时间,spread[]包含交易品种的历史点差。volume[]和tick_volume[]分别存储交易量和tick量历史。返回值与prev_calculated参数的关系允许实现经济高效的算法,避免对未变化的条形重复计算。若价格数据自上次OnCalculate()调用后改变,prev_calculated将被设置为零。" 115859115,10330702,LeetCode 动态规划解决数组区间问题,"['动态规划', 'LeetCode', '数组问题']
摘要由CSDN通过智能技术生成

The OnCalculate() function is called only in custom indicators when it's necessary to calculate the indicator values by the Calculate event. This usually happens when a new tick is received for the symbol, for which the indicator is calculated.

Parameters of open[], high[], low[] and close[] contain arrays with open prices, high and low prices and close prices of the current time frame. The time[] parameter contains an array with open time values, the spread[] parameter has an array containing the history of spreads (if any spread is provided for the traded security). The parameters of volume[] and tick_volume[] contain the history of trade and tick volume, respectively.

To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值