MACD PanicBot 1H BTC

416 1 42
PanicBot abuses the MACD and panics at the first sign of weakness. For this reason it is best for ranging. In an uptrend it generates false (sideways) sell signals. The rule of thumb is to buy back if it doesn't drop like it should, etc. Use in conjunction with other indicators and some common sense. Note trend direction, volume , etc. Still, it can generate profit on its own, as back testing shows...
Remove from Favorite Scripts Add to Favorite Scripts
strategy("MACD Panic 1H BTC", overlay=false)

//DJIA 1W 5 41 40 166 5
//DJIA 1D 21 41 40 17 13
//BTCUSD 1W 3 9 21 12 11
//BTCUSD 1D 5 30 66 7 13
//BTCUSD 1H 20 42 59 30 13 or 5 34 44 24 20
//26 42 22 for LTCUSD daily
fast = input(title="Short Period", type=float, defval=5, minval=3, maxval=100)
slow =  input(title="Long Period", type=float, defval=34, minval=3, maxval=200)
signal = input(title="Signal Line", type=float, defval=44, minval=3, maxval=400)
//eliminate false signals
delay_sell = input(24)
delay_buy = input(20)
[macdLine, signalLine, histLine] = macd(close, fast, slow, signal)

longCondition = (histLine > histLine[1]) and highest(histLine, delay_buy) == histLine
shortCondition =(histLine < histLine[1]) and lowest(histLine, delay_sell) == histLine

if (longCondition)
    strategy.entry("MACDHKLE", strategy.long, comment="Panic")
if (shortCondition)
    strategy.entry("MACDHKSE", strategy.short, comment="Panic")

hist_green = histLine > 0 ? histLine : 0
hist_red = histLine < 0 ? histLine : 0

hist_grn_plot = plot(hist_green, title="Histogram Green", style=histogram, linewidth=5, color=green)
hist_red_plot = plot(hist_red, title="Histogram Red", style=histogram, linewidth=5, color=maroon)
macd_plot = plot(macdLine, title="MACD", transp=60, style=area, color=aqua)
sl_plot   = plot(signalLine, title="Signal", transp=60, style=area, color=orange)

cu = cross(signalLine, macdLine)? avg(signalLine, macdLine) : na
plot(cu, style=circles, linewidth=4, color=change(macdLine)>0?lime:orange)

alertcondition(longCondition, title="MACD Long Condition", message="MACD Long")
alertcondition(shortCondition, title="MACD Short Condition", message="MACD Short")
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out