Формула 6



#Формула 6

#База из 5 последних свечей, привязанные к уровням 50 и 100.

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

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

#Автор неизвестен. Найдено на сайте

def iDiff = 0.01; #максимальное отклонение в центах

def iLowest = lowest(low,5);

def iHighest = highest(high,5);

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)

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)

then 1 else 0; 

def bFigureLow = if

(low[1] == (Floor(low[1]*2))/2) or

(low[2] == (Floor(low[2]*2))/2) or

(low[3] == (Floor(low[3]*2))/2) or

(low[4] == (Floor(low[4]*2))/2) or

(low[5] == (Floor(low[5]*2))/2)

then 1 else 0;

def bFigureHigh = if

(high[1] == (Ceil(high[1]*2))/2) or

(high[2] == (Ceil(high[2]*2))/2) or

(high[3] == (Ceil(high[3]*2))/2) or

(high[4] == (Ceil(high[4]*2))/2) or

(high[5] == (Ceil(high[5]*2))/2)

then 1 else 0;

plot bBase = if (bBaseLow and bFigureLow) then 1 else if (bBaseHigh and bFigureHigh) then 2 else 0;

AssignBackgroundColor (if (bBase == 1) then Color. LIGHT_GREEN else if (bBase == 2) then Color. LIGHT_RED else Color. black);

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