Zeal Terminal Open in Zeal Terminal

Pine Script v5 · Strategy

Risk Reward Calculator [lovealgotrading]

A Pine Script v5 strategy built on Change (time). It has 10 order rules, 8 entries among them, and trades long and short with the default settings. Exits use a stop loss and a profit target. Each trade is one contract and pays 0.1 commission. 28 settings; defaults include Take Profit Price 0, Stop Loss Price 0 and Risk Amount In Dollar 100.

Generated from the script's code by a template: every clause is a fact read from the source. Not written by a person or a model, and not taken from the author's description.

Does Risk Reward Calculator [lovealgotrading] repaint?
Yes
At least one pattern in the source can repaint: intrabar recalculation.
How did Risk Reward Calculator [lovealgotrading] do on BTCUSDT 1D with default settings?
Not measured
It closed no trades there from 26 Jan 2024 to 21 Oct 2026 with the default settings, so there is no result to report. Its code limits trading to a date window, which can leave this period out. It closed no trades on the other markets either. A backtest, not investment advice.
Does Risk Reward Calculator [lovealgotrading] run in Pine Script v6?
Not tested
Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download.
Does Risk Reward Calculator [lovealgotrading] use a stop loss?
Yes
strategy.exit sets a stop on line 166, 168.
Does Risk Reward Calculator [lovealgotrading] run in Zeal Terminal?
Yes
It compiles in 135 ms and runs 1,000 bars in 162 ms, in the browser.

BTCUSDT · 1D · default settings

  • Change
  • Change
  • Change
  • Change
  • Change
  • Change
  • Change
  • Change
  • Winning trade
  • Losing trade
  • Equity
  • Buy and hold
Prerendered with the defaults. Change anything and run it here. The script runs in your browser.
Settings (28)
40,00060,00080,000100,000120,000AprJulOct2025AprJulOct2026AprJulOct$5,000$10,126Equity from $5,000
Binance BTCUSDT 1D candles, 26 Jan 2024 to 21 Oct 2026, 1,000 bars, default settings. Triangles mark entries; circles mark exits. The script plots nothing itself; the lines and the lower pane are its own calculations, drawn for reference. The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.
Net profit
0.00%
$0.00
Buy and hold
+102.5%
same period
Closed trades
0
0 won · 0 lost
Profitable
0.0%
of closed trades
Profit factor
—
gross profit ÷ gross loss
Max drawdown
0.00%
$0.00

One run with the author's default settings, $5,000 starting capital, commission as the script sets it. A single backtest says little about future results and is not a recommendation. Backtests are simulations on historical data and are not investment advice.

Review

What a careful reader of this script would point out, found by checking the source and the backtest.

  • Check

    3 settings do nothing

    “Sum of transactions weight must be 100%”, “DON'T FORGET PASTE YOUR WEBHOOK URL WHEN YOU SET ALERT”, “Code When Set Alert” are declared but never read.

Settings

Every input the script declares, with its default and what it feeds. Bounds are the ones the script enforces.

SettingDefaultType and rangeFeeds
⏳ STRATEGY WORK TIME ⏳
Start_Datetimestamp('1 apr 2023 13:30 +0000')timeinDateRange Take_Profit_Line Stop_Line Price_1_val_Line Price_2_val_Line Price_3_val_Line Price_4_val_Line Avg_Price_Line
End_Datetimestamp('20 oct 2030 13:30 +0000')timeinDateRange Take_Profit_Line Stop_Line Price_1_val_Line Price_2_val_Line Price_3_val_Line Price_4_val_Line Avg_Price_Line
⚠️ STRATEGY RISK SETTINGS ⚠️
Take Profit Price0float · min 0 · step 0.1take_profit_level_True Real_TP_Distance TP_Distance Take_Profit_Line Take_Profit_Label One_Label entry Long_Open entry Long_Open entry Long_Open entry Long_Open entry Short_Open entry Short_Open entry Short_Open entry Short_Open Take Profit line 148 line 150 line 152 line 154 line 157 line 159 line 161 line 163 exit Long__Close exit Short__Close
Stop Loss Price0float · min 0 · step 0.1Stop_True Real_Stop_Distance Stop_Distance Take_Profit_Label Stop_Line Stop_Label Price_1_val_Label Price_2_val_Label Price_3_val_Label Price_4_val_Label One_Label Stop Loss exit Long__Close exit Short__Close
Risk Amount In Dollar100float · min 0 · step 0.1Position_Size
⭐️ STRATEGY ENTRY SETTINGS ⭐️
Sum of transactions weight must be 100%trueboolunused
Entry Price One0float · min 0 · step 0.1Price_1_val_True Price_2_val_True Price_3_val_True Price_4_val_True Weight_One Real_Price_1_val_Distance Avg_Price Price_1_val_Line Price_1_val_Label One_Label entry Long_Open entry Short_Open Price One line 148 line 157
⚖️ WeightNaNstring · options ['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %']Weight_One_Options Avg_2_True Avg_3_True Avg_4_True Order_One Price_1_val_Label entry Long_Open entry Short_Open line 148 line 157
Entry Price Two0float · min 0 · step 0.1Price_2_val_True Price_3_val_True Price_4_val_True Weight_Two Real_Price_2_val_Distance Avg_Price Order_One Price_2_val_Line Price_2_val_Label One_Label entry Long_Open entry Short_Open Price Two line 150 line 159
⚖️ WeightNaNstring · options ['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %']Weight_Two_Options Avg_2_True Avg_3_True Avg_4_True Order_Two Price_2_val_Label entry Long_Open entry Short_Open line 150 line 159
Entry Price Three0float · min 0 · step 0.1Price_3_val_True Price_4_val_True Weight_Three Real_Price_3_val_Distance Avg_Price Order_One Order_Two Price_3_val_Line Price_3_val_Label One_Label entry Long_Open entry Short_Open Price Three line 152 line 161
⚖️ WeightNaNstring · options ['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %']Weight_Three_Options Avg_3_True Avg_4_True Order_Three Price_3_val_Label entry Long_Open entry Short_Open line 152 line 161
Entry Price Four0float · min 0 · step 0.1Price_4_val_True Weight_Four Real_Price_4_val_Distance Avg_Price Price_4_val_Line Price_4_val_Label entry Long_Open entry Short_Open Price Four line 154 line 163
⚖️ WeightNaNstring · options ['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %']Weight_Four_Options Avg_4_True Order_Four Price_4_val_Label entry Long_Open entry Short_Open line 154 line 163
🤖 ALGO TRADE ALERTS 🤖
DON'T FORGET PASTE YOUR WEBHOOK URL WHEN YOU SET ALERTtrueboolunused
Long Entry Codestringentry Long_Open
Long Stop-Take Profit Codestringexit Long__Close
Short Entry Codestringentry Short_Open
Short Stop-Take Profit Codestringexit Short__Close
Code When Set Alert{{strategy.order.alert_message}}stringunused
🏁 LABEL SETTINGS 🏁
Show LabelstrueboolTake_Profit_Label Stop_Label Price_1_val_Label Price_2_val_Label Price_3_val_Label Price_4_val_Label Avg_Price_Label One_Label
Calculator VisualAll Timeframesstring · options ['All Timeframes', 'Intraday Only', 'Daily/Weekly/Monthly Only']Timeframe
Label Sizesize.smallstring · options [size.tiny, size.small, size.normal, size.large, size.huge]Take_Profit_Label Stop_Label Price_1_val_Label Price_2_val_Label Price_3_val_Label Price_4_val_Label Avg_Price_Label One_Label
Real-Time Distance In LabeltrueboolTake_Profit_Label Stop_Label Price_1_val_Label Price_2_val_Label Price_3_val_Label Price_4_val_Label One_Label
Stop Loss Distance In LabeltrueboolTake_Profit_Label Stop_Label One_Label
Dollar Order Amount In LabeltrueboolTake_Profit_Label Stop_Label One_Label
Show Price Inputs In LabeltrueboolTake_Profit_Label Stop_Label Price_1_val_Label Price_2_val_Label Price_3_val_Label Price_4_val_Label One_Label
Show All Text In One LabelfalseboolTake_Profit_Label Stop_Label Price_1_val_Label Price_2_val_Label Price_3_val_Label Price_4_val_Label Avg_Price_Label One_Label

What it calculates

  • ChangetimeStop_Location · line 89
  • ChangetimePrice_1_val_Location · line 90
  • ChangetimePrice_2_val_Location · line 91
  • ChangetimePrice_3_val_Location · line 92
  • ChangetimePrice_4_val_Location · line 93
  • ChangetimeAvg_Price_Location · line 94
  • ChangetimeOne_Label_Location · line 95
  • Changetimetake_profit_level_Location · line 96

Signal flow

How price data and settings reach the orders. Each box is a name in the script, or several computed the same way; each arrow is a value one of them reads. Hover a box for its members.

The script has 82 named inputs, calculations, conditions and outputs, too many to draw legibly here; the tables above list them.

Order rules

OrderFires whenBy defaultLine
Open Long_Open longstrategy.opentrades == 0 and inDateRange and Avg_Price < take_profit_level and Weight_1 != 'NaN' and Price_1_val_True and close[1] > Price_1_valOn149
Open Long_Open longstrategy.opentrades == 1 and inDateRange and Avg_Price < take_profit_level and Weight_2 != 'NaN' and Price_2_val_True and close[1] > Price_2_valOn151
Open Long_Open longstrategy.opentrades == 2 and inDateRange and Avg_Price < take_profit_level and Weight_3 != 'NaN' and Price_3_val_True and close[1] > Price_3_valOn153
Open Long_Open longstrategy.opentrades == 3 and inDateRange and Avg_Price < take_profit_level and Weight_4 != 'NaN' and Price_4_val_True and close[1] > Price_4_valOn155
Open Short_Open shortstrategy.opentrades == 0 and inDateRange and Avg_Price > take_profit_level and Weight_1 != 'NaN' and Price_1_val_True and close[1] < Price_1_valOn158
Open Short_Open shortstrategy.opentrades == 1 and inDateRange and Avg_Price > take_profit_level and Weight_2 != 'NaN' and Price_2_val_True and close[1] < Price_2_valOn160
Open Short_Open shortstrategy.opentrades == 2 and inDateRange and Avg_Price > take_profit_level and Weight_3 != 'NaN' and Price_3_val_True and close[1] < Price_3_valOn162
Open Short_Open shortstrategy.opentrades == 3 and inDateRange and Avg_Price > take_profit_level and Weight_4 != 'NaN' and Price_4_val_True and close[1] < Price_4_valOn164
Exit Long__Close stop and limitstrategy.opentrades > 0 and inDateRange and strategy.position_size > 0On166
Exit Short__Close stop and limitstrategy.opentrades > 0 and inDateRange and strategy.position_size < 0On168

Each order is guarded by the setting shown. “Off” orders never fire unless that setting is switched on.

Does it repaint?

Yes

At least one pattern in the source can repaint; it is marked Check below.

Not measuredNo trades to compareThe last 300 bars, from 26 Dec 2025, were fed to the engine as live ticks, but neither the live nor the historical run produced any trades in them, so the replay says nothing either way.
  • ClearHigher-timeframe dataThe script requests no other symbol or timeframe.
  • ClearFuture-bar referencesNo negative history offsets such as close[-1].
  • CheckIntrabar recalculationreads realtime-only state. Live values can differ from history.
  • ClearOrder timingOrders fill at the next bar's open, after the signal bar has closed.

The checks read the source; the replay runs it. Together they catch the common causes, not every possible one.

Other markets

The same script with default settings on 8 Binance markets. Each row is a separate backtest over the most recent 1,000 bars.

MarketNetBuy and holdTradesWonProfit factorMax drawdownPeriod
BTCUSDT 1D0.0%+102.5%00%—0.0%26 Jan 2024 – 21 Oct 2026
BTCUSDT 4h0.0%+5.5%00%—0.0%8 May 2026 – 21 Oct 2026
ETHUSDT 1D0.0%+9.8%00%—0.0%26 Jan 2024 – 21 Oct 2026
ETHUSDT 4h0.0%+8.4%00%—0.0%8 May 2026 – 21 Oct 2026
SOLUSDT 1D0.0%+16.7%00%—0.0%26 Jan 2024 – 21 Oct 2026
SOLUSDT 4h0.0%+21.5%00%—0.0%8 May 2026 – 21 Oct 2026
BNBUSDT 1D0.0%+148.3%00%—0.0%26 Jan 2024 – 21 Oct 2026
BNBUSDT 4h0.0%+17.1%00%—0.0%8 May 2026 – 21 Oct 2026

Backtests are simulations on historical data and are not investment advice.

Similar scripts

No other indicator or strategy here shares enough of its calculations.

Upgrade and export

Written in Pine Script v5. The clean-v5 step types the settings and moves when = into if blocks, which v6 requires; it is run before and after like any upgrade.

  • 10 settings use the untyped input() (line 23, 24, 25, 26, 27, 31, 32, 33, 34, 35). It still compiles in v6; input.int, input.float or input.source state the type.
  • No v6-only features. v6 is not needed to run this script.

Clean v5

Not verified

Neither version placed a trade on any of the 8 markets, so there was nothing to compare.

  • Line 23: input() → input.string()
  • Line 24: input() → input.string()
  • Line 25: input() → input.string()
  • Line 26: input() → input.string()
  • Line 27: input() → input.string()
  • Line 31: input() → input.bool()
4 more edits
  • Line 32: input() → input.bool()
  • Line 33: input() → input.bool()
  • Line 34: input() → input.bool()
  • Line 35: input() → input.bool()
⋯Alert_message_miss = input.bool(true,title = "DON'T FORGET PASTE YOUR WEBHOOK URL WHEN YOU SET ALERT", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")-Long_message = input("",title = "Long Entry Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")+Long_message = input.string("",title = "Long Entry Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")-Long_Exit_message = input("",title = "Long Stop-Take Profit Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")+Long_Exit_message = input.string("",title = "Long Stop-Take Profit Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")-Short_message = input("",title = "Short Entry Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")+Short_message = input.string("",title = "Short Entry Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")-Short_Exit_message = input("",title = "Short Stop-Take Profit Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")+Short_Exit_message = input.string("",title = "Short Stop-Take Profit Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")-Alert_message = input("{{strategy.order.alert_message}}",title = "Code When Set Alert", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")+Alert_message = input.string("{{strategy.order.alert_message}}",title = "Code When Set Alert", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")show_label = input.bool(title='  Show Labels',defval=true, group = " ############ 🏁  LABEL SETTINGS  🏁 ############")⋯Label_Size = input.string(size.small, 'Label Size', options=[size.tiny, size.small, size.normal, size.large, size.huge], group = " ############ 🏁  LABEL SETTINGS  🏁 ############")-Show_Real_Distance = input(true, title='Real-Time Distance In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")+Show_Real_Distance = input.bool(true, title='Real-Time Distance In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")-Show_Stop_Distance = input(true, title='Stop Loss Distance In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")+Show_Stop_Distance = input.bool(true, title='Stop Loss Distance In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")-Show_Order_Amount = input(true, title='Dollar Order Amount In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")+Show_Order_Amount = input.bool(true, title='Dollar Order Amount In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")-Show_Price = input(true, title='Show Price Inputs In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")+Show_Price = input.bool(true, title='Show Price Inputs In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")-Use_One_Label = input(false, title='Show All Text In One Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")+Use_One_Label = input.bool(false, title='Show All Text In One Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")//bgcolor(show_label and inDateRange ? color.rgb(175, 246, 255, 90) : na , title = "STRATEGY WORK TIME BG" )⋯

Does it run in Pine Script v6?

Not tested

Neither version placed a trade on any of the 8 markets, so there was nothing to compare. The v6 version is shown for reference and is not offered as a download. It differs from the v5 version by 1 edit.

⋯// I want to say thank you to © EvoCrypto-//@version=5+//@version=6strategy('Risk Reward Calculator', shorttitle='R:R', overlay=true, max_bars_back = 2000, pyramiding = 4, initial_capital = 5000, commission_value = 0.1 ,slippage = 1)⋯

Where it runs

EngineCompilesRunsMatches TradingView
Zeal Terminal · OpenPineScript v2Yes 135 msWith a workaround 1,000 bars in 162 msNot measured
PineTSNot testedNot testedNot measured

The engine's host API cannot yet declare a chart's symbol and timeframe, so this page sets them on the engine directly for each market.

“Matches TradingView” needs this script's own output exported from TradingView and compared bar by bar, which has not been done for this script. The engine is built on OpenPineScript, whose conformance results are in its conformance report.

Source

Copied verbatim from the author's published script, with its licence header intact. The author may have updated the original since this snapshot.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © Baby_whale_to_moon// I want to say thank you to © EvoCrypto//@version=5strategy('Risk Reward Calculator', shorttitle='R:R', overlay=true, max_bars_back = 2000, pyramiding = 4, initial_capital = 5000, commission_value = 0.1 ,slippage = 1)//INPUTS -----------------------------------------------------------------------startDate  = input.time(defval=timestamp('1 apr 2023 13:30 +0000'), title='Start_Date', group = " ######### ⏳  STRATEGY WORK TIME ⏳###########" )endDate = input.time(defval=timestamp('20 oct  2030 13:30 +0000'), title='End_Date', group = " ######### ⏳  STRATEGY WORK TIME ⏳###########" )inDateRange  = time > startDate  and time < endDatetake_profit_level = input.float(0, step=0.1, minval=0, title='Take Profit Price', group = " ######### ⚠️  STRATEGY RISK SETTINGS ⚠️#########")Stop_Level = input.float(0, minval=0, step=0.1, title='Stop Loss Price', group = " ######### ⚠️  STRATEGY RISK SETTINGS ⚠️#########")Risk_Amount = input.float(100, minval=0, step=0.1, title='Risk Amount In Dollar', group = " ######### ⚠️  STRATEGY RISK SETTINGS ⚠️#########")Alert = input.bool(true,title = "Sum of transactions weight must be 100%", group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Price_1_val = input.float(0, step=0.1, minval=0, title='Entry Price One', group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Weight_1 = input.string('NaN', ' ⚖️ Weight', options=['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %'], group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Price_2_val = input.float(0, step=0.1, minval=0, title='Entry Price Two', group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Weight_2 = input.string('NaN', ' ⚖️ Weight', options=['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %'], group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Price_3_val = input.float(0, step=0.1, minval=0, title='Entry Price Three', group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Weight_3 = input.string('NaN', ' ⚖️ Weight', options=['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %'], group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Price_4_val = input.float(0, step=0.1, minval=0, title='Entry Price Four', group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Weight_4 = input.string('NaN', ' ⚖️ Weight', options=['NaN', '90 %', '80 %', '• 75 %', '70 %', '60 %', '• 50 %', '40 %', '30 %', '• 25 %', '20 %', '10 %'], group = " ######### ⭐️ STRATEGY ENTRY SETTINGS  ⭐️########")Alert_message_miss = input.bool(true,title = "DON'T FORGET PASTE YOUR WEBHOOK URL WHEN YOU SET ALERT", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")Long_message = input("",title = "Long Entry Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")Long_Exit_message = input("",title = "Long Stop-Take Profit Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")Short_message = input("",title = "Short Entry Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")Short_Exit_message = input("",title = "Short Stop-Take Profit Code", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")Alert_message = input("{{strategy.order.alert_message}}",title = "Code When Set Alert", group = "############ 🤖 ALGO TRADE ALERTS 🤖 ############")show_label = input.bool(title='  Show Labels',defval=true, group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Visual = input.string('All Timeframes', 'Calculator Visual', options=['All Timeframes', 'Intraday Only', 'Daily/Weekly/Monthly Only'], group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Label_Size = input.string(size.small, 'Label Size', options=[size.tiny, size.small, size.normal, size.large, size.huge], group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Show_Real_Distance = input(true, title='Real-Time Distance In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Show_Stop_Distance = input(true, title='Stop Loss Distance In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Show_Order_Amount = input(true, title='Dollar Order Amount In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Show_Price = input(true, title='Show Price Inputs In Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")Use_One_Label = input(false, title='Show All Text In One Label', group = " ############ 🏁  LABEL SETTINGS  🏁 ############")//bgcolor(show_label and inDateRange ? color.rgb(175, 246, 255, 90) : na , title = "STRATEGY WORK TIME BG" )//TIMEFRAME --------------------------------------------------------------------Timeframe = timeframe.isintraday and Visual == 'Intraday Only' or timeframe.isdwm and Visual == 'Daily/Weekly/Monthly Only' or Visual == 'All Timeframes'//QUALIFIERS -------------------------------------------------------------------take_profit_level_True = Timeframe ? take_profit_level != 0 : naStop_True = Timeframe ? Stop_Level != 0 : naPrice_1_val_True = Timeframe ? Price_1_val != 0 : naPrice_2_val_True = Timeframe ? Price_1_val != 0 and Price_2_val != 0 : naPrice_3_val_True = Timeframe ? Price_1_val != 0 and Price_2_val != 0 and Price_3_val != 0 : naPrice_4_val_True = Timeframe ? Price_1_val != 0 and Price_2_val != 0 and Price_3_val != 0 and Price_4_val != 0 : naAvg_Price_True = Timeframe ? Price_2_val_True or Price_3_val_True : naquantity(dolar) =>    if close > 5000         math.round(dolar / close, 3)    else if close < 5000 and close > 200        math.round(dolar / close, 2)    else if close < 200 and close > 50        math.round(dolar / close, 1)    else if close < 50        math.round(dolar / close, 0)//PRICE 1 ----------------------------------------------------------------------Weight_One_Options = Weight_1 == 'NaN' ? 1 : Weight_1 == '90 %' ? 0.90 : Weight_1 == '80 %' ? 0.80 : Weight_1 == '• 75 %' ? 0.75 : Weight_1 == '70 %' ? 0.70 : Weight_1 == '60 %' ? 0.60 : Weight_1 == '• 50 %' ? 0.50 : Weight_1 == '40 %' ? 0.40 : Weight_1 == '30 %' ? 0.30 : Weight_1 == '• 25 %' ? 0.25 : Weight_1 == '20 %' ? 0.20 : Weight_1 == '10 %' ? 0.10 : naWeight_One = Price_1_val * Weight_One_OptionsReal_Price_1_val_Distance = Price_1_val_True and close > Price_1_val ? (close - Price_1_val) / close * 100 : Price_1_val_True and close < Price_1_val ? (Price_1_val - close) / close * 100 : na//PRICE 2 ----------------------------------------------------------------------Weight_Two_Options = Weight_2 == 'NaN' ? 1 : Weight_2 == '90 %' ? 0.90 : Weight_2 == '80 %' ? 0.80 : Weight_2 == '• 75 %' ? 0.75 : Weight_2 == '70 %' ? 0.70 : Weight_2 == '60 %' ? 0.60 : Weight_2 == '• 50 %' ? 0.50 : Weight_2 == '40 %' ? 0.40 : Weight_2 == '30 %' ? 0.30 : Weight_2 == '• 25 %' ? 0.25 : Weight_2 == '20 %' ? 0.20 : Weight_2 == '10 %' ? 0.10 : naWeight_Two = Price_2_val * Weight_Two_OptionsReal_Price_2_val_Distance = Price_2_val_True and close > Price_2_val ? (close - Price_2_val) / close * 100 : Price_2_val_True and close < Price_2_val ? (Price_2_val - close) / close * 100 : na//PRICE 3 ----------------------------------------------------------------------Weight_Three_Options = Weight_3 == 'NaN' ? 1 : Weight_3 == '90 %' ? 0.90 : Weight_3 == '80 %' ? 0.80 : Weight_3 == '• 75 %' ? 0.75 : Weight_3 == '70 %' ? 0.70 : Weight_3 == '60 %' ? 0.60 : Weight_3 == '• 50 %' ? 0.50 : Weight_3 == '40 %' ? 0.40 : Weight_3 == '30 %' ? 0.30 : Weight_3 == '• 25 %' ? 0.25 : Weight_3 == '20 %' ? 0.20 : Weight_3 == '10 %' ? 0.10 : naWeight_Three = Price_3_val * Weight_Three_OptionsReal_Price_3_val_Distance = Price_3_val_True and close > Price_3_val ? (close - Price_3_val) / close * 100 : Price_3_val_True and close < Price_3_val ? (Price_3_val - close) / close * 100 : na//PRICE 4 ----------------------------------------------------------------------Weight_Four_Options = Weight_4 == 'NaN' ? 1 : Weight_4 == '90 %' ? 0.90 : Weight_4 == '80 %' ? 0.80 : Weight_4 == '• 75 %' ? 0.75 : Weight_4 == '70 %' ? 0.70 : Weight_4 == '60 %' ? 0.60 : Weight_4 == '• 50 %' ? 0.50 : Weight_4 == '40 %' ? 0.40 : Weight_4 == '30 %' ? 0.30 : Weight_4 == '• 25 %' ? 0.25 : Weight_4 == '20 %' ? 0.20 : Weight_4 == '10 %' ? 0.10 : naWeight_Four = Price_4_val * Weight_Four_OptionsReal_Price_4_val_Distance = Price_4_val_True and close > Price_4_val ? (close - Price_4_val) / close * 100 : Price_4_val_True and close < Price_4_val ? (Price_4_val - close) / close * 100 : na//AVERAGE PRICE ----------------------------------------------------------------Avg_2_True = Weight_1 == 'NaN' and Weight_2 == 'NaN'Avg_3_True = Weight_1 == 'NaN' and Weight_2 == 'NaN' and Weight_3 == 'NaN'Avg_4_True = Weight_1 == 'NaN' and Weight_2 == 'NaN' and Weight_3 == 'NaN' and Weight_4 == 'NaN'Avg_Price = Price_2_val_True and Avg_2_True and Price_3_val == 0 and Price_4_val == 0 ? math.avg(Price_1_val, Price_2_val) : Price_3_val_True and Avg_3_True ? math.avg(Price_1_val, Price_2_val, Price_3_val) : Price_4_val_True and Avg_4_True ? math.avg(Price_1_val, Price_2_val, Price_3_val, Price_4_val) : Weight_One + Weight_Two + Weight_Three + Weight_FourReal_Avg_Price_Distance = Avg_Price_True and close > Avg_Price ? (close - Avg_Price) / close * 100 : Avg_Price_True and close < Avg_Price ? (Avg_Price - close) / close * 100 : na//POSITION SETTINGS ------------------------------------------------------------Real_Stop_Distance = Stop_True and close > Stop_Level ? (close - Stop_Level) / close * 100 : Stop_True and close < Stop_Level ? (Stop_Level - close) / close * 100 : naStop_Distance = Avg_Price != 0 and Stop_True and Avg_Price > Stop_Level ? (Avg_Price - Stop_Level) / Avg_Price * 100 : Avg_Price != 0 and Stop_True and Avg_Price < Stop_Level ? (Stop_Level - Avg_Price) / Avg_Price * 100 : Real_Stop_DistanceReal_TP_Distance = take_profit_level_True and close > take_profit_level ? (close - take_profit_level) / close * 100 : take_profit_level_True and close < take_profit_level ? (take_profit_level - close) / close * 100 : naTP_Distance = Avg_Price != 0 and take_profit_level_True and Avg_Price > take_profit_level ? (Avg_Price - take_profit_level) / Avg_Price * 100 : Avg_Price != 0 and take_profit_level_True and Avg_Price < take_profit_level ? (take_profit_level - Avg_Price) / Avg_Price * 100 : Real_TP_DistancePosition_Size = Risk_Amount / Stop_Distance * 100Order_One = Weight_1 != 'NaN' ? Position_Size * Weight_One_Options : Weight_1 == 'NaN' and Price_2_val == 0 and Price_3_val == 0 ? Position_Size : Weight_1 == 'NaN' and Price_2_val_True and Price_3_val == 0 ? Position_Size / 2 : Weight_1 == 'NaN' and Price_3_val_True ? Position_Size / 3 : Weight_1 == 'NaN' and Price_4_val_True ? Position_Size / 4 : naOrder_Two = Weight_2 != 'NaN' ? Position_Size * Weight_Two_Options : Weight_2 == 'NaN' and Price_2_val_True and Price_3_val == 0 ? Position_Size / 2 : Weight_2 == 'NaN' and Price_3_val_True ? Position_Size / 3 : Weight_2 == 'NaN' and Price_4_val_True ? Position_Size / 4 : naOrder_Three = Weight_3 != 'NaN' ? Position_Size * Weight_Three_Options : Weight_3 == 'NaN' and Price_3_val_True ? Position_Size / 3 : Weight_3 == 'NaN' and Price_4_val_True ? Position_Size / 4 : naOrder_Four = Weight_4 != 'NaN' ? Position_Size * Weight_Four_Options : Weight_4 == 'NaN' and Price_4_val_True ? Position_Size / 4 : na//LABEL LOCATIONS --------------------------------------------------------------Stop_Location = timenow + math.round(ta.change(time) * (Price_3_val_True ? 115 : Price_2_val_True ? 95 : Price_1_val_True ? 75 : 55))Price_1_val_Location = timenow + math.round(ta.change(time) * 15 )Price_2_val_Location = timenow + math.round(ta.change(time) * 35)Price_3_val_Location = timenow + math.round(ta.change(time) * 55)Price_4_val_Location = timenow + math.round(ta.change(time) * 75)Avg_Price_Location = timenow + math.round(ta.change(time) * (Price_3_val_True ? 115 : Price_2_val_True ? 95 : Price_1_val_True ? 75 : 55))One_Label_Location = timenow + math.round(ta.change(time) * 50)take_profit_level_Location = timenow + math.round(ta.change(time) * (Price_3_val_True ? 115 : Price_2_val_True ? 95 : Price_1_val_True ? 75 : 55))//COLORS -----------------------------------------------------------------------Stop_Color = #b71c1cPrice_Color = #0011ffLabel_Color = #2db3fbText_Color = #000000//Take Profit PLOT ---------------------------------------------------------------Take_Profit_Line = take_profit_level_True ? line.new(x1=startDate, y1=take_profit_level, x2=endDate, y2=take_profit_level, style=line.style_dashed, xloc = xloc.bar_time, width=2, color=color.lime) : naline.delete(Take_Profit_Line[1])plot(take_profit_level_True ? take_profit_level : na, title='Take Profit', color=color.new(color.lime, 100))Take_Profit_Label = Use_One_Label ? na : Avg_Price != 0 and take_profit_level_True and Avg_Price < take_profit_level or Avg_Price == 0 and take_profit_level_True and close < take_profit_level and show_label and show_label ? label.new(x=take_profit_level_Location, y=take_profit_level, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=color.lime, textcolor=Text_Color, size=Label_Size, text='TP Long' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_TP_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'TakeProfit → ' + str.tostring(TP_Distance, '0.00') + ' %' + '\n' + 'Win $ → ' + str.tostring(Position_Size * TP_Distance / 100, '#') + ' $' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(take_profit_level) : na)) : Avg_Price != 0 and take_profit_level_True and Avg_Price > take_profit_level or Avg_Price == 0 and take_profit_level_True and close > take_profit_level and show_label ? label.new(x=take_profit_level_Location, y=take_profit_level, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=color.lime, textcolor=Text_Color, size=Label_Size, text='TP Short' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_TP_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'TakeProfit → ' + str.tostring(TP_Distance, '0.00') + ' %' + '\n' + 'Win $ → ' + str.tostring(Position_Size * TP_Distance / 100, '#') + ' $' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Stop_Level) : na)) : nalabel.delete(Take_Profit_Label[1])//STOP LOSS PLOT ---------------------------------------------------------------Stop_Line = Stop_True ? line.new(x1=startDate, y1=Stop_Level, x2=endDate, y2=Stop_Level, style=line.style_dashed,xloc = xloc.bar_time, width=2, color=Stop_Color) : naline.delete(Stop_Line[1])plot(Stop_True ? Stop_Level : na, title='Stop Loss', color=color.new(Stop_Color, 100))Stop_Label = Use_One_Label ? na : Avg_Price != 0 and Stop_True and Avg_Price > Stop_Level or Avg_Price == 0 and Stop_True and close > Stop_Level and show_label ? label.new(x=Stop_Location, y=Stop_Level, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=color.red, textcolor=Text_Color, size=Label_Size, text='Stop LONG' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Stop_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'StopLoss → ' + str.tostring(Stop_Distance, '0.00') + ' %' + '\n' + 'Loss $ → ' + str.tostring(Position_Size * Stop_Distance / 100, '#') + ' $' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Stop_Level) : na)) : Avg_Price != 0 and Stop_True and Avg_Price < Stop_Level or Avg_Price == 0 and Stop_True and close < Stop_Level and show_label ? label.new(x=Stop_Location, y=Stop_Level, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=color.red, textcolor=Text_Color, size=Label_Size, text='Stop SHORT' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Stop_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'StopLoss → ' + str.tostring(Stop_Distance, '0.00') + ' %' + '\n' + 'Loss $ → ' + str.tostring(Position_Size * Stop_Distance / 100, '#') + ' $' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Stop_Level) : na)) : nalabel.delete(Stop_Label[1])//PRICE 1 PLOT -----------------------------------------------------------------Price_1_val_Line = Price_1_val_True ? line.new(x1=startDate, y1=Price_1_val, x2=endDate, y2=Price_1_val,xloc = xloc.bar_time, color=Price_Color) : naline.delete(Price_1_val_Line[1])plot(Price_1_val_True ? Price_1_val : na, title='Price One', color=color.new(Price_Color, 100))Price_1_val_Label = Use_One_Label ? na : Price_1_val_True and close > Price_1_val and Stop_Level == 0 or Price_1_val_True and Stop_True and Stop_Level < Avg_Price and show_label ? label.new(x=Price_1_val_Location, y=Price_1_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(1) ' + (true ? 'Buy → ' + str.tostring(Order_One, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_1) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_1_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_1_val) : na)) : Price_1_val_True and close < Price_1_val and Stop_Level == 0 or Price_1_val_True and Stop_True and Stop_Level > Avg_Price and show_label ? label.new(x=Price_1_val_Location, y=Price_1_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(1) ' + (true ? 'Sell → ' + str.tostring(Order_One, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_1) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_1_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_1_val) : na)) : nalabel.delete(Price_1_val_Label[1])//PRICE 2 PLOT -----------------------------------------------------------------Price_2_val_Line = Price_2_val_True ? line.new(x1=startDate, y1=Price_2_val, x2=endDate, y2=Price_2_val,xloc = xloc.bar_time, color=Price_Color) : naline.delete(Price_2_val_Line[1])plot(Price_2_val_True ? Price_2_val : na, title='Price Two', color=color.new(Price_Color, 100))Price_2_val_Label = Use_One_Label ? na : Price_2_val_True and close > Price_2_val and Stop_Level == 0 or Price_2_val_True and Stop_True and Stop_Level < Avg_Price and show_label ? label.new(x=Price_2_val_Location, y=Price_2_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(2) ' + (true ? 'Buy → ' + str.tostring(Order_Two, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_2) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_2_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_2_val) : na)) : Price_2_val_True and close < Price_2_val and Stop_Level == 0 or Price_2_val_True and Stop_True and Stop_Level > Avg_Price and show_label ? label.new(x=Price_2_val_Location, y=Price_2_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(2) ' + (true ? 'Sell → ' + str.tostring(Order_Two, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_2) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_2_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_2_val) : na)) : nalabel.delete(Price_2_val_Label[1])//PRICE 3 PLOT -----------------------------------------------------------------Price_3_val_Line = Price_3_val_True ? line.new(x1=startDate, y1=Price_3_val, x2=endDate, y2=Price_3_val,xloc = xloc.bar_time, color=Price_Color) : naline.delete(Price_3_val_Line[1])plot(Price_3_val_True ? Price_3_val : na, title='Price Three', color=color.new(Price_Color, 100))Price_3_val_Label = Use_One_Label ? na : Price_3_val_True and close > Price_3_val and Stop_Level == 0 or Price_3_val_True and Stop_True and Stop_Level < Avg_Price and show_label ? label.new(x=Price_3_val_Location, y=Price_3_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(3) ' + (true ? 'Buy → ' + str.tostring(Order_Three, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_3) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_3_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_3_val) : na)) : Price_3_val_True and close < Price_3_val and Stop_Level == 0 or Price_3_val_True and Stop_True and Stop_Level > Avg_Price and show_label ? label.new(x=Price_3_val_Location, y=Price_3_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(3) ' + (true ? 'Sell → ' + str.tostring(Order_Three, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_3) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_3_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_3_val) : na)) : nalabel.delete(Price_3_val_Label[1])//PRICE 4 PLOT -----------------------------------------------------------------Price_4_val_Line = Price_4_val_True ? line.new(x1=startDate, y1=Price_4_val, x2=endDate, y2=Price_4_val,xloc = xloc.bar_time, color=Price_Color) : naline.delete(Price_4_val_Line[1])plot(Price_4_val_True ? Price_4_val : na, title='Price Four', color=color.new(Price_Color, 100))Price_4_val_Label = Use_One_Label ? na : Price_4_val_True and close > Price_4_val and Stop_Level == 0 or Price_4_val_True and Stop_True and Stop_Level < Avg_Price and show_label ? label.new(x=Price_4_val_Location, y=Price_4_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(4) ' + (true ? 'Buy → ' + str.tostring(Order_Four, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_4) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_4_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_4_val) : na)) : Price_4_val_True and close < Price_4_val and Stop_Level == 0 or Price_4_val_True and Stop_True and Stop_Level > Avg_Price and show_label ? label.new(x=Price_4_val_Location, y=Price_4_val, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='(4) ' + (true ? 'Sell → ' + str.tostring(Order_Four, '# $') + '\n' + 'Open Position → ' + str.tostring(Weight_4) : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_4_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_4_val) : na)) : nalabel.delete(Price_4_val_Label[1])//AVERAGE PRICE PLOT -----------------------------------------------------------Avg_Price_Line = Avg_Price_True ? line.new(x1=startDate, y1=Avg_Price, x2=endDate, y2=Avg_Price, style=line.style_dashed,xloc = xloc.bar_time, color=color.yellow) : naline.delete(Avg_Price_Line[1])plot(Avg_Price_True ? Avg_Price : na, title='Average Price', color=color.new(color.yellow, 100))Avg_Price_Label = Use_One_Label ? na : Avg_Price_True and close > Avg_Price and show_label ? label.new(x=Avg_Price_Location, y=Avg_Price, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=color.yellow, textcolor=Text_Color, size=Label_Size, text='AVR Price → ' + str.tostring(Avg_Price)  + '\n' + ' R:R → ' + str.tostring(TP_Distance / Stop_Distance, '0.00') + '\n' + 'All Position → ' + str.tostring(Position_Size, '#') + ' $') : Avg_Price_True and close < Avg_Price and show_label ? label.new(x=Avg_Price_Location, y=Avg_Price, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=color.yellow, textcolor=Text_Color, size=Label_Size, text='AVR Price → ' + str.tostring(Avg_Price)  + '\n' + ' R:R → ' + str.tostring(TP_Distance / Stop_Distance, '0.00') + '\n' + 'All Position → ' + str.tostring(Position_Size, '#') + ' $') : nalabel.delete(Avg_Price_Label[1])//ONE LABEL --------------------------------------------------------------------One_Label = Use_One_Label and Avg_Price != 0 and Stop_True and Avg_Price > Stop_Level or Use_One_Label and Avg_Price == 0 and Stop_True and close > Stop_Level or Use_One_Label and Stop_Level == 0 and Avg_Price_True and close > Avg_Price and show_label ? label.new(x=One_Label_Location, y=close, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_up, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='TP Long' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_TP_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'TakeProfit → ' + str.tostring(TP_Distance, '0.00') + ' %' + '\n' + 'Win $ → ' + str.tostring(Position_Size * TP_Distance / 100, '#') + ' $' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(take_profit_level) : na) +  '\n\n\n' +'R:R → ' + str.tostring(TP_Distance / Stop_Distance, '0.00') + '\n' + 'All Position → ' + str.tostring(Position_Size, '#') + ' $' + '\n\n'+(Price_1_val_True ? 'Price 1' + '\n———————' + (Show_Order_Amount ? '\n' + 'Order → ' + str.tostring(Order_One, '# $') : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_1_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_1_val) : na) : na) + (Price_2_val_True ? '\n\n Price 2' + '\n———————' + (Show_Order_Amount ? '\n' + 'Order → ' + str.tostring(Order_Two, '# $') : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_2_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_2_val) : na) : na) + (Price_3_val_True ? '\n\n Price 3' + '\n———————' + (Show_Order_Amount ? '\n' + 'Order → ' + str.tostring(Order_Three, '# $') : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_3_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_3_val) : na) : na) + (Avg_Price_True ? '\n\n Average Price' + '\n———————' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Avg_Price_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Avg_Price) : na) : na) + (Stop_True ? '\n\n Stop Loss' + '\n———————' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Stop_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'StopLoss → ' + str.tostring(Stop_Distance, '0.00') + ' %' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Stop_Level) : na) : na)) : Use_One_Label and Avg_Price != 0 and Stop_True and Avg_Price < Stop_Level or Use_One_Label and Avg_Price == 0 and Stop_True and close < Stop_Level or Use_One_Label and Stop_Level == 0 and Avg_Price_True and close < Avg_Price and show_label ? label.new(x=One_Label_Location, y=close, xloc=xloc.bar_time, yloc=yloc.price, style=label.style_label_down, color=Label_Color, textcolor=Text_Color, size=Label_Size, text='TP Short' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_TP_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'TakeProfit → ' + str.tostring(TP_Distance, '0.00') + ' %' + '\n' + 'Win $ → ' + str.tostring(Position_Size * TP_Distance / 100, '#') + ' $' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(take_profit_level) : na) +  '\n\n' + (Stop_True ? 'Stop Loss' + '\n———————' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Stop_Distance, '0.00') + ' %' : na) + (Show_Stop_Distance ? '\n' + 'StopLoss → ' + str.tostring(Stop_Distance, '0.00') + ' %' : na) + (Show_Order_Amount ? '\n' + 'Position → ' + str.tostring(Position_Size, '#') + ' $' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Stop_Level) : na) : na) + (Avg_Price_True ? '\n\n Average Price' + '\n———————' + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Avg_Price_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Avg_Price) : na) : na) + (Price_3_val_True ? '\n\n Price 3' + '\n———————' + (Show_Order_Amount ? '\n' + 'Order → ' + str.tostring(Order_Three, '# $') : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_3_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_3_val) : na) : na) + (Price_2_val_True ? '\n\n Price 2' + '\n———————' + (Show_Order_Amount ? '\n' + 'Order → ' + str.tostring(Order_Two, '# $') : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_2_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_2_val) : na) : na)  + (Price_1_val_True ? '\n\n Price 1' + '\n———————' + (Show_Order_Amount ? '\n' + 'Order → ' + str.tostring(Order_One, '# $') : na) + (Show_Real_Distance ? '\n' + 'Distance → ' + str.tostring(Real_Price_1_val_Distance, '0.00') + ' %' : na) + (Show_Price ? '\n' + 'Price → ' + str.tostring(Price_1_val) : na) + '\n\n\n' +'R:R → ' + str.tostring(TP_Distance / Stop_Distance, '0.00') + '\n' + 'All Position → ' + str.tostring(Position_Size, '#') + ' $'  : na)) : nalabel.delete(One_Label[1])// Strategy entries LONGif strategy.opentrades == 0 and inDateRange  and Avg_Price < take_profit_level  and Weight_1 != 'NaN' and Price_1_val_True and close[1] > Price_1_val    strategy.entry('Long_Open', strategy.long, qty= quantity(Order_One), limit = Price_1_val, alert_message = Long_message)if strategy.opentrades == 1 and inDateRange and Avg_Price < take_profit_level and Weight_2 != 'NaN' and Price_2_val_True and  close[1] > Price_2_val    strategy.entry('Long_Open', strategy.long, qty= quantity(Order_Two), limit = Price_2_val, alert_message = Long_message)if strategy.opentrades == 2 and inDateRange and Avg_Price < take_profit_level and Weight_3 != 'NaN' and Price_3_val_True and close[1] > Price_3_val    strategy.entry('Long_Open', strategy.long, qty= quantity(Order_Three), limit = Price_3_val, alert_message = Long_message)if strategy.opentrades == 3 and inDateRange and Avg_Price < take_profit_level and Weight_4 != 'NaN' and Price_4_val_True and close[1] > Price_4_val    strategy.entry('Long_Open', strategy.long, qty= quantity(Order_Four), limit = Price_4_val, alert_message = Long_message)// Strategy entries SHORTif strategy.opentrades == 0 and inDateRange  and Avg_Price > take_profit_level  and Weight_1 != 'NaN' and Price_1_val_True and close[1] < Price_1_val    strategy.entry('Short_Open', strategy.short, qty= quantity(Order_One), limit = Price_1_val, alert_message = Short_message)if strategy.opentrades == 1 and inDateRange and Avg_Price > take_profit_level and Weight_2 != 'NaN' and Price_2_val_True and  close[1] < Price_2_val    strategy.entry('Short_Open', strategy.short, qty= quantity(Order_Two), limit = Price_2_val, alert_message = Short_message)if strategy.opentrades == 2 and inDateRange and Avg_Price > take_profit_level and Weight_3 != 'NaN' and Price_3_val_True and close[1] < Price_3_val    strategy.entry('Short_Open', strategy.short, qty= quantity(Order_Three), limit = Price_3_val, alert_message = Short_message)if strategy.opentrades == 3 and inDateRange and Avg_Price > take_profit_level and Weight_4 != 'NaN' and Price_4_val_True and close[1] < Price_4_val    strategy.entry('Short_Open', strategy.short, qty= quantity(Order_Four), limit = Price_4_val, alert_message = Short_message)if strategy.opentrades > 0 and inDateRange and strategy.position_size > 0     strategy.exit('Long__Close',from_entry = "Long_Open", stop=Stop_Level, limit = take_profit_level , qty_percent=100, alert_message =Long_Exit_message)if strategy.opentrades > 0 and inDateRange and strategy.position_size < 0     strategy.exit('Short__Close',from_entry = "Short_Open", stop=Stop_Level, limit = take_profit_level , qty_percent=100, alert_message =Short_Exit_message)