OPEN-SOURCE SCRIPT
تم تحديثه

15% Discount Overlay

107
If you want to implement this in a strategy context on TradingView, we need to use the strategy() function to create a backtestable strategy that calculates 15% off the current price and displays a label on the chart.

Below is the updated script that includes the strategy() function. This will allow you to execute a basic strategy while still displaying the label for the 15% off price:
ملاحظات الأخبار
//version=6
indicator("15% Discount Overlay", overlay=true)

// Get the current close price
current_price = close

// Calculate the 15% discount
discount_price = current_price * 0.85

// Plot the discount price as a line
plot(discount_price, color=color.blue, linewidth=2, title="Normal")
plot(close, color=color.red, linewidth=2, title="15% Discount")

if bar_index % 10 == 0 or bar_index == last_bar_index
label.new(bar_index, close, text=str.tostring(close, "#.##"), style=label.style_label_up, color=color.white, textcolor=color.red, size=size.small)
label.new(bar_index, discount_price, text=str.tostring(discount_price, "#.##"), style=label.style_label_up, color=color.white, textcolor=color.blue, size=size.small)

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.