Strat Entry and Exit
Strat Entry and Exit
//@version=5
//
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░
// Inputs
//
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░
])
// ————�? MAIN
// ————�? Filter
// ————�? Strategie TP SL
//
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░
sensitivity := 350
filterAct := false
TP1 := 1.5
TP2 := 3.5
TP3 := 5.5
TP4 := 10
SL := 5
dcaAct := true
dacValue := "5"
// Main
//
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░
//Truncate Function
//-----------------------------------------------------------------------------}
// STRATEGY
//sensitivity *= sensitivity2
//sensitivity *= 10
high_line = ta.highest(high, int(sensitivity))
SL_Line = fib_456
//filtering
updm = ta.change(high)
downdm = -ta.change(low)
can_long := close >= imba_trend_line and close >= fib_236 and not is_long_trend
and trendType
can_short := close <= imba_trend_line and close <= fib_786 and not
is_short_trend and trendType
// CAN LONG/SHORT
if can_long
is_long_trend := true
is_short_trend := false
else if can_short
is_short_trend := true
is_long_trend := false
else
is_trend_change := false
can_long := false
can_short := false
is_short_trend_started := false
is_long_trend_started := false
ruleState = 0
// Strategy
strategy.entry("Long", strategy.long)
imba_entry_long_line := imba_trend_line
strategy.entry("Short", strategy.short)
imba_entry_short_line := imba_trend_line
if (_use)
percentTPSL(x) =>
trailing_sl_long = 0.0
trailing_sl_short = 0.0
// Logic SL TP ----------------------------------------
//
bool status_long_hit_tp1 = na
bool status_short_hit_tp1 = na
//
STLLong := (status_long_hit_tp1 == true and movestoploss == true) ?
strategy.position_avg_price : imba_entry_long_line -
percentTPSL(SL)*syminfo.mintick
//Calculate levels
////////////////////////////////////////////////////////////////////////////////
SETUP EXIT
if multiprofit == true
if multiprofit == false
////////////////////////////////////////////////////////////////////////////////
Plot TP & SL
entryLongThree :=
math.round_to_mintick(math.avg(strategy.position_avg_price,imba_entry_long_line))
entryLongTwo :=
math.round_to_mintick(math.avg(strategy.position_avg_price,entryLongThree))
entryLongFour :=
math.round_to_mintick(math.avg(entryLongThree,imba_entry_long_line))
entryShortThree :=
math.round_to_mintick(math.avg(strategy.position_avg_price,imba_entry_short_line))
entryShortTwo :=
math.round_to_mintick(math.avg(strategy.position_avg_price,entryShortThree))
entryShortFour :=
math.round_to_mintick(math.avg(entryShortThree,imba_entry_short_line))
//Label TP/SL
_x = timenow + math.round(ta.change(time) * 2)
label.delete(Label)
Label
label.delete(Label)
Label
if multiprofit == true
if dcaAct == true
// 2 Rebuy
if dacValue == "2"
draw_label_entry(strategy.position_avg_price,
strategy.position_avg_price, "�? Entry Zone Long ", "�? Entry Zone Short",
"Entry 1", "Entry 1", color.new(#004cff, 30))
// 3 Rebuy
if dacValue == "3"
draw_label_entry(strategy.position_avg_price,
strategy.position_avg_price, "�? Entry Zone Long ", "�? Entry Zone Short",
"Entry 1", "Entry 1", color.new(#004cff, 30))
// 5 Rebuy
if dacValue == "5"
draw_label_entry(strategy.position_avg_price,
strategy.position_avg_price, "�? Entry Zone Long ", "�? Entry Zone Short",
"Entry 1", "Entry 1", color.new(#004cff, 30))
else
draw_label_entry(strategy.position_avg_price, strategy.position_avg_price,
"Entry Long ", "Entry Short", "Entry 1", "Entry 1", color.new(#004cff, 30))
draw_label(strategy.position_avg_price + percentTPSL(TP1)*syminfo.mintick,
strategy.position_avg_price - percentTPSL(TP1)*syminfo.mintick, "🎯 Long TP1",
"🎯 Short TP1", TP1, TP1, color.new(#14ca3b, 30))
draw_label(strategy.position_avg_price + percentTPSL(TP2)*syminfo.mintick,
strategy.position_avg_price - percentTPSL(TP2)*syminfo.mintick, "🎯 Long TP2",
"🎯 Short TP2", TP2, TP2, color.new(#14ca3b, 30))
draw_label(strategy.position_avg_price + percentTPSL(TP3)*syminfo.mintick,
strategy.position_avg_price - percentTPSL(TP3)*syminfo.mintick, "🎯 Long TP3",
"🎯 Short TP3", TP3, TP3, color.new(#14ca3b, 30))
draw_label(strategy.position_avg_price + percentTPSL(TP4)*syminfo.mintick,
strategy.position_avg_price - percentTPSL(TP4)*syminfo.mintick, "🎯 Long TP4",
"🎯 Short TP4", TP4, TP4, color.new(#14ca3b, 30))
draw_label(strategy.position_avg_price + percentTPSL(TP4)*syminfo.mintick,
strategy.position_avg_price - percentTPSL(TP4)*syminfo.mintick, "🎯 Long TP5",
"🎯 Short TP5", TP4, TP4, color.new(#14ca3b, 30))
closedTrades = strategy.closedtrades
winTrades = strategy.wintrades
table.cell(textstylist, 0, 1, subtitle, width, height, c_subtitle, a_subtitle,
text_size=s_subtitle, bgcolor=c_bg)
lossTrades = strategy.losstrades
if newWin
lossRow := 0
winRow := winRow + 1
maxWinRow := winRow
if newLoss
winRow := 0
lossRow := lossRow + 1
maxLossRow := lossRow
MyDate := time
if tradeIdeeAct == true
�
_text += '?'+ str.tostring(syminfo.ticker) + '\n'
_text += 'Timeframe : �
?'+ str.tostring(timeframe.period ) + '\n'
// DCA Activate
if dcaAct == true
// 2 Rebuy
if dacValue == "2"
if dacValue == "3"
if dacValue == "5"
_text += '5 DCA Entrys' + '\n\n'
else
if multiprofit == true
if oppositeSignalACT
if trailingConfigurationACT
else
_text += na
label la = na
label.delete(la[1])