# compare_multi_rsi_macd_dmi_00
# ---RSI---------------------------------
input rsi_len = 14;
input rsi_obot = 70;
input rsi_osld = 30;
input rsi_price = close;
input rsi_averagetype = AverageType.wilders;
def rsi_rsi = reference rsi(
length = rsi_len ,
overbought = rsi_obot ,
oversold = rsi_osld ,
price = rsi_price ,
averagetype = rsi_averagetype
).rsi;
# if using all default parameters, use this
#def rsi_rsi = reference rsi().rsi;
# ---MACD---------------------------------
input macd_fast = 12;
input macd_slow = 26;
input macd_len = 9;
input macd_averagetype = AverageType.EXPONENTIAL;
def macd_value = reference macd( fastlength = macd_fast , slowlength = macd_slow , macdlength = macd_len , averagetype = macd_averagetype ).value;
def macd_avg = reference macd( fastlength = macd_fast , slowlength = macd_slow , macdlength = macd_len , averagetype = macd_averagetype ).avg;
def macd_diff = reference macd( fastlength = macd_fast , slowlength = macd_slow , macdlength = macd_len , averagetype = macd_averagetype ).diff;
def macd_zero = reference macd( fastlength = macd_fast , slowlength = macd_slow , macdlength = macd_len , averagetype = macd_averagetype ).zeroline;
# ---DMI---------------------------------
input dmi_len = 14;
input dmi_averagetype = AverageType.wilders;
def dmi_diplus = reference dmi( length = dmi_len , averagetype = dmi_averagetype )."di+";
def dmi_diminus = reference dmi( length = dmi_len , averagetype = dmi_averagetype )."di-";
def dmi_adx = reference dmi( length = dmi_len , averagetype = dmi_averagetype ).adx;
# ==================================
# make a label turn green when,
# ---------------------
# 1. RSI goes over 56
input rsi_up_level = 56;
def rsiabovelevel = rsi_rsi > rsi_up_level;
# ---------------------
# 2. MACD crosses over the zeroline
def macdup = (macd_value > macd_zero);
# didn't see any green signals with this formula used and prev one disabled
#def macdup = (macd_value crosses above macd_zero);
# ---------------------
# 3. with MACD Value line being over Avg line
def macdabove = (macd_value > macd_avg);
# ---------------------
# 4. DMI crosses over the 25
input dmi_level = 25;
def dmiadxabove = (dmi_adx > dmi_level);
# ---------------------
# 5. with DI+ over DI-
def dmiplusabove = (dmi_diplus > dmi_diminus);
# ---------------------
def green = (rsiabovelevel and macdup and macdabove and dmiadxabove and dmiplusabove);
#addlabel(green, "up signals", color.green);
addlabel(1, (if green then "up signals" else "----"), (if green then color.green else color.gray));
input test1 = no;
addchartbubble(test1, low*0.97,
rsiabovelevel + " rsi" + "\n" +
macdup + " macd" + "\n" +
macdabove + " macd" + "\n" +
dmiadxabove + " dmi" + "\n" +
dmiplusabove + "dmi"
, (if green then color.green else color.gray), no);
#And turn red when RSI is under 56, and MACD crosses under zero line with Value line under Avg line , and DMI DI+ cross below 25?
#