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.


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.




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.
สแนปชอต
เอกสารเผยแพร่
v3

New property `profit`

Now you can check your trade profit by referencing the profit property. A negative value means that is a loss.

Example


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)
เอกสารเผยแพร่
v4

Retrieve 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)
เอกสารเผยแพร่
v5

Bug fix: Added a missing feature from last update.
เอกสารเผยแพร่
v6

Updated: 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)
เอกสารเผยแพร่
v7

Updated:
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:


arraysdebuggingdisplaysignalstrategytrade

ไลบรารีไพน์

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์ซไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน


🤖🤖🤖🤖🤖🤖🤖🤖🤖🤖
Automate TradingView Alerts
tradingview.to/anywhere
🥰😍😍🥰😍😍🥰😍😍🥰
และใน:

คำจำกัดสิทธิ์ความรับผิดชอบ