#Формула 10

#Базы из 8 последних свечей, на любых уровнях.

#Cнять галочку Include Extended Session

#Скачено с сайта

#Автор неизвестен.

def iDiff = 0.01;

def iLowest = lowest(low,8);

def iHighest = highest(high,8);

def bBaseLow = if 

((low[0]-iLowest)<=iDiff) and

((low[1]-iLowest)<=iDiff) and

((low[2]-iLowest)<=iDiff) and

((low[3]-iLowest)<=iDiff) and

((low[4]-iLowest)<=iDiff) and

((low[5]-iLowest)<=iDiff) and

((low[6]-iLowest)<=iDiff) and

((low[7]-iLowest)<=iDiff)

then 1 else 0; 

def bBaseHigh = if 

((iHighest-high[0])<=iDiff) and

((iHighest-high[1])<=iDiff) and

((iHighest-high[2])<=iDiff) and

((iHighest-high[3])<=iDiff) and

((iHighest-high[4])<=iDiff) and

((iHighest-high[5])<=iDiff) and

((iHighest-high[6])<=iDiff) and

((iHighest-high[7])<=iDiff)

then 1 else 0; 

plot bBase = if bBaseLow then 1 else if bBaseHigh then 2 else 0;

AssignBackgroundColor (if (bBase == 1) then Color. GREEN else if (bBase == 2) then Color. RED else Color. black);

bBase. AssignValueColor (if (bBase > 0) then Color. black else Color. CURRENT);