PINE LIBRARY
업데이트됨 Trade

Library "Trade"
A Trade Tracking Library
Monitor conditions with less code by using Arrays. When your conditions are met in chronologically, a signal is returned and the scanning starts again.
Create trades automatically with Stop Loss, Take Profit and Entry. The trades will automatically track based on the market movement and update when the targets are hit.
method signal(conditions, reset)
Signal Conditions
Namespace types: bool[]
Parameters:
conditions (bool[])
reset (bool)
Returns: Boolean: True when all the conditions have occured
method update(this, stoploss, takeprofit, entry)
Update Trade Parameters
Namespace types: Trade
Parameters:
this (Trade)
stoploss (float)
takeprofit (float)
entry (float)
Returns: nothing
method clear(this)
Clear Trade Parameters
Namespace types: Trade
Parameters:
this (Trade)
Returns: nothing
method track(this, _high, _low)
Track Trade Parameters
Namespace types: Trade
Parameters:
this (Trade)
_high (float)
_low (float)
Returns: nothing
new(stoploss, takeprofit, entry, _high, _low, condition, update)
New Trade with tracking
Parameters:
stoploss (float)
takeprofit (float)
entry (float)
_high (float)
_low (float)
condition (bool)
update (bool)
Returns: a Trade with targets and updates if stoploss or takeprofit is hit
new()
New Empty Trade
Returns: an empty trade
Trade
Fields:
stoploss (series__float)
takeprofit (series__float)
entry (series__float)
sl_hit (series__bool)
tp_hit (series__bool)
open (series__integer)
A Trade Tracking Library
Monitor conditions with less code by using Arrays. When your conditions are met in chronologically, a signal is returned and the scanning starts again.
Create trades automatically with Stop Loss, Take Profit and Entry. The trades will automatically track based on the market movement and update when the targets are hit.
Sample Usage
Enter a buy trade when RSI crosses below 70 then crosses above 80 before it crosses 40.
Note: If RSI crosses 40 before 80, No trade will be entered.Pine Script® rsi = ta.rsi(close, 21) buyConditions = array.new_bool() buyConditions.push(ta.crossunder(rsi, 70)) buyConditions.push(ta.crossover(rsi, 80)) buy = Trade.signal(buyConditions, ta.crossunder(rsi, 40)) trade = Trade.new(close-(100*syminfo.mintick), close +(200*syminfo.mintick), condition=buy) plot(trade.takeprofit, "TP", style=plot.style_circles, linewidth=4, color=color.lime) alertcondition(trade.tp_hit, "TP Hit")
method signal(conditions, reset)
Signal Conditions
Namespace types: bool[]
Parameters:
conditions (bool[])
reset (bool)
Returns: Boolean: True when all the conditions have occured
method update(this, stoploss, takeprofit, entry)
Update Trade Parameters
Namespace types: Trade
Parameters:
this (Trade)
stoploss (float)
takeprofit (float)
entry (float)
Returns: nothing
method clear(this)
Clear Trade Parameters
Namespace types: Trade
Parameters:
this (Trade)
Returns: nothing
method track(this, _high, _low)
Track Trade Parameters
Namespace types: Trade
Parameters:
this (Trade)
_high (float)
_low (float)
Returns: nothing
new(stoploss, takeprofit, entry, _high, _low, condition, update)
New Trade with tracking
Parameters:
stoploss (float)
takeprofit (float)
entry (float)
_high (float)
_low (float)
condition (bool)
update (bool)
Returns: a Trade with targets and updates if stoploss or takeprofit is hit
new()
New Empty Trade
Returns: an empty trade
Trade
Fields:
stoploss (series__float)
takeprofit (series__float)
entry (series__float)
sl_hit (series__bool)
tp_hit (series__bool)
open (series__integer)
릴리즈 노트
v2 Added Stop and Limit orders.Now you can track stop and limit orders. If you place a new trade with custom entry that is not the current market price, the trade will remain inactive until the market prices cross your entry point. Targets will not be tracked until we cross the threshold.
See these 2 examples of a buy limit. The green background activate when the trade is active.
릴리즈 노트
v3New property `profit`
Now you can check your trade profit by referencing the profit property. A negative value means that is a loss.
Example
// import DevLucem/Trade/3 as Trade
trade = Trade.new(close-(100*syminfo.mintick), close +(200*syminfo.mintick), close, condition=buy_condition)
plot(trade.profit)
Updated:
Trade
Fields:
stoploss (series float)
takeprofit (series float)
entry (series float)
active (series bool)
sl_hit (series bool)
tp_hit (series bool)
open (series int)
profit (series float)
릴리즈 노트
v4Retrieve previous trade fields, entry, stoploss and takeprofit.
Updated:
Trade
Fields:
stoploss (series float)
takeprofit (series float)
entry (series float)
active (series bool)
sl_hit (series bool)
tp_hit (series bool)
open (series int)
profit (series float)
lastEntry (series float)
lastTP (series float)
lastSL (series float)
릴리즈 노트
v5Bug fix: Added a missing feature from last update.
릴리즈 노트
v6Updated: New properties (profit and trade direction)
Trade
Fields:
stoploss (series float)
takeprofit (series float)
entry (series float)
active (series bool)
sl_hit (series bool)
tp_hit (series bool)
open (series int)
profit (series float)
cumulativeProfit (series float)
lastEntry (series float)
lastTP (series float)
lastSL (series float)
direction (series int)
lastDirection (series int)
릴리즈 노트
v7Updated:
method signal(conditions, reset_conditions, reset)
Signal Conditions
Namespace types: array<bool>
Parameters:
conditions (array<bool>)
reset_conditions (array<bool>)
reset (bool)
Returns: Array [Signal, State]: True when all the conditions have occured
Now you can see the state of your scanning. Also send a list of reset conditions that allow you to reset the scanning state.
Example usage:
rsi = ta.rsi(close, 14)
ema = ta.ema(close, 14)
[buy, state] = signal(
// Enter a trade when rsi goes below 20 then price crosses below 5 EMA and finally rsi crosses above 20
array.from(ta.crossunder(rsi, 20), ta.crossunder(close, ema), ta.crossover(rsi, 20)),
// Make sure rsi doesnt cross 80 after crossing 20 then rsi doesn't cross below 20 after crossing the EMA and anything can happen afterwards.
array.new_bool(0, false)
// array.from(ta.crossunder(rsi, 80), ta.crossunder(rsi, 20), false)
)
trade = new(high + (50*syminfo.mintick), close -(200*syminfo.mintick),buy[1], close, update=false)
bgcolor(color.new(color.red, 100 - (state*15)))
plotshape(buy and na(trade.entry[1]), "Sell", shape.labeldown, location.abovebar, color.red, 0, "SELL", color.white)
start = plot(trade.entry, "Entry", style=plot.style_circles, linewidth=2, color=color.aqua)
toSL = plot(trade.stoploss, "SL", style=plot.style_circles, linewidth=1, color=color.red)
toTP = plot(trade.takeprofit, "TP", style=plot.style_circles, linewidth=1, color=color.lime)
fill(start, toTP, color.new(color.lime, 80))
fill(start, toSL, color.new(color.red, 80))
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖
Automate TradingView Alerts
tradingview.to?ref=bih
🥰😍😍🥰😍😍🥰😍😍🥰
Automate TradingView Alerts
tradingview.to?ref=bih
🥰😍😍🥰😍😍🥰😍😍🥰
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
파인 라이브러리
진정한 트레이딩뷰 정신에 따라 작성자는 이 파인 코드를 오픈 소스 라이브러리로 공개하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 건배! 이 라이브러리는 개인적으로 또는 다른 오픈 소스 출판물에서 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰의 적용을 받습니다.
🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖
Automate TradingView Alerts
tradingview.to?ref=bih
🥰😍😍🥰😍😍🥰😍😍🥰
Automate TradingView Alerts
tradingview.to?ref=bih
🥰😍😍🥰😍😍🥰😍😍🥰
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.