کد برای تریدینگ ویو بنویس حمایت و مقاومت ها رو بصورت دقیق نشان دهد بخصوص حمایت و مقاومت…
- User
کد برای تریدینگ ویو بنویس حمایت و مقاومت ها رو بصورت دقیق نشان دهد بخصوص حمایت و مقاومت های مهم را با رنگ دیگه
Assistant
کد تریدینگ ویو برای نمایش دقیق حمایت و مقاومت
//@version=5 indicator("حمایت و مقاومت دقیق", overlay=true) // تنظیمات length = input(20, title="تعداد کندلها برای تشخیص") lookback = input(3, title="تعداد کندلها برای تایید") threshold = input(1.0, title="آستانه درصد برای اهمیت") // محاسبه سقفها و کفهای محلی swingHigh = ta.swings(high, length, lookback) swingLow = ta.swings(low, length, lookback) // تشخیص سطوح حمایت و مقاومت var float[] resistances = array.new_float() var float[] supports = array.new_float() if swingHigh array.push(resistances, high[lookback]) if swingLow array.push(supports, low[lookback]) // حذف سطوح تکراری و مرتبسازی resistances := array.sort(array.unique(resistances)) supports := array.sort(array.unique(supports)) // تعیین سطوح مهم بر اساس تعداد برخوردها var int[] resistanceCounts = array.new_int(array.size(resistances)) var int[] supportCounts = array.new_int(array.size(supports)) for i = 0 to array.size(resistances) - 1 for j = 0 to bar_index if math.abs(high[j] - array.get(resistances, i)) <= array.get(resistances, i) * threshold / 100 array.set(resistanceCounts, i, array.get(resistanceCounts, i) + 1) for i = 0 to array.size(supports) - 1 for j = 0 to bar_index if math.abs(low[j] - array.get(supports, i)) <= array.get(supports, i) * threshold / 100 array.set(supportCounts, i, array.get(supportCounts, i) + 1) // رسم سطوح for i = 0 to array.size(resistances) - 1 count = array.get(resistanceCounts, i) color = count > 3 ? color.red : count > 1 ? color.orange : color.gray line.new(bar_index - length, array.get(resistances, i), bar_index, array.get(resistances, i), color=color, width=count > 3 ? 2 : 1, style=count > 3 ? line.style_solid : line.style_dashed) for i = 0 to array.size(supports) - 1 count = array.get(supportCounts, i) color = count > 3 ? color.green : count > 1 ? color.blue : color.gray line.new(bar_index - length, array.get(supports, i), bar_index, array.get(supports, i), color=color, width=count > 3 ? 2 : 1, style=count > 3 ? line.style_solid : line.style_dashed) // نمایش اطلاعات plotshape(series=swingHigh, title="سقف", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small) plotshape(series=swingLow, title="کف", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)توضیحات کد:
-
پارامترهای قابل تنظیم:
- تعداد کندلها برای تشخیص (length)
- تعداد کندلها برای تایید (lookback)
- آستانه درصد برای اهمیت (threshold)
-
ویژگیهای اصلی:
- تشخیص خودکار سطوح حمایت و مقاومت
- تفکیک سطوح بر اساس اهمیت (تعداد برخوردها)
- سطوح مهم با رنگهای متمایز نمایش داده میشوند:
- مقاومت مهم: قرمز پررنگ
- مقاومت متوسط: نارنجی
- حمایت مهم: سبز پررنگ
- حمایت متوسط: آبی
- خطوط پررنگ برای سطوح مهم و خطوط نقطهچین برای سطوح کماهمیت
-
نمایش بصری:
- مثلثهای کوچک برای نقاط سقف و کف
- خطوط افقی برای سطوح حمایت و مقاومت
این کد به صورت پویا سطوح حمایت و مقاومت را شناسایی کرده و بر اساس تعداد برخورد قیمت به هر سطح، اهمیت آن را تعیین میکند. سطوحی که بیشترین برخورد را داشته باشند با رنگهای پررنگتر و خطوط ضخیمتر نمایش داده میشوند.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.