```
input fastLength = 12;
input slowLength = 26;
input macdLength = 9;
input macdAverageType = AverageType.EXPONENTIAL;
input Period = aggregationPeriod.five_MIN;
input arrows = yes;
input alert= yes;
plot ema5 = MovingAverage(averageType.EXPONENTIAL, close(period = period), 200);
ema5.setdefaultcolor(color.white);
def value5 = MovingAverage(macdAverageType, close(period = period), fastLength) - MovingAverage(macdAverageType, close(period = period), slowLength);
def average5 = MovingAverage(macdAverageType, value5, macdLength);
Def positive5 = average5 is less than or equal to MACD()."ZeroLine" and close(period = period) is greater than ema5;
Def negative5 = average5 is greater than or equal to MACD()."ZeroLine" and close(period = period) is less than ema5;
def positive = MACD()."Avg" is less than MACD()."ZeroLine";
Def negative =MACD()."avg" is Greater than MACD()."ZeroLine";
def oktobuy = TTM_Wave()."Wave2High" is greater than or equal to TTM_Wave()."Wave2High" from 1 bars ago and TTM_Squeeze()."Histogram" is greater than or equal to TTM_Squeeze()."Histogram" from 1 bars ago;
def oktoshort = TTM_Wave()."Wave2High" is less than or equal to TTM_Wave()."Wave2High" from 1 bars ago and TTM_Squeeze()."Histogram" is less than or equal to TTM_Squeeze()."Histogram" from 1 bars ago;
plot signal = if positive5 and oktobuy and positive and arrows
then 2
else 0;
plot signal2 = if negative5 and oktoshort and negative and arrows
then 1
else 0;
Alert(alert and signal == 2, "Ok_to_Buy", Alert.bar, Sound.Ding);
signal.SetDefaultColor(Color.violet);
signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal.setLineWeight (1);
Alert( alert and signal2 ==1, "Ok_to_Short", Alert.bar, Sound.Ding);
signal2.SetDefaultColor(Color.violet);
signal2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_Down);
signal2.setLineWeight (1);
```