OPEN-SOURCE SCRIPT

TP Calculator (70% & 1.5x)

66
//version=5
indicator("TP Calculator (70% & 1.5x)", overlay=true)

// -------- Inputs --------
entry = input.float(100.0, "Entry Price")
stoploss = input.float(90.0, "Stop Loss")

// -------- Determine Direction --------
// اگر SL پایین‌تر بود = پوزیشن Long
// اگر SL بالاتر بود = پوزیشن Short
isLong = stoploss < entry ? true : false

// -------- Calculations --------
distance = math.abs(entry - stoploss)

// جهت پوزیشن (بالا یا پایین TP می‌رود)
direction = isLong ? 1 : -1

tp1 = entry + direction * (distance * 0.70) // 70%
tp2 = entry + direction * (distance * 1.50) // 1.5x

// -------- Plot Levels --------
plot(entry, "Entry", color=color.blue, linewidth=2)
plot(stoploss, "Stop Loss", color=color.red, linewidth=2)

plot(tp1, "TP1 (70%)", color=color.green, linewidth=2)
plot(tp2, "TP2 (1.5x)", color=color.orange, linewidth=2)

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

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.