OPEN-SOURCE SCRIPT

Average and Percentage Increase

//version=5
indicator("Average and Percentage Increase", overlay=false)

// حساب أعلى وأقل قيمة للسهم في آخر سنة (252 يوم)
highest_1year = ta.highest(high, 252)
lowest_1year = ta.lowest(low, 252)

// حساب أعلى وأقل قيمة للسهم في آخر 6 أشهر (126 يوم)
highest_6months = ta.highest(high, 126)
lowest_6months = ta.lowest(low, 126)

// حساب معدل القيم الأربع (أعلى وأقل قيمة في آخر سنة وآخر 6 أشهر)
average_value_4 = (highest_1year + lowest_1year + highest_6months + lowest_6months) / 4

// حساب معدل أعلى القيمتين (أعلى قيمة في آخر سنة وآخر 6 أشهر)
average_highs = (highest_1year + highest_6months) / 2

// حساب الزيادة المئوية لمعدل القيم الأربع بالنسبة لمعدل القيم القصوى
percentage_increase = ((average_value_4 - average_highs) / average_highs) * 100

// عرض النتائج في جدول بدون رسم أي مؤشرات
var table myTable = table.new(position.top_right, 1, 3)

if (bar_index == last_bar_index)
// عرض معدل القيم الأربع
table.cell(myTable, 0, 0, text="Average of 4 Values: " + str.tostring(average_value_4, "#.##"), text_color=color.white, bgcolor=color.blue)
// عرض معدل أعلى القيمتين
table.cell(myTable, 1, 0, text="Average of Highest (1Y & 6M): " + str.tostring(average_highs, "#.##"), text_color=color.white, bgcolor=color.green)
// عرض الزيادة المئوية
table.cell(myTable, 2, 0, text="Percentage Increase: " + str.tostring(percentage_increase, "#.##") + "%", text_color=color.white, bgcolor=color.red)
Bands and Channels

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항