12 штук?))) что ты там разглядишь то потом?))
declare upper;
input Sto_over_bought = 75;
input Sto_over_sold = 25;
input sto_KPeriod = 14;
input sto_DPeriod = 5;
def sto_priceH = high;
def sto_priceL = low;
def sto_priceC = close;
input sto_slowing_period = 3;
input MACDFastLength = 8;
input MACDSlowLength = 17;
input MACDLength = 9;
input MvgAvgLength = 30 ;
input MvgAvgType = { default SMA, EMA };
def SimpleMvgAvgOnOrOff =
if mvgAvgType == mvgAvgType.SMA then
1
else
0
;
def sto_smoothingType = SimpleMvgAvgOnOrOff ;
def c1 = sto_priceC - Lowest(sto_priceL, sto_KPeriod);
def c2 = Highest(sto_priceH, sto_KPeriod) - Lowest(sto_priceL, sto_KPeriod);
def FastK = c1 / c2 * 100;
def FullK =
if sto_smoothingType == 1 then
Average(FastK, sto_slowing_period)
else
ExpAverage(FastK, sto_slowing_period);
def FullD =
if sto_smoothingType == 1 then
Average(FullK, sto_DPeriod)
else
ExpAverage(FullK, sto_DPeriod);
def MAprice =
if simpleMvgAvgOnOrOff == 1 then
simpleMovingAvg( close, mvgAvgLength)
else
ExpAverage( close, mvgAvgLength);
def MACDdiff =
if simpleMvgAvgOnOrOff == 1 then
MACD( MACDfastLength, MACDslowLength, MACDLength, "SMA").Diff
else
MACD( MACDfastLength, MACDslowLength, MACDLength, "EMA").Diff
;
rec MACDarrow =
if MACDdiff == 0 then MACDarrow[1]
else if MACDdiff > 0 then 1
else -1 ;
rec MAarrow =
if close == MAprice then MAarrow[1]
else if close > MAprice then 1
else -1 ;
rec StochsArrow =
if FULLD > sto_over_bought then 1
else if FULLD >= sto_over_sold and FULLD > FULLD[1] then 1
else if FULLD >= sto_over_sold and FULLD == FULLD[1] then
StochsArrow[1]
else -1 ;
def arrowCount = MACDarrow + StochsArrow + MAarrow ;
def macdStoCount = MACDarrow + STOCHSArrow;
def up1 =
if arrowCount == 3 then 3
else if arrowCount == 1 then 2
else if arrowCount == -1 then 1
else double.NaN
;
def dn =
if arrowCount == -3 then -3
else if arrowCount == -1 then -2
else if arrowCount == 1 then -1
else double.NaN
;
def macd_rv =
if MACDdiff[2] < MACDdiff[1] && MACDdiff[1] > MACDdiff && MACDdiff[1] > 0 && FULLD[1] > sto_over_bought then
up1+0.5
else if MACDdiff[2] > MACDdiff[1] && MACDdiff[1] < MACDdiff && MACDdiff[1] < 0 && FULLD[1] < sto_over_sold then
dn-0.5
else
double.NaN
;
#plot z = 0 ;
#z.SetDefaultColor( color.DARK_GRAY );
#z.setLineWeight(3);
#plot p3 = 5 ;
#p3.setDefaultColor( color.DARK_GRAY);
#plot p2 = 2 ;
#p2.SetDefaultColor( color.DARK_GRAY);
#plot p1 = 1 ;
#p1.SetDefaultColor( color.DARK_GRAY);
#plot m3 = -5 ;
#m3.setdefaultColor( color.DARK_GRAY);
#plot m2 = -2 ;
#m2.SetDefaultColor( color.DARK_GRAY);
#plot m1 = -1 ;
#m1.SetDefaultColor( color.DARK_GRAY);
plot down = if MACDdiff[2] < MACDdiff[1] && MACDdiff[1] > MACDdiff && MACDdiff[1] > 0 && FULLD[1] > sto_over_bought then
up1+0.5 else 0;
plot up = if MACDdiff[2] > MACDdiff[1] && MACDdiff[1] < MACDdiff && MACDdiff[1] < 0 && FULLD[1] < sto_over_sold then
dn-0.5 else 0;
up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
up.SetLineWeight(5);
up.SetDefaultColor(Color.WHITE);
Alert (up, "UP", Alert.BAR, Sound.Ding);
down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
down.SetLineWeight(5);
down.SetDefaultColor(Color.WHITE);
Alert(down, "DOWN", Alert.BAR, Sound.Ding);
AddLabel(down, "ВНИЗ", Color.RED);
AddLabel(up, "ВВЕРХ", Color.GREEN);
AssignBackgroundColor(if DOWN then Color.DARK_RED else if UP then Color.DARK_GREEN else Color.CURRENT);