PINE LIBRARY
업데이트됨 Commission-aware Trade Labels

Commission-aware Trade Labels
Description:
This library provides an easy way to visualize take-profit and stop-loss levels on your chart, taking into account trading commissions. The library calculates and displays the net profit or loss, along with other useful information such as risk/reward ratio, shares, and position size.
Features:
Configurable take-profit and stop-loss prices or percentages.
Set entry amount or shares.
Calculates and displays the risk/reward ratio.
Shows net profit or loss, considering trading commissions.
Customizable label appearance.
Usage:
Add the script to your chart.
Create an Order object for take-profit and stop-loss with desired configurations.
Call target_label() and stop_label() methods for each order object.
Example:
target_order = Order.new(take_profit_price=27483, stop_loss_price=28000, shares=0.2)
stop_order = Order.new(stop_loss_price=29000, shares=1)
target_order.target_label()
stop_order.stop_label()
This script is a powerful tool for visualizing your trading strategy's performance and helps you make better-informed decisions by considering trading commissions in your profit and loss calculations.
Library "tradelabels"
entry_price(this)
Parameters:
this: Order object
return entry_price
take_profit_price(this)
Parameters:
this: Order object
return take_profit_price
stop_loss_price(this)
Parameters:
this: Order object
return stop_loss_price
is_long(this)
Parameters:
this: Order object
return entry_price
is_short(this)
Parameters:
this: Order object
return entry_price
percent_to_target(this, target)
Parameters:
this: Order object
target: Target price
return percent
risk_reward(this)
Parameters:
this: Order object
return risk_reward_ratio
shares(this)
Parameters:
this: Order object
return shares
position_size(this)
Parameters:
this: Order object
return position_size
commission_cost(this, target_price)
Parameters:
this: Order object
return commission_cost
target_price
net_result(this, target_price)
Parameters:
this: Order object
target_price: The target price to calculate net result for (either take_profit_price or stop_loss_price)
return net_result
create_take_profit_label(this, prefix, size, offset_x, bg_color, text_color)
Parameters:
this
prefix
size
offset_x
bg_color
text_color
create_stop_loss_label(this, prefix, size, offset_x, bg_color, text_color)
Parameters:
this
prefix
size
offset_x
bg_color
text_color
create_entry_label(this, prefix, size, offset_x, bg_color, text_color)
Parameters:
this
prefix
size
offset_x
bg_color
text_color
create_line(this, target_price, line_color, offset_x, line_style, line_width, draw_entry_line)
Parameters:
this
target_price
line_color
offset_x
line_style
line_width
draw_entry_line
Order
Order
Fields:
entry_price: Entry price
stop_loss_price: Stop loss price
stop_loss_percent: Stop loss percent, default 2%
take_profit_price: Take profit price
take_profit_percent: Take profit percent, default 6%
entry_amount: Entry amount, default 5000$
shares: Shares
commission: Commission, default 0.04%
Description:
This library provides an easy way to visualize take-profit and stop-loss levels on your chart, taking into account trading commissions. The library calculates and displays the net profit or loss, along with other useful information such as risk/reward ratio, shares, and position size.
Features:
Configurable take-profit and stop-loss prices or percentages.
Set entry amount or shares.
Calculates and displays the risk/reward ratio.
Shows net profit or loss, considering trading commissions.
Customizable label appearance.
Usage:
Add the script to your chart.
Create an Order object for take-profit and stop-loss with desired configurations.
Call target_label() and stop_label() methods for each order object.
Example:
target_order = Order.new(take_profit_price=27483, stop_loss_price=28000, shares=0.2)
stop_order = Order.new(stop_loss_price=29000, shares=1)
target_order.target_label()
stop_order.stop_label()
This script is a powerful tool for visualizing your trading strategy's performance and helps you make better-informed decisions by considering trading commissions in your profit and loss calculations.
Library "tradelabels"
entry_price(this)
Parameters:
this: Order object
return entry_price
take_profit_price(this)
Parameters:
this: Order object
return take_profit_price
stop_loss_price(this)
Parameters:
this: Order object
return stop_loss_price
is_long(this)
Parameters:
this: Order object
return entry_price
is_short(this)
Parameters:
this: Order object
return entry_price
percent_to_target(this, target)
Parameters:
this: Order object
target: Target price
return percent
risk_reward(this)
Parameters:
this: Order object
return risk_reward_ratio
shares(this)
Parameters:
this: Order object
return shares
position_size(this)
Parameters:
this: Order object
return position_size
commission_cost(this, target_price)
Parameters:
this: Order object
return commission_cost
target_price
net_result(this, target_price)
Parameters:
this: Order object
target_price: The target price to calculate net result for (either take_profit_price or stop_loss_price)
return net_result
create_take_profit_label(this, prefix, size, offset_x, bg_color, text_color)
Parameters:
this
prefix
size
offset_x
bg_color
text_color
create_stop_loss_label(this, prefix, size, offset_x, bg_color, text_color)
Parameters:
this
prefix
size
offset_x
bg_color
text_color
create_entry_label(this, prefix, size, offset_x, bg_color, text_color)
Parameters:
this
prefix
size
offset_x
bg_color
text_color
create_line(this, target_price, line_color, offset_x, line_style, line_width, draw_entry_line)
Parameters:
this
target_price
line_color
offset_x
line_style
line_width
draw_entry_line
Order
Order
Fields:
entry_price: Entry price
stop_loss_price: Stop loss price
stop_loss_percent: Stop loss percent, default 2%
take_profit_price: Take profit price
take_profit_percent: Take profit percent, default 6%
entry_amount: Entry amount, default 5000$
shares: Shares
commission: Commission, default 0.04%
릴리즈 노트
v2Updated:
method create_take_profit_label(this, simulate, prefix, size, offset_x, bg_color, text_color)
Namespace types: Order
Parameters:
this (Order)
simulate (bool)
prefix (string)
size (string)
offset_x (simple int)
bg_color (color)
text_color (color)
method create_stop_loss_label(this, simulate, prefix, size, offset_x, bg_color, text_color)
Namespace types: Order
Parameters:
this (Order)
simulate (bool)
prefix (string)
size (string)
offset_x (simple int)
bg_color (color)
text_color (color)
method create_entry_label(this, simulate, prefix, size, offset_x, bg_color, text_color)
Namespace types: Order
Parameters:
this (Order)
simulate (bool)
prefix (string)
size (string)
offset_x (simple int)
bg_color (color)
text_color (color)
릴리즈 노트
v3Updated:
Order
Order
Fields:
entry_price (series float): Entry price
stop_loss_price (series float): Stop loss price
stop_loss_percent (series float): Stop loss percent, default 2%
take_profit_price (series float): Take profit price
take_profit_percent (series float): Take profit percent, default 6%
entry_amount (series float): Entry amount, default 5000$
shares (series float): Shares
commission (series float): Commission, default 0.04%
risk_reward_ratio (series float)
릴리즈 노트
v4릴리즈 노트
v5Updated:
method position_size(this, percent)
Namespace types: Order
Parameters:
this (Order): Order object
percent (float): The percentage of the total position size to calculate
return position_size
method commission_cost(this, target_price, shares)
Namespace types: Order
Parameters:
this (Order): Order object
target_price (float): The target price used for commission calculation
shares (float): The number of shares involved in the transaction
return commission_cost
method net_result(this, target_price, percent)
Namespace types: Order
Parameters:
this (Order): Order object
target_price (float): The target price to calculate net result for (either take_profit_price or stop_loss_price)
percent (float): The percentage of the position to calculate the net result for
return net_result
method create_take_profit_label(this, simulate, prefix, size, offset_x, bg_color, text_color, tp_percent)
Namespace types: Order
Parameters:
this (Order)
simulate (bool)
prefix (string)
size (string)
offset_x (simple int)
bg_color (color)
text_color (color)
tp_percent (float)
method create_stop_loss_label(this, simulate, prefix, size, offset_x, bg_color, text_color, sl_percent)
Namespace types: Order
Parameters:
this (Order)
simulate (bool)
prefix (string)
size (string)
offset_x (simple int)
bg_color (color)
text_color (color)
sl_percent (float)
Order
Order
Fields:
entry_price (series float): Entry price
stop_loss_price (series float): Stop loss price
stop_loss_percent (series float): Stop loss percent, default 2%
take_profit_price (series float): Take profit price
take_profit_percent (series float): Take profit percent, default 6%
entry_amount (series float): Entry amount, default 5000$
shares (series float): Shares
commission (series float): Commission, default 0.04%
릴리즈 노트
v6Updated:
Order
Order
Fields:
entry_price (series float): Entry price
stop_loss_price (series float): Stop loss price
stop_loss_percent (series float): Stop loss percent, default 2%
take_profit_price (series float): Take profit price
take_profit_percent (series float): Take profit percent, default 6%
entry_amount (series float): Entry amount, default 5000$
shares (series float): Shares
commission (series float): Commission, default 0.04%
risk_reward_ratio (series float)
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.