第一个 1 分钟柱的开盘和收盘
Open and close of the first 1 min bar
我知道在这里问不太可能,但我正在寻找一种方法来确定第一个 1 分钟的蜡烛是否为红色,这意味着柱线收盘价低于开盘价。
为此,我只需要第一个一分钟柱的开盘价和收盘价,但我还没有找到收盘价的方法。
获得开放相当简单:
def openValue = open(period = AggregationPeriod.DAY);
获取第一个柱的范围也相当简单,因为我们定义了一个范围(1 分钟)和 return 该范围的 high/low。
如果有人能提供帮助,我将不胜感激。
谢谢!
好的,有人帮我解决了。
def x = barNumber(); //bar
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
getTime() <= RegularTradingEnd(getYYYYMMDD());
def TodaysOpen = if RTH and !RTH[1]
then open
else TodaysOpen[1];
def OpenX = if RTH and !RTH[1]
then x
else double.nan;
def YesterdaysClose = if !RTH and RTH[1]
then close[1]
else YesterdaysClose[1];
def CloseX = if !RTH and RTH[1]
then x
else double.nan;
def HighToday = if RTH and !RTH[1]
then high
else if RTH and high > HighToday[1]
then high
else HighToday[1];
def HighX = if high == HighToday
then x
else double.nan;
def LowToday = if RTH and !RTH[1]
then low
else if RTH and low < LowToday[1]
then low
else LowToday[1];
def LowX = if low == LowToday
then x
else double.nan;
plot OpenToday = if barNumber() >= HighestAll(OpenX)
then HighestAll(if isNaN(close[-1])
then TodaysOpen
else double.nan)
else double.nan;
OpenToday.SetStyle(Curve.Long_Dash);
def firstbarclose = if RTH and !RTH[1]
then close
else firstbarclose[1];
plot CloseBar = if barNumber() >= HighestAll(OpenX)
then HighestAll(if isNaN(close[-1])
then firstbarclose
else double.nan)
else double.nan;
closebar.SetStyle(Curve.Long_Dash);
我知道在这里问不太可能,但我正在寻找一种方法来确定第一个 1 分钟的蜡烛是否为红色,这意味着柱线收盘价低于开盘价。
为此,我只需要第一个一分钟柱的开盘价和收盘价,但我还没有找到收盘价的方法。
获得开放相当简单:
def openValue = open(period = AggregationPeriod.DAY);
获取第一个柱的范围也相当简单,因为我们定义了一个范围(1 分钟)和 return 该范围的 high/low。
如果有人能提供帮助,我将不胜感激。
谢谢!
好的,有人帮我解决了。
def x = barNumber(); //bar
def RTH = getTime() >= RegularTradingStart(getYYYYMMDD()) and
getTime() <= RegularTradingEnd(getYYYYMMDD());
def TodaysOpen = if RTH and !RTH[1]
then open
else TodaysOpen[1];
def OpenX = if RTH and !RTH[1]
then x
else double.nan;
def YesterdaysClose = if !RTH and RTH[1]
then close[1]
else YesterdaysClose[1];
def CloseX = if !RTH and RTH[1]
then x
else double.nan;
def HighToday = if RTH and !RTH[1]
then high
else if RTH and high > HighToday[1]
then high
else HighToday[1];
def HighX = if high == HighToday
then x
else double.nan;
def LowToday = if RTH and !RTH[1]
then low
else if RTH and low < LowToday[1]
then low
else LowToday[1];
def LowX = if low == LowToday
then x
else double.nan;
plot OpenToday = if barNumber() >= HighestAll(OpenX)
then HighestAll(if isNaN(close[-1])
then TodaysOpen
else double.nan)
else double.nan;
OpenToday.SetStyle(Curve.Long_Dash);
def firstbarclose = if RTH and !RTH[1]
then close
else firstbarclose[1];
plot CloseBar = if barNumber() >= HighestAll(OpenX)
then HighestAll(if isNaN(close[-1])
then firstbarclose
else double.nan)
else double.nan;
closebar.SetStyle(Curve.Long_Dash);