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 de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?

Exención de responsabilidad