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

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité