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

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm