Miladasamaei
2025-01-25
Category: None

 //@version=5
indicator("Custom Crypto Trading Indicator", overlay=true)

// Input parameters
entryRange1 = input.float(1.0, title="Entry Range 1 (%)")
entryRange2 = input.float(2.0, title="Entry Range 2 (%)")
takeProfit1 = input.float(1.0, title="Take Profit 1 (%)")
takeProfit2 = input.float(2.0, title="Take Profit 2 (%)")
takeProfit3 = input.float(3.0, title="Take Profit 3 (%)")
takeProfit4 = input.float(4.0, title="Take Profit 4 (%)")
takeProfit5 = input.float(5.0, title="Take Profit 5 (%)")
stopLoss = input.float(1.0, title="Stop Loss (%)")
leverage = input.float(2.0, title="Leverage")

// Calculate entry levels
entryLevel1 = close * (1 - entryRange1 / 100)
entryLevel2 = close * (1 - entryRange2 / 100)

// Calculate take profit levels
takeProfitLevel1 = close * (1 + takeProfit1 / 100)
takeProfitLevel2 = close * (1 + takeProfit2 / 100)
takeProfitLevel3 = close * (1 + takeProfit3 / 100)
takeProfitLevel4 = close * (1 + takeProfit4 / 100)
takeProfitLevel5 = close * (1 + takeProfit5 / 100)

// Calculate stop loss level
stopLossLevel = close * (1 - stopLoss / 100)

// Plot entry levels
plot(entryLevel1, color=color.blue, linewidth=2, title="Entry Level 1")
plot(entryLevel2, color=color.red, linewidth=2, title="Entry Level 2")

// Plot take profit levels
plot(takeProfitLevel1, color=color.green, linewidth=2, title="Take Profit 1")
plot(takeProfitLevel2, color=color.green, linewidth=2, title="Take Profit 2")
plot(takeProfitLevel3, color=color.green, linewidth=2, title="Take Profit 3")
plot(takeProfitLevel4, color=color.green, linewidth=2, title="Take Profit 4")
plot(takeProfitLevel5, color=color.green, linewidth=2, title="Take Profit 5")

// Plot stop loss level
plot(stopLossLevel, color=color.orange, linewidth=2, title="Stop Loss")

// Display leverage
label.new(x=bar_index, y=high, text="Leverage: " + str.tostring(leverage), color=color.white, textcolor=color.black, style=label.style_label_down)

// Alert conditions
alertcondition(close <= entryLevel1, title="Entry Level 1 Reached", message="Entry Level 1 Reached")
alertcondition(close <= entryLevel2, title="Entry Level 2 Reached", message="Entry Level 2 Reached")
alertcondition(close >= takeProfitLevel1, title="Take Profit 1 Reached", message="Take Profit 1 Reached")
alertcondition(close >= takeProfitLevel2, title="Take Profit 2 Reached", message="Take Profit 2 Reached")
alertcondition(close >= takeProfitLevel3, title="Take Profit 3 Reached", message="Take Profit 3 Reached")
alertcondition(close >= takeProfitLevel4, title="Take Profit 4 Reached", message="Take Profit 4 Reached")
alertcondition(close >= takeProfitLevel5, title="Take Profit 5 Reached", message="Take Profit 5 Reached")
alertcondition(close <= stopLossLevel, title="Stop Loss Reached", message="Stop Loss Reached")