PINE LIBRARY

PineConnector

Library "PineConnector"

This library is a comprehensive alert webhook text generator for PineConnector. It contains every possible alert syntax variation from the documentation, along with some debugging functions.

To use it, just import the library (eg. "import ZenAndTheArtOfTrading/PineConnector/1 as pc") and use pc.buy(licenseID) to send an alert off to PineConnector - assuming all your webhooks etc are set up correctly.

View the PineConnector documentation for more information on how to send the commands you're looking to send (all of this library's function names match the documentation).

all()
  Usage: pc.buy(pc_id, freq=pc.all())
  Returns: "all"

once_per_bar()
  Usage: pc.buy(pc_id, freq=pc.once_per_bar())
  Returns: "once_per_bar"

once_per_bar_close()
  Usage: pc.buy(pc_id, freq=pc.once_per_bar_close())
  Returns: "once_per_bar_close"

na0(value)
  Checks if given value is either 'na' or 0. Useful for streamlining scripts with float user setting inputs which default values to 0 since na is unavailable as a user input default.
  Parameters:
    value (float): The value to check
  Returns: True if the given value is 0 or na

getDecimals()
  Calculates how many decimals are on the quote price of the current market.
  Returns: The current decimal places on the market quote price

truncate(number, decimals)
  Truncates the given number. Required params: mumber.
  Parameters:
    number (float): Number to truncate
    decimals (int): Decimal places to cut down to
  Returns: The input number, but as a string truncated to X decimals

getPipSize(multiplier)
  Calculates the pip size of the current market.
  Parameters:
    multiplier (int): The mintick point multiplier (1 by default, 10 for FX/Crypto/CFD but can be used to override when certain markets require)
  Returns: The pip size for the current market

toWhole(number)
  Converts pips into whole numbers. Required params: number.
  Parameters:
    number (float): The pip number to convert into a whole number
  Returns: The converted number

toPips(number)
  Converts whole numbers back into pips. Required params: number.
  Parameters:
    number (float): The whole number to convert into pips
  Returns: The converted number

debug(txt, tooltip, displayLabel)
  Prints to console and generates a debug label with the given text. Required params: txt.
  Parameters:
    txt (string): Text to display
    tooltip (string): Tooltip to display (optional)
    displayLabel (bool): Turns on/off chart label (default: off)
  Returns: Nothing

order(licenseID, command, symbol, parameters, accfilter, comment, secret, freq, debug)
  Generates an alert string. Required params: licenseID, command.
  Parameters:
    licenseID (string): Your PC license ID
    command (string): Command to send
    symbol (string): The symbol to trigger this order on
    parameters (string): Other optional parameters to include
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: An alert string with valid PC syntax based on supplied parameters

market_order(licenseID, buy, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a market entry alert with relevant syntax commands. Required params: licenseID, buy, risk.
  Parameters:
    licenseID (string): Your PC license ID
    buy (bool): true=buy/long, false=sell/short
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A market order alert string with valid PC syntax based on supplied parameters

buy(licenseID, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a market buy alert with relevant syntax commands. Required params: licenseID, risk.
  Parameters:
    licenseID (string): Your PC license ID
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A market order alert string with valid PC syntax based on supplied parameters

sell(licenseID, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a market sell alert with relevant syntax commands. Required params: licenseID, risk.
  Parameters:
    licenseID (string): Your PC license ID
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A market order alert string with valid PC syntax based on supplied parameters

closeall(licenseID, comment, secret, freq, debug)
  Closes all open trades at market regardless of symbol. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closealleaoff(licenseID, comment, secret, freq, debug)
  Closes all open trades at market regardless of symbol, and turns the EA off. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closelong(licenseID, symbol, comment, secret, freq, debug)
  Closes all long trades at market for the given symbol. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closeshort(licenseID, symbol, comment, secret, freq, debug)
  Closes all open short trades at market for the given symbol. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closelongshort(licenseID, symbol, comment, secret, freq, debug)
  Closes all open trades at market for the given symbol. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closelongbuy(licenseID, risk, symbol, comment, secret, freq, debug)
  Close all long positions and open a new long at market for the given symbol with given risk/contracts. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    risk (float): Risk or contracts (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closeshortsell(licenseID, risk, symbol, comment, secret, freq, debug)
  Close all short positions and open a new short at market for the given symbol with given risk/contracts. Required params: licenseID, risk.
  Parameters:
    licenseID (string): Your PC license ID
    risk (float): Risk or contracts (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

newsltplong(licenseID, sl, tp, symbol, accfilter, comment, secret, freq, debug)
  Updates the stop loss and/or take profit of any open long trades on the given symbol with the given values. Required params: licenseID, sl and/or tp.
  Parameters:
    licenseID (string): Your PC license ID
    sl (float): Stop loss pips or price (according to EA settings)
    tp (float): Take profit pips or price (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

newsltpshort(licenseID, sl, tp, symbol, accfilter, comment, secret, freq, debug)
  Updates the stop loss and/or take profit of any open short trades on the given symbol with the given values. Required params: licenseID, sl and/or tp.
  Parameters:
    licenseID (string): Your PC license ID
    sl (float): Stop loss pips or price (according to EA settings)
    tp (float): Take profit pips or price (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closelongpct(licenseID, symbol, comment, secret, freq, debug)
  Close a percentage of open long positions (according to EA settings). Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closeshortpct(licenseID, symbol, comment, secret, freq, debug)
  Close a percentage of open short positions (according to EA settings). Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closelongvol(licenseID, risk, symbol, comment, secret, freq, debug)
  Close all open long contracts on the current symbol until the given risk value is remaining. Required params: licenseID, risk.
  Parameters:
    licenseID (string): Your PC license ID
    risk (float): The quantity to leave remaining
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

closeshortvol(licenseID, risk, symbol, comment, secret, freq, debug)
  Close all open short contracts on the current symbol until the given risk value is remaining. Required params: licenseID, risk.
  Parameters:
    licenseID (string): Your PC license ID
    risk (float): The quantity to leave remaining
    symbol (string): Symbol to act on (defaults to current symbol)
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

limit_order(licenseID, buy, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a limit order alert with relevant syntax commands. Required params: licenseID, buy, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    buy (bool): true=buy/long, false=sell/short
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A limit order alert string with valid PC syntax based on supplied parameters

buylimit(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a buylimit order alert with relevant syntax commands. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A limit order alert string with valid PC syntax based on supplied parameters

selllimit(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a selllimit order alert with relevant syntax commands. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A limit order alert string with valid PC syntax based on supplied parameters

stop_order(licenseID, buy, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a stop order alert with relevant syntax commands. Required params: licenseID, buy, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    buy (bool): true=buy/long, false=sell/short
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

buystop(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a buystop order alert with relevant syntax commands. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

sellstop(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Generates a sellstop order alert with relevant syntax commands. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

cancel_neworder(licenseID, order, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Cancel + place new order template function.
  Parameters:
    licenseID (string): Your PC license ID
    order (string): Cancel order type
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

cancellongbuystop(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Cancels all long orders with the specified symbol and places a new buystop order. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

cancellongbuylimit(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Cancels all long orders with the specified symbol and places a new buylimit order. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

cancelshortsellstop(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Cancels all short orders with the specified symbol and places a sellstop order. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

cancelshortselllimit(licenseID, price, risk, sl, tp, betrigger, beoffset, spread, trailtrig, traildist, trailstep, atrtimeframe, atrperiod, atrmultiplier, atrshift, atrtrigger, symbol, accfilter, comment, secret, freq, debug)
  Cancels all short orders with the specified symbol and places a selllimit order. Required params: licenseID, price, risk.
  Parameters:
    licenseID (string): Your PC license ID
    price (float): Price or pips to set limit order (according to EA settings)
    risk (float): Risk quantity (according to EA settings)
    sl (float): Stop loss distance in pips or price
    tp (float): Take profit distance in pips or price
    betrigger (float): Breakeven will be activated after the position gains this number of pips
    beoffset (float): Offset from entry price. This is the amount of pips you'd like to protect
    spread (float): Enter the position only if the spread is equal or less than the specified value in pips
    trailtrig (float): Trailing stop-loss will be activated after a trade gains this number of pips
    traildist (float): Distance of the trailing stop-loss from current price
    trailstep (float): Moves trailing stop-loss once price moves to favourable by a specified number of pips
    atrtimeframe (int): ATR Trailing Stop timeframe, only updates once per bar close. Options: 1, 5, 15, 30, 60, 240, 1440
    atrperiod (int): ATR averaging period
    atrmultiplier (float): Multiple of ATR to utilise in the new SL computation, default = 1
    atrshift (int): Relative shift of price information, 0 uses latest candle, 1 uses second last, etc. Default = 0
    atrtrigger (int): Activate the trigger of ATR Trailing after market moves favourably by a number of pips. Default = 0 (instant)
    symbol (string): The symbol to trigger this order on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment (maximum 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A stop order alert string with valid PC syntax based on supplied parameters

cancellong(licenseID, symbol, accfilter, comment, secret, freq, debug)
  Cancels all pending long orders with the specified symbol. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A cancel long alert command

cancelshort(licenseID, symbol, accfilter, comment, secret, freq, debug)
  Cancels all pending short orders with the specified symbol. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: A cancel short alert command

newsltpbuystop(licenseID, sl, tp, symbol, accfilter, comment, secret, freq, debug)
  Updates the stop loss and/or take profit of any pending buy stop orders on the given symbol. Required params: licenseID, sl and/or tp.
  Parameters:
    licenseID (string): Your PC license ID
    sl (float): Stop loss pips or price (according to EA settings)
    tp (float): Take profit pips or price (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

newsltpbuylimit(licenseID, sl, tp, symbol, accfilter, comment, secret, freq, debug)
  Updates the stop loss and/or take profit of any pending buy limit orders on the given symbol. Required params: licenseID, sl and/or tp.
  Parameters:
    licenseID (string): Your PC license ID
    sl (float): Stop loss pips or price (according to EA settings)
    tp (float): Take profit pips or price (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

newsltpsellstop(licenseID, sl, tp, symbol, accfilter, comment, secret, freq, debug)
  Updates the stop loss and/or take profit of any pending sell stop orders on the given symbol. Required params: licenseID, sl and/or tp.
  Parameters:
    licenseID (string): Your PC license ID
    sl (float): Stop loss pips or price (according to EA settings)
    tp (float): Take profit pips or price (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

newsltpselllimit(licenseID, sl, tp, symbol, accfilter, comment, secret, freq, debug)
  Updates the stop loss and/or take profit of any pending sell limit orders on the given symbol. Required params: licenseID, sl and/or tp.
  Parameters:
    licenseID (string): Your PC license ID
    sl (float): Stop loss pips or price (according to EA settings)
    tp (float): Take profit pips or price (according to EA settings)
    symbol (string): Symbol to act on (defaults to current symbol)
    accfilter (float): Optional minimum account balance filter
    comment (string): Optional comment to include (max 20 characters)
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

eaoff(licenseID, secret, freq, debug)
  Turns the EA off. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string

eaon(licenseID, secret, freq, debug)
  Turns the EA on. Required params: licenseID.
  Parameters:
    licenseID (string): Your PC license ID
    secret (string): Optional secret key (must be enabled in dashboard)
    freq (string): Alert frequency. Default = "all", options = "once_per_bar", "once_per_bar_close" and "none"
    debug (bool): Turns on/off debug label
  Returns: The required alert syntax as a string
alertsautoautomatedautomatedtradingautomaticautomationautotraderautotradingdebuggingpineconnectorstringstradingbot

Pine脚本库

本着真正的TradingView精神,作者将此Pine代码发布为开源脚本库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私下或在其它开源出版物中使用此脚本库,但在出版物中重复使用此代码受网站规则约束。


My Resources Hub: theartoftrading.com
FREE YouTube Lessons: rebrand.ly/zyt
FREE Pine Script Basics Course: rebrand.ly/zpsbc
Pine Script MASTERY Course: rebrand.ly/zpsmc
My Indicators & Strategies: rebrand.ly/zmisc
更多:

免责声明