Ultraalgo
Ultraalgo
indicator("UltraAlgo", overlay = 1)
// Inputs
src = input(close, "Source", group = "Main settings")
p = input.int(180, "Trend period", group = "Main settings", tooltip = "Changes
STRONG signals' sensitivity.", minval = 1)
atr_p = input.int(155, "ATR Period", group = "Main settings", minval = 1)
mult = input.float(2.1, "ATR Multiplier", step = 0.1, group = "Main settings",
tooltip = "Changes sensitivity: higher period = higher sensitivty.")
mode = input.string("Type A", "Signal mode", options = ["Type A", "Type B"], group
= "Mode")
use_ema_smoother = input.string("No", "Smooth source with EMA?", options = ["Yes",
"No"], group = "Source")
src_ema_period = input(3, "EMA Smoother period", group = "Source")
color_bars = input(true, "Color bars?", group = "Addons")
signals_view = input.string("All", "Signals to show", options = ["All", "Buy/Sell",
"Strong", "None"], group = "Signal's Addon")
signals_shape = input.string("Labels", "Signal's shape", options = ["Labels",
"Arrows"], group = "Signal's Addon")
buy_col = input(color.rgb(0, 255, 8), "Buy colour", group = "Signal's Addon",
inline = "BS")
sell_col = input(color.rgb(255, 0, 0), "Sell colour", group = "Signal's Addon",
inline = "BS")
// Calculations
src := use_ema_smoother == "Yes" ? ta.ema(src, src_ema_period) : src // Source;
// Plottings
// Alerts
alertcondition(change_up and ls[1] != "B", "UltraAlgo BUY", "UltraAlgo BUY signal
were given.") // Buy alert.
alertcondition(change_down and ls[1] != "S", "UltraAlgo SELL", "UltraAlgo SELL
signal were given.") // Sell alert.
alertcondition((change_up and ls[1] != "B") or (change_down and ls[1] != "S"),
"UltraAlgo Signal", "UltraAlgo gave you a signal!")
alertcondition(change_up and ls[1] != "B" and strong_buy, "Strong BUY signal",
"UltraAlgo gave a Strong Buy signal!")
alertcondition(change_down and ls[1] != "S" and strong_sell, "Strong SELL signal",
"UltraAlgo gave a Strong Sell signal!")
f_ma(malen) =>
float result = 0
if matype == 'EMA'
result := ta.ema(src, malen)
result
if matype == 'SMA'
result := ta.sma(src, malen)
result
result
htf_ma1 = f_ma(ma_len1)
htf_ma2 = f_ma(ma_len2)
htf_ma3 = f_ma(ma_len3)
htf_ma4 = f_ma(ma_len4)
htf_ma5 = f_ma(ma_len5)
htf_ma6 = f_ma(ma_len6)
htf_ma7 = f_ma(ma_len7)
htf_ma8 = f_ma(ma_len8)
htf_ma9 = f_ma(ma_len9)
htf_ma10 = f_ma(ma_len10)
//Volume %
short = ta.ema(volume, 5)
long = ta.ema(volume, 10)
osc = 100 * (short - long) / long