OPEN-SOURCE SCRIPT

TP Calculator (70% & 1.5x)

283
//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)

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。