O

#### Options Trader

##### New member

Code:

```
script MACD15 {
input TimeFrame = 5;
def agg = TimeFrame * 60000;
def vClose15 = close(period = agg);
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
DEF Value = MovingAverage(averageType, vClose15, fastLength) - MovingAverage(averageType, vClose15, slowLength);
DEF Avg = MovingAverage(averageType, Value, MACDLength);
DEF STRONG_BULL_MACD = if Value crosses above Avg and Value < 0 then 1 else 0;
PLOT STRONG_BEAR_MACD = if Value crosses below Avg and Value > 0 then 1 else 0;
}
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
DEF Value = MovingAverage(averageType, CLOSE, fastLength) - MovingAverage(averageType, CLOSE, slowLength);
DEF Avg = MovingAverage(averageType, Value, MACDLength);
DEF STRONG_BULL_MACD = if Value crosses above Avg and Value < 0 then 1 else 0;
DEF STRONG_BEAR_MACD = if Value crosses below Avg and Value > 0 then 1 else 0;
plot BULL_CONVERGENCE = IF MACD15(15).STRONG_BULL_MACD[3] then 1 else 0;
AddVerticalLine(BULL_CONVERGENCE, "STRONG MACD", Color.CYAN, Curve.FIRM);
plot BEAR_CONVERGENCE = IF MACD15(15).STRONG_BEAR_MACD then 1 else 0;
AddVerticalLine(BEAR_CONVERGENCE, "STRONG MACD", Color.RED, Curve.FIRM);
```