Untitled
//@version=4 study("Minervini Trend Template Alex", overlay=true) sma50 = sma(close, 50) sma150 = sma(close, 150) sma200 = sma(close, 200) sma200_22 = sma200[22] // 1. stock price is above ma 150 and 200 is_price_above_sma_150_and_200 = if (close > sma150) and (close > sma200) true else false c_1 = is_price_above_sma_150_and_200 ? 1 : 0 // 2. sma 150 is above sma 200 is_sma_150_above_sma_200 = if sma150 > sma200 true else false c_2 = is_sma_150_above_sma_200 ? 1 : 0 // 3. sma 200 is trending at least 1 month(22 days) is_trending_at_least_1_month = if sma200 > sma200_22 true else false c_3 = is_trending_at_least_1_month ? 1 : 0 // 4. sma 50 is above both sma 150 and 200 is_sma_50_above_sma_150_and_200 = if (sma50 > sma150) and (sma50 > sma200) true else false c_4 = is_sma_50_above_sma_150_and_200 ? 1 : 0 // 5. current stock price is above sma 50 is_current_price_above_ma_50 = if (close > sma50) true else false c_5 = is_current_price_above_ma_50 ? 1 : 0 // 6. current stock price is 25% above 52 weeks low // Many of the best are up 100-300% before coming out of consolidation high_loopback = input(260, "High Lookback Length") low_loopback = input(260, "Low Lookback Length") highest_price = highest(high, high_loopback) lowest_price = lowest(low, low_loopback) is_price_25_percent_above_52_weeks_low = if ((close/lowest_price)-1) * 100 >= 25 true else false c_6 = is_price_25_percent_above_52_weeks_low ? 1 : 0 // Show 52 High / Low Line show_52_week_high_low = input(title="Show 52 week highest/lowest", type=input.bool, defval=true) plot(show_52_week_high_low ? highest_price: na, title='52 Week High', trackprice=true, color=color.orange, offset=-9999) plot(show_52_week_high_low ? lowest_price: na, title='52 Week Low', trackprice=true, color=color.orange, offset=-9999) // 7. Current Price is within 25% of 52 week high is_price_within_52_high = if (1-(close/highest_price)) * 100 <= 25 true else false c_7 = is_price_within_52_high ? 1 : 0 // 8. RS rating > 70 // relative strength IBD style three_month_rs = 0.4*(close/close[13]) six_month_rs = 0.2*(close/(close[26]*2)) nine_month_rs = 0.2*(close/(close[39]*3)) twelve_month_rs = 0.2*(close/(close[52]*4)) rs_rating = (three_month_rs + six_month_rs + nine_month_rs + twelve_month_rs) * 100 rs_rating_str = tostring(rs_rating, "#.00") is_rs_rating_more_than_seventy = rs_rating > 70 c_8 = is_rs_rating_more_than_seventy ? 1 : 0 is_meet_all_criteria = is_price_above_sma_150_and_200 and is_sma_150_above_sma_200 and is_trending_at_least_1_month and is_sma_50_above_sma_150_and_200 and is_price_25_percent_above_52_weeks_low and is_price_within_52_high and is_rs_rating_more_than_seventy and is_current_price_above_ma_50 count = c_1 + c_2 + c_3 + c_4 + c_5 + c_6 + c_7 + c_8 text_ = "" text_ := text_ + "Minervini trend template" + "\n" text_ := text_ + "˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭˭" + "\n" text_ := text_ + "1. Kurs ist über MA 150 und 200 ? " + (is_price_above_sma_150_and_200 ? "Ja" : "Nein") +"\n" text_ := text_ + "2. MA 150 ist über MA 200 ? " + (is_sma_150_above_sma_200 ? "Ja" : "Nein") + "\n" text_ := text_ + "3. MA 200 Trend ist aufwärts seit 1 Mon? " + (is_trending_at_least_1_month ? "Ja" : "Nein") + "\n" text_ := text_ + "4. MA 50 ist über MA 150 und MA 200? " + (is_sma_50_above_sma_150_and_200 ? "Ja" : "Nein") + "\n" text_ := text_ + "5. Kurs ist über MA 50? " + (is_current_price_above_ma_50 ? "Ja" : "Nein") + "\n" text_ := text_ + "6. Kurs ist 25% über 52T Tief? " + (is_price_25_percent_above_52_weeks_low ? "Ja" : "Nein") +"\n" text_ := text_ + "7. Kurs ist unter 25% vom 52W Hoch ? " + (is_price_within_52_high ? "Ja" : "Nein") + "\n" text_ := text_ + "8. IBD RS Rating ist über 70? " + (is_rs_rating_more_than_seventy ? "Ja (" + rs_rating_str + ")" : "Nein (" + rs_rating_str + ")") +"\n" text_ := text_ + "\n" text_ := text_ + "Werden alle Kriterien erfüllt? " + (is_meet_all_criteria ? "Ja" : "Nein") + " (" + tostring(count, "0") + " of 8)" + "\n" text_ := text_ + "\n" bars_right = input(5, "x bars right", input.integer) position = input(close, "Label position", input.source) one_color = input(false, "Label only in one color", input.bool) lab_color = input(#18d5e2, "Label color", input.color) t = timenow + round(change(time)*bars_right) var label lab = na, label.delete(lab), lab := label.new(t, position, text = text_, style=label.style_label_left, yloc=yloc.price, xloc=xloc.bar_time, textalign=text.align_left, color=#ffd700, textcolor=color.black )
Leave a Comment