【发布时间】:2022-12-03 09:48:05
【问题描述】:
在一小时的时间范围内,我试图研究四天的每日蜡烛图,以了解趋势,以便在我应该卖出或买入股票时在 1 小时图表上创建一个指标。
我如何获取从一维分辨率的安全函数获取的系列的历史数据,以了解所有四个值的收盘价、开盘价、最高价和最低价。
但是对于从安全功能获得的系列中的所有索引,我得到了相同的值。
下面是代码:
//@version=5
indicator("My Script", overlay=true)
indexHighTf = barstate.isrealtime ? 1:0
indexCurrTf = barstate.isrealtime ? 0:1
d_timeframe_Close = request.security(syminfo.tickerid, "D", close[indexHighTf])[indexCurrTf]
d_timeframe_Open = request.security(syminfo.tickerid, "D", open[indexHighTf])[indexCurrTf]
d_timeframe_High = request.security(syminfo.tickerid, "D", high[indexHighTf])[indexCurrTf]
d_timeframe_Low = request.security(syminfo.tickerid, "D", low[indexHighTf])[indexCurrTf]
down_lowest = 0.00
down_id_lowest = 0.00
up_list = array.new_int(0)
up_highest = 0.00
up_id_highest = 0
up_low_of_heighest = 0.00
candle_start = 4
candle_end = 0
sell_alert = 0
if (d_timeframe_Open[candle_start]<d_timeframe_Close[candle_end])
count = 0
for i = candle_end to candle_start
if (d_timeframe_Open[i]<d_timeframe_Close[i])
if (count == 0)
count := count+1
up_highest := d_timeframe_High[i]
if (up_highest <= d_timeframe_High[i])
array.push(up_list, i)
up_highest := d_timeframe_High[i]
up_id_highest := i
up_low_of_heighest := d_timeframe_Low[up_id_highest]
if (open[0] > up_low_of_heighest and close[0] < up_low_of_heighest)
sell_alert := 1
plotshape(sell_alert, style=shape.triangledown, location=location.belowbar, text="Sell")
【问题讨论】: