1

我知道在这里问很远,但我正在寻找一种方法来确定前 1 分钟的蜡烛是否为红色,这意味着柱线收盘价低于开盘价。

为此,我只需要前一分钟柱的开盘价和收盘价,但我还没有找到收盘的方法。

开放是相当直截了当的:

def openValue = open(period = AggregationPeriod.DAY);

获取第一个柱的范围也相当简单,因为我们定义了一个范围(1 分钟)并返回该范围的高/低。

如果有人可以提供帮助,我将不胜感激。

谢谢!

4

1 回答 1

0

好的,有人帮我弄清楚了。

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); 
于 2020-09-20T08:56:42.533 回答