У меня есть скрипт в Pine, где bgcolor меняется, как с VWAP и MA. Нужно определить точку для длинной или короткой стратегии при изменении bgcolor - PullRequest
0 голосов
/ 09 апреля 2020

Пожалуйста, предложите по этому вопросу. Поможет в разработке стратегии. Я попытался с индексированием [], но это не сработало. Нравится bgcolor[0] bgcolor[1]

//@version=4
study("bull bear range", overlay=true)

bullBearColor = ((wma(close,10) < close) and ( wma(close,21) < close ) and ( close > vwap ) and ( rsi(close,7) >50 ) ) ? color.lime: ( (wma(close,10) > close) and ( wma(close,21) > close ) and ( close < vwap ) and ( rsi(close,7) < 35 ) ) ? color.red  :color.blue   
           // :((wma(close,10) < close) and ( wma(close,21) < close ) and ( close > vwap ) ) ? maroon   // Possible Bull
             //: ( (wma(close,10) > close) and ( wma(close,21) > close ) and ( close < vwap ) ) ? green    // Possible Bear
             //: gray                                     // Data Error

bgcolor(bullBearColor, transp=75)

//longCondition = (bullBearColor[0] == color.red or bullBearColor[0] == color.blue ) and bullBearColor[1] == color.lime

//shortCondition = (bullBearColor[0] == color.lime or bullBearColor[0] == color.blue ) and bullBearColor[1] == color.red
...