Скрипт ThinkOrSwim для watchlist
Ищет базы на круглых уровнях, кратных 10 центам или на вчерашних ценовых экстремумах дня. Имеет 4 сигнала для индикации.
#Base_Level_PrevHiLow.Ищет базу, на уровнях 10-20-30 или на вчерашних HiLow
def iDiff = 0.01; #максимальное отклонение в центах
def iBars = 4; #число баров для просмотра
def iLowest = lowest(low,iBars);
def iHighest = highest(high,iBars);
def iHiPrevDay = high(period = «DAY»)[1];
def iLowPrevDay = Low(period = «DAY»)[1];
def bBaseLow = fold Lbar = 0 to iBars with Lsumm=1 do if ((low[Lbar]-iLowest)<=iDiff) then Lsumm*1 else Lsumm*0;
def bBaseHigh = fold Hbar = 0 to iBars with Hsumm=1 do if ((iHighest-high[Hbar])<=iDiff) then Hsumm*1 else Hsumm*0;
def iLevelLow = fold LLbar = 0 to iBars with LLsumm do if (low[LLbar] == roundDown(low[LLbar],1)) then LLsumm+1 else LLsumm;
def iLevelHigh = fold LHbar = 0 to iBars with LHsumm do if (high[LHbar] == roundUp(High[LHbar],1)) then LHsumm+1 else LHsumm;
def iDayLow = fold DLbar = 0 to iBars with DLsumm do if (Low[DLbar] == iHiPrevDay) then DLsumm+1 else DLsumm;
def iDayHigh = fold DHbar = 0 to iBars with DHsumm do if (High[DHbar] == iLowPrevDay) then DHsumm+1 else DHsumm;
plot bBase = if (bBaseLow and iLevelLow ) then 1 else if (bBaseHigh and iLevelHigh ) then 2 else if (bBaseLow and iDayLow) then 3 else if (bBaseHigh and iDayHigh) then 4 else 100;
AssignBackgroundColor (if (bBase == 1 or bBase == 3) then Color.LIGHT_GREEN else if (bBase == 2 or bBase == 4) then Color.LIGHT_RED else Color.black);
Полная библиотека индикаторов в нашем блоге goo.gl/9JRWUiчитать дальше на смартлабе