PineConnectorLibrary "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
Automated
Trade Warehouse (SPOT trades)Hello there!
Let's imagine You are trading SPOT, buy more and more every new dump, but bear market is not going to stop... and your first trade was 3 YEARS AGO!!!
Can't believe it is true.
The problem is - exchanges allow You to see only new trades last 6 months(Binance). But I want to see all of them! How do I know AVG Price?
This script is my solution. Just use it to track and store your trade, so You can see AVG without uploading old trades everytime and using calculator.
Script description:
Here You can see the "Trade" type of variable. Python script using Pandas converts trades from .csv file into string type that You can input as trade(price, pair, amount, date..). After it uppends to the trades_array and pushed into the loop.
If trade date is more than current cundle - it pushes new trade to other arrays such a "pair", "avg_tot" etc. to comput it later.
If trade was buy - it increase invested capital and owned amount, opposite for sell and recomputs AVG price.
Since script has at least 1 trade it starts to plot AVG price.
There are 2 AVG price:
1. For total invested counting(You can get negative value if traded successful)
2. Current AVG price since last 0 currency amount(there is dust value to set how many usd we take as dust)
Table represents all assets statistics
Just upload your trades only 1 time, use script to convert it into pine code, and use as indicator. This script allow You to see ALL trades from oldest to the newest.
github.com/Arivadis/...w_Tradings_warehouse
If this script helped You - press Star (on GitHub) Like (on TradingView)
Warning -
Does not include free/earn/withdraw/deposit counting. Only Buy and Sell =>
This script has no idea about your side currency deposits, so if You got Your BTC or EUR or .. from another wallet and sold later - it can break your statistical data. Add this transfer manually(see examples inside script).
Use my github manual to get this script workin.
Installing takes around 3 minutes and contains 3-5 steps
Auto Fibonacci TP Levels [WJ]This script automatically draws Fibonacci levels on a trading chart which are popular tools for traders seeking to identify potential areas of support and resistance.
Here are the features and benefits of this script:
1. Versatility in Sourcing Trade Entries:
Trade source can be customized to either longs (buying trades) or shorts (selling trades). The user has the flexibility to adjust their entry points based on their trading strategy.
Up to 2 sources can be used, expand if you wish.
As it is coded now, the source you have to pick from has to have a 'plot' that sends a (long) or (short) and is equal to 1 and 2 respectively.
Example: In the script you want to use for Long and Shorts, make a plot like this:
plot(LONG ? 1 : SHORT ? 2 : 0, title = "⭐ Outbound signal", display = display.none, editable = false)
The variable name of the LONG and SHORT needs to be the same as the one your code is using to indicate those trades.
2. Flexible Fibonacci Start Points:
The starting points for drawing Fibonacci levels can be customized for both longs and shorts.
3. Configurable Historical Data Length:
Users can adjust the number of historical bars to analyze for calculating higher highs (HH) and lower lows (LL).
4. Informative Labels and Lines:
The script can be configured to show the distance from the entry point to the 0.618 Fibonacci level (the so-called "golden ratio"). This helps traders to visualize the risk-reward ratio of their trades.
It indicates when a Fibonacci level was crossed which could signal a potential reversal.
It allows users to display the golden pocket levels only (0.618 and 0.65) or all the Fibonacci levels.
5. Customizable Fibonacci Levels and Colors:
Users can define their preferred Fibonacci levels and assign specific colors to each of these levels. This helps in identifying different levels quickly and intuitively.
The script also includes functionality for setting stop loss levels for short and long positions, which helps in risk management.
6. Clear Visualization of Crossing Levels:
If a trade crosses a specific Fibonacci level, the script draws lines indicating the crossing. This can help traders to identify potential breakout or reversal points.
7. Calculation of Fibonacci Boxes:
For each Fibonacci level, the script creates a box that indicates the level's range on the chart. This visual aid can help traders to better understand the price movement within these levels.
8. Customizable Labels:
The script provides percentage difference labels at each Fibonacci level, displaying the difference between the price at that level and the price at the 0 Fibonacci level. This can help users quickly understand the price change in terms of percentage at each level.
9. Performance Efficiency:
The script uses arrays to store and manage the Fibonacci levels and their associated colors. This approach enhances the performance of the script, especially when processing a large amount of data.
10. Adaptability:
This script automatically adapts to market movements. When the price crosses a level, it identifies and records this event, aiding the trader's decision-making process.
Overall, this script is highly customizable, adaptable and provides a clear visual representation of important trading data, making it an effective tool for traders using Fibonacci levels in their strategies.
NOTE: If you can't see the fib lines, it is because they have already been triggered/touched by a candle and they are set to not continue after they are touched.
VWAP Open Session Anchored by HampehThe VWAP Open Session Anchored indicator differs from traditional VWAP indicators by automatically anchoring the Volume Weighted Average Price calculation to three market session starts Morning, Evening, and Night. Each session represents a distinct time period within the trading day, offering traders and investors a more comprehensive view of the volume-weighted average price within specific sessions.
What Is the Volume-Weighted Average Price (VWAP)?
The volume-weighted average price (VWAP) is a technical analysis indicator used on intraday charts that resets at the start of every new trading session.
VWAP is important because it provides traders with pricing insight into both the trend and value of a security.
KEY TAKEAWAYS
1. The volume-weighted average price (VWAP) is a single line on intraday charts.
2. It looks similar to a moving average line but smoother.
3. VWAP represents a view of price action throughout a single day's trading session.
4. Retail and professional traders may use the VWAP to help them determine intraday price trends.
5. VWAP typically is most useful to short-term traders.
VWAP is calculated by totaling the dollars traded for every transaction (price multiplied by the volume) and then dividing by the total shares traded.
VWAP = Cumulative Typical Price x Volume/Cumulative Volume
Where Typical Price = High price + Low price + Closing Price/3
Cumulative = total since the trading session opened.
How Is VWAP Used?
VWAP is used in different ways by traders. Traders may use VWAP as a trend confirmation tool and build trading rules around it. For instance, they may consider stocks with prices below VWAP as undervalued and those with prices above it, as overvalued. If prices below VWAP move above it, traders may go long on the stock. If prices above VWAP move below it, they may sell their positions or initiate short positions.
Institutional buyers including mutual funds use VWAP to help move into or out of stocks with as small of a market impact as possible. Therefore, when they can, institutions will try to buy below the VWAP or sell above it. This way their actions push the price back toward the average, instead of away from it.
Source: www.investopedia.com
Grid Indicator - The Quant ScienceQuickly draw a 10-level grid on your chart with our open-source tool.
Our grid tool offers a unique solution to traders looking to maximize their profits in volatile market conditions. With its advanced features, you can create customized grids based on your preferred start price and line distance, allowing you to easily execute trades and capitalize on price movements. The tool works automatically, freeing up your time to focus on other important aspects of your trading strategy.
The benefits of using this tool are numerous. Firstly, it eliminates the need for manual calculation, making the analysis process much more efficient. Secondly, the automatic nature of the tool ensures that each grids are draw at precisely prices, giving you the best possible chance of maximizing your analysis. Finally, the ability to easily customize grids means that you can adapt your strategy quickly and effectively, even in rapidly changing market conditions.
So why wait? Take control of your trading and start using our innovative grid tool today! With its advanced features and ease of use, it's the perfect solution for traders of all levels looking to take their trading to the next level.
HOW TO USE
Using it is easy. Add the script to your chart and set the price and distance between the grids.
Entry helperHello traders,
This is a script I use daily as a scalper and it helps me a lot, maybe it can help you, this is why I am sharing it!
PART 1 - DESCRIPTION
This program is specifically designed to help scalpers but can be used for all types of trading but won't be as useful.
This script is what I call an entry helper as it calculates dynamically the position size, stop loss and take profit levels and more.
When scalping and placing market entry orders, the price can move significantely while you are calculating your position size according to your stop loss, capital, risk and especially close price that changes very quickly, this results in a risk that is not ideally controlled and personally was a source of frustration and stress. I wanted to enter my quantity and stop loss values as fast as possible and make the process easier.
This script automates the calculation of the position size, stop loss and take profit levels according the the users input and prints the data visibly on the screen so it is easy to copy by the trader. It allows the trader to be confident that his risk is as controlled as possible.
The script is easy to use and set up, this guide will help you if you have any difficulies or questions.
PART 2 - HOW TO USE THE SCRIPT
- SET THE CAPITAL SETTINGS
1 - Set your capital value in $
- SET THE TRADE SETTINGS
2 - Set your trade side (BUY or SELL)
3 - Set you desired risk in % of your capital
- ENTRY SETTINGS
4 - Set your entry from 2 different options
|MARKET| (default option)
This option will place the entry level at the last available price
|LIMIT|
This option allows you to input a fixed price level for the entry
- STOP LOSS SETTINGS
5 - Select your stop loss placement from 4 different options
|EXTREMA STOP LOSS| (default option)
This option will place the stop loss at the highest/lowest (extrema) price level within the last N candles
|ATR EXTREMA|
This option uses the same price level as the EXTREMA STOP LOSS but will add/soustract the last ATR value (calculated on the N last candles) multiplied by a coefficient that you input
|TICKS EXTREMA|
This option uses the same price level as the EXTREMA STOP LOSS but will add/soustract a number of ticks that you input
|PRICE LEVEL|
This option allows you to input a fixed price level for the stop loss
- TAKE PROFIT SETTINGS
6 - Select your take profit from 3 different options
|NONE| (default option)
This option will not display any take profit level, I have added this option as I don't have take profit targets
|RR|
This option uses a risk to reward ratio (reward/risk) that you input, it will automatically calculate the take profit level that corresponds
|PRICE LEVEL|
This option allows you to input a fixed price level for the take profit
- QUANTITY AND FEE SETTINGS
7 - Set the quantity settings, it represents the quantity in a lot (usually 100 000 in forex, 100 in stocks 1 for crypto currencies)
8 - Set the fee per quantity (turning lot)
- VISUAL SETTINGS
9 - Show or remove the tab
- TAB SETTINGS
10 - Select the data that you want to display in the tab (the tab will adapt automatically)
NOTES:
The vertical dashed line shows what candle has been used for the calculation of the stop loss, it allows you to visualize what candle the script has selected in case of an EXTREMA stop loss option.
I hope this helps you out! Any suggestions are welcome and I hope that the guide is clear enough.
Happy trading!
[HM] Fibonacci Fractals Absolute Auto v20221114Basically:
F - Fibonacci levels
F - fractals: retracement of retracement
A - absolute: based on two fixed points instead user chosen Fibonacci points
A - auto: automatically draws based on volatility
Explanation:
This script will automatically trace TWO Fibonacci levels from these points:
- ALL TIME HIGH (ATH) and ALL TIME LOW ( ATL ) prices
This is our first Fibonacci FRACTAL retracement and the line caption will show ONE character:
"↥" for 0.618
"↧" for 0.382
The FRACTAL with two lines will define THREE regions.
The second Fibonacci FRACTAL retracement will show TWO characters:
the same "↥" "↧" characters with:
"a" if the price is between TOP region of previous fractal
"b" if the price is between MIDDLE region of previous fractal
"c" if the price is between BOTTOM region of previous fractal
The third Fibonacci FRACTAL will show THREE characters and so on.
Delimited by volatility (otherwise this script will go to 10th fractal maximum).
OPTIONS to give a try:
- use ALL TIME HIGH and ZERO prices (instead ATH and ATL )
- use a non-Fibonacci retracement:
---> "⅓": 1/3 and 2/3 levels instead 0.618 and 0.382 (based on chess master Hindenburg Melão article hint)
---> "fibonaccing": 0.764 and 0.236 levels (based on Brazilian trader Marco Antonio Rossi method hint)
#script under development, sugestions and questions are welcome.
Trailing Stop SnippetThis is an example snippet that should allow for adding a trailing stop and trailing stop activation to almost any script.
You can use it by setting a trailing stop alone. This will provide you standard trailing stop functionality allowing you to lock in profits and increase your stop-loss as the price moves in your direction.
You can also set the trailing stop activation to trigger the original trailing stop at a certain level. "Once price rises 5%, set a trailing stop at break even". This would be set as 5 and 5 in the settings.
MPF EMA Cross Strategy (8~13~21) by Market Pip FactoryThis script is for a complete strategy to win maximum profit on trades whilst keeping losses at a minimum, using sound risk management at no greater than 1.5%
The 3x EMA Strategy uses the following parameters for trade activation and closure.
1/ Daily Time Frame for trend confirmation
2/ 4 Hourly Time Frame for trend confirmation
3/ 1 Hourly Time Frame for trend confirmation AND trade execution
4/ 3x EMAs (Exponential Moving Averages)
* EMA#1 = 8 EMA (Red Color)
* EMA#2 = 13 EMA (Blue Color)
* EMA#3 = 21 EMA (Orange Color)
5/ Fanning of all 3x EMAs and CrossOver/CrossUnder for Trend Confirmation
6/ Price Action touching an 8 EMA for trade activation
7/ Price Action touching a 21 EMA for trade cancellation BEFORE activation
* For LONG trades: 8 EMA would be ABOVE 21 EMA
* For SHORT trades: 8 EMA would be BELOW 21 EMA
* For trade Cancellation, price action would touch the 21 EMA before trade is activated
* For trade Entry, price action would touch 8 EMA
Once trigger parameter is identified, entry is found by:
a) Price action touches 8 EMA (Candle must Close for confirmed Trade preparation)
b) Trade preparation can be cancelled before trade is activated if price action touches 21 EMA
c) Trailing Stop Loss can be used (optional) by counting back 5 candles from current candle
CLOSURE of a Trade is identified by:
e) 8 EMA crossing the 21 EMA, then close trade, no matter LONG or SHORT
f) Trail Stop Loss
IMPORTANT:
g) No more than ONE activated trade per EMA crossover
h) No more than ONE active trade per pair
NOTE: This strategy is to be used in conjunction with Cipher Twister (my other indicator) to reduce trades on
sideways price action and market trends for super high win ratio.
NOTE: Enabling of LONGs and SHORTs Via Cipher Twister is done by using the previous
green or red dot made. Additionally, when the trend changes, so do the dot's validity based
on being above or below the 0 centerline.
----------------------------
Strategy and Bot Logic
----------------------------
.....::: FOR SHORT TRADES ONLY :::.....
The Robot must use the following logic to enable and activate the SHORT trades:
Parameters:
$(crossunder)=8EMA,21EMA=Bearish $(crossover)=8EMA,21EMA=Bullish $entry=SELL STOP ORDER (Short)
$EMA#1 = 8 EMA (Red Color) $EMA#2 = 13 EMA (Blue Color) $EMA#3 = 21 EMA (Orange Color)
Strategy Logic:
1/ Check Daily Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=daily and trend=$(crossunder) then goto 2/ *Means: crossunder = ema21 > ema8
$(chart)=daily and trend=$(crossover) then stop (No trades) *Means: crossover = ema8 > ema21
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
2/ Check 4 Hourly Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=4H and trend=$(crossunder) then goto 3/ *Means: crossunder = ema21 > ema8
$(chart)=4H and trend=$(crossover) then stop (No trades) *Means: crossover = ema8 > ema21
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
3/ 1 Hourly Time Frame for trend confirmation AND trade execution if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=1H and trend=$(crossunder) then goto 4/ *Means: crossunder = ema21 > ema8
$(chart)=1H and trend=$(crossover) then stop (No trades) *Means: crossover = ema8 > ema21
4/ Trade preparation:
* if Next (subsequent) candle touches 8EMA, then set STOP LOSS and ENTRY
* $stoploss=3 pips ABOVE current candle HIGH
* $entry=3 pips BELOW current candle LOW
5/ Trade waiting (ONLY BEFORE entry is hit and trade activated):
* if price action touches 21 EMA then cancel trade and goto 1/
Note: Once trade is active this function does not apply !
6/ Trade Activation:
* if price activates/hits ENTRY price, then bot activates trade SHORTs market
7/ Optional Trailing stop:
* if active, then trailing stop 3 pips ABOVE previous HIGH of previous 5th candle
or * Move Stop Loss to Break Even after $X number of pips
NOTE: This means count back and apply accordingly to the 5th previous candle from current candle.
NOTE: This function is switchable. 0=off and 1=on(active). Default = 0 (off)
8/ Trade Close ~ Take Profit:
* Only TP when
$(chart)=1H and trend=$(crossover) then close trade ~ Or obviously if Stop Loss is hit if 7/ is activated.
----------END FOR SHORT TRADES LOGIC----------
.....::: FOR LONG TRADES ONLY :::.....
The Robot must use the following logic to enable and activate the LONG trades:
Parameters:
$(crossunder)=8EMA,21EMA=Bearish $(crossover)=8EMA,21EMA=Bullish $entry=BUY STOP ORDER (Long)
$EMA#1 = 8 EMA (Red Color) $EMA#2 = 13 EMA (Blue Color) $EMA#3 = 21 EMA (Orange Color)
Strategy Logic:
1/ Check Daily Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=daily and trend=$(crossover) then goto 2/ *Means: crossover = ema8 > ema21
$(chart)=daily and trend=$(crossunder) then stop (No trades) *Means: crossunder = ema21 > ema8
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
2/ Check 4 Hourly Time Frame for trend confirmation if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=4H and trend=$(crossover) then goto 3/ *Means: crossover = ema8 > ema21
$(chart)=4H and trend=$(crossunder) then stop (No trades) *Means: crossunder = ema21 > ema8
NOTE: This function is switchable. 0=off and 1=on(active). Default = 1 (on)
3/ 1 Hourly Time Frame for trend confirmation AND trade execution if:
(look back up to 50 candles - find last cross of EMAs)
$(chart)=1H and trend=$(crossover) then goto 4/ *Means: crossover = ema8 > ema21
$(chart)=1H and trend=$(crossunder) then stop (No trades) *Means: crossunder = ema21 > ema8
4/ Trade preparation:
* if Next (subsequent) candle touches 8EMA, then set STOP LOSS and ENTRY
* $stoploss=3 pips BELOW current candle LOW
* $entry=3 pips ABOVE current candle HIGH
5/ Trade waiting (ONLY BEFORE entry is hit and trade activated):
* if price action touches 21 EMA then cancel trade and goto 1/
Note: Once trade is active this function does not apply !
6/ Trade Activation:
* if price activates/hits ENTRY price, then bot activates trade LONGs market
7/ Optional Trailing stop:
* if active, then trailing stop 3 pips BELOW previous LOW of previous 5th candle
or * Move Stop Loss to Break Even after $X number of pips
NOTE: This means count back and apply accordingly to the 5th previous candle from current candle.
NOTE: This function is switchable. 0=off and 1=on(active). Default = 0 (off)
8/ Trade Close ~ Take Profit:
* Only TP when
$(chart)=1H and trend=$(crossunder) then close trade ~ Or obviously if Stop Loss is hit if 7/ is activated.
----------END FOR LONG TRADES LOGIC----------
IMPORTANT:
* If an existing trade is already open for that same pair, & price action touches 8EMA, do NOT open a new trade..
* bot must continuously check if a trade is currently open on the pair that triggers
* New trades are to be only opened if there is no active trade opened on current pair.
* Only 1 trade per pair rule !
* 5 simultaneous open trades (not same pairs) default = 5 but value can be changed accordingly.
* Maximum risk management must not exceed 1.5% on lot size
*** Some features are not yet available autoated, they will be added in due course in subsequent version updates ***
Bjorgum Double Tap█ OVERVIEW
Double Tap is a pattern recognition script aimed at detecting Double Tops and Double Bottoms. Double Tap can be applied to the broker emulator to observe historical results, run as a trading bot for live trade alerts in real time with entry signals, take profit, and stop orders, or to simply detect patterns.
█ CONCEPTS
How Is A Pattern Defined?
Doubles are technical formations that are both reversal patterns and breakout patterns. These formations typically have a distinctive “M” or a “W” shape with price action breaking beyond the neckline formed by the center of the pattern. They can be recognized when a pivot fails to break when tested for a second time and the retracement that follows breaks beyond the key level opposite. This can trap entrants that were playing in the direction of the prior trend. Entries are made on the breakout with a target projected beyond the neckline equal to the height of the pattern.
Pattern Recognition
Patterns are recognized through the use of zig-zag; a method of filtering price action by connecting swing highs and lows in an alternating fashion to establish trend, support and resistance, or derive shapes from price action. The script looks for the highest or lowest point in a given number of bars and updates a list with the values as they form. If the levels are exceeded, the values are updated. If the direction changes and a new significant point is made, a new point is added to the list and the process starts again. Meanwhile, we scan the list of values looking for the distinctive shape to form as previously described.
█ STRATEGY RESULTS
Back Testing
Historical back testing is the most common method to test a strategy due in part to the general ease of gathering quick results. The underlying theory is that any strategy that worked well in the past is likely to work well in the future, and conversely, any strategy that performed poorly in the past is likely to perform poorly in the future. It is easy to poke holes in this theory, however, as for one to accept it as gospel, one would have to assume that future results will match what has come to pass. The randomness of markets may see to it otherwise, so it is important to scrutinize results. Some commonly used methods are to compare to other markets or benchmarks, perform statistical analysis on the results over many iterations and on differing datasets, walk-forward testing, out-of-sample analysis, or a variety of other techniques. There are many ways to interpret the results, so it is important to do research and gain knowledge in the field prior to taking meaningful conclusions from them.
👉 In short, it would be naive to place trust in one good backtest and expect positive results to continue. For this reason, results have been omitted from this publication.
Repainting
Repainting is simply the difference in behaviour of a strategy in real time vs the results calculated on the historical dataset. The strategy, by default, will wait for confirmed signals and is thus designed to not repaint. Waiting for bar close for entires aligns results in the real time data feed to those calculated on historical bars, which contain far less data. By doing this we align the behaviour of the strategy on the 2 data types, which brings significance to the calculated results. To override this behaviour and introduce repainting one can select "Recalculate on every tick" from the properties tab. It is important to note that by doing this alerts may not align with results seen in the strategy tester when the chart is reloaded, and thus to do so is to forgo backtesting and restricts a strategy to forward testing only.
👉 It is possible to use this script as an indicator as opposed to a full strategy by disabling "Use Strategy" in the "Inputs" tab. Basic alerts for detection will be sent when patterns are detected as opposed to complex order syntax. For alerts mid-bar enable "Recalculate on every tick" , and for confirmed signals ensure it is disabled.
█ EXIT ORDERS
Limit and Stop Orders
By default, the strategy will place a stop loss at the invalidation point of the pattern. This point is beyond the pattern high in the case of Double Tops, or beneath the pattern low in the case of Double Bottoms. The target or take profit point is an equal-legs measurement, or 100% of the pattern height in the direction of the pattern bias. Both the stop and the limit level can be adjusted from the user menu as a percentage of the pattern height.
Trailing Stops
Optional from the menu is the implementation of an ATR based trailing stop. The trailing stop is designed to begin when the target projection is reached. From there, the script looks back a user-defined number of bars for the highest or lowest point +/- the ATR value. For tighter stops the user can look back a lesser number of bars, or decrease the ATR multiple. When using either Alertatron or Trading Connector, each change in the trail value will trigger an alert to update the stop order on the exchange to reflect the new trail price. This reduces latency and slippage that can occur when relying on alerts only as real exchange orders fill faster and remain in place in the event of a disruption in communication between your strategy and the exchange, which ensures a higher level of safety.
👉 It is important to note that in the case the trailing stop is enabled, limit orders are excluded from the exit criteria. Rather, the point in time that the limit value is exceeded is the point that the trail begins. As such, this method will exit by stop loss only.
█ ALERTS
Five Built-in 3rd Party Destinations
The following are five options for delivering alerts from Double Tap to live trade execution via third party API solutions or chat bots to share your trades on social media. These destinations can be selected from the input menu and alert syntax will automatically configure in alerts appropriately to manage trades.
Custom JSON
JSON, or JavaScript Object Notation, is a readable format for structuring data. It is used primarily to transmit data between a server and a web application. In regards to this script, this may be a custom intermediary web application designed to catch alerts and interface with an exchange API. The JSON message is a trade map for an application to read equipped with where its been, where its going, targets, stops, quantity; a full diagnostic of the current state and its previous state. A web application could be configured to follow the messages sent in this format and conduct trades in sync with alerts running on the TV server.
Below is an example of a rendered JSON alert:
{
"passphrase": "1234",
"time": "2022-05-01T17:50:05Z",
"ticker": "ETHUSDTPERP",
"plot": {
"stop_price": 2600.15,
"limit_price": 3100.45
},
"strategy": {
"position_size": 0.1,
"order_action": "buy",
"market_position": "long",
"market_position_size": 0,
"prev_market_position": "flat",
"prev_market_position_size": 0
}
}
Trading Connector
Trading Connector is a third party fully autonomous Chrome extension designed to catch alert webhooks from TradingView and interface with MT4/MT5 to execute live trades from your machine. Alerts to Trading Connector are simple; just select the destination from the input drop down menu, set your ticker in the "TC Ticker" box in the "Alert Strings" section and enter your URL in the alert window when configuring your alert.
Alertatron
Alertatron is an automated algo platform for cryptocurrency trading that is designed to automate your trading strategies. Although the platform is currently restricted to crypto, it offers a versatile interface with high flexibility syntax for complex market orders and conditions. To direct alerts to Alertatron, select the platform from the 3rd party drop down, configure your API key in the ”Alertatron Key” box and add your URL in the alert message box when making alerts.
3 Commas
3 Commas is an easy and quick to use click-and-go third party crypto API solution. Alerts are simple without overly complex syntax. Messages are simply pasted into alerts and executed as alerts are triggered. There are 4 boxes at the bottom of the "Inputs" tab where the appropriate messages to be placed. These messages can be copied from 3 Commas after the bots are set up and pasted directly into the settings menu. Remember to select 3 Commas as a destination from the third party drop down and place the appropriate URL in the alert message window.
Discord
Some may wish to share their trades with their friends in a Discord chat via webhook chat bot. Messages are configured to notify of the pattern type with targets and stop values. A bot can be configured through the integration menu in a Discord chat to which you have appropriate access. Select Discord from the 3rd party drop down menu and place your chat bot URL in the alert message window when configuring alerts.
👉 For further information regarding alert setup, refer to the platform specific instructions given by the chosen third party provider.
█ IMPORTANT NOTES
Setting Alerts
For alert messages to be properly delivered on order fills it is necessary to place the following placeholder in the alert message box when creating an alert.
{{strategy.order.alert_message}}
This placeholder will auto-populate the alert message with the appropriate syntax that is designated for the 3rd party selected in the user menu.
Order Sizing and Commissions
The values that are sent in alert messages are populated from live metrics calculated by the strategy. This means that the actual values in the "Properties" tab are used and must be set by the user. The initial capital, order size, commission, etc. are all used in the calculations, so it is important to set these prior to executing live trades. Be sure to set the commission to the values used by the exchange as well.
👉 It is important to understand that the calculations on the account size take place from the beginning of the price history of the strategy. This means that if historical results have inflated or depleted the account size from the beginning of trade history until now, the values sent in alerts will reflect the calculated size based on the inputs in the "Properties" tab. To start fresh, the user must set the date in the "Inputs" tab to the current date as to remove trades from the trade history. Failure to follow this instruction can result in an unexpected order size being sent in the alert.
█ FOR PINECODERS
• With the recent introduction of matrices in Pine, the script utilizes a matrix to track pivot points with the bars they occurred on, while tracking if that pivot has been traded against to prevent duplicate detections after a trade is exited.
• Alert messages are populated with placeholders ; capability that previously was only possible in alertcondition() , but has recently been extended to `strategy.*()` functions for use in the `alert_message` argument. This allows delivery of live trade values to populate in strategy alert messages.
• New arguments have been added to strategy.exit() , which allow differentiated messages to be sent based on whether the exit occurred at the stop or the limit. The new arguments used in this script are `alert_profit` and `alert_loss` to send messages to Discord
Automated Anchored VWAPThis was reasonably easy to put together and I can't find one that does this in the Library and I've been wanting one. Of course, the drawing tool is just fantastic, but sometimes it can be forgotten as new pivots emerge.
What you'll find elsewhere in the Library is a nice variety of fancier methods for determining an anchor point with labels, lines, timestamps and standard deviations.
This is just a simple script to pull the Anchored VWAP off of the most recent pivot and update that as new pivots become defined.
I wanted it to be really portable so it could easily work into other things you're working on while also keeping the chart reasonably clean.
The way this functions is as follows: A new pivot is found and VWAP is calculated from it. At that point the prior aVWAP is no longer tracked and it picks up from the new pivot .
Of course this means that the plot doesn't generate until the pivot is actually confirmed, which in turn means that the plot doesn't reach back to the pivot , it begins based on whatever "right bars" period you end up choosing.
I kind of like it that way, because you have your eyes on the one that matters until the new one matters.
The downside is that it doesn't track old pivots . The old aVWAP might still be in play. But if you track all of the old one's you'll have a 100 lines on your chart and no one wants that.
I recommend when you look back and think the old one is still in play, use the drawing tool to keep it on the chart.
Otherwise, let the script do the work for you.
Hope its helpful. Let me know what you think should be done to make it better.
Oversold RSI with Tight Stop-Loss Strategy (by Coinrule)KRAKEN:LINKUSD
This is one of the best strategies that can be used to get familiar with technical indicators and start to include them in your rules on Coinrule .
ENTRY
1. This trading system uses the RSI (Relative Strength Index) to anticipate good points to enter positions. RSI is a technical indicator frequently used in trading. It works by measuring the speed and change of price movements to determine whether a coin is oversold (indicating a good entry point) or overbought (indicating a point of exit/entry for a short position). The RSI oscillates between 0 and 100 and is traditionally considered overbought when over 70 and oversold when below 30.
2. To pick the right moment to buy, the strategy enters a trade when the RSI falls below 30 indicating the coin is oversold and primed for a trend reversal.
EXIT
The strategy then exits the position when the price appreciates 7% from the point of entry. The position also maintains a tight stop-loss and closes the position if the price depreciates 1% from the entry price. The idea behind this is to cut your losing trades fast and let your winners ride.
The best time frame for this strategy based on our back testing data is the daily. Shorter time frames can also work well on certain coins, however in our experience, the daily works best. Feel free to experiment with this script and test it on a variety of your coins! With our back testing data a trading fee of 0.1% is taken into account. The fee is aligned to the base fee applied on Binance, which is the largest cryptocurrency exchange by volume. In the example shown, this strategy made a handsome net profit of 52.6% on Chainlink with 66.67% of trades being profitable.
You can execute this strategy on your favorite exchanges with Coinrule .
[BA] ATR Stop LineThis indicator helps you to set your stoploss levels by using ATR. Traders often use atr values in order to calculate their stoploss levels.
This indicator does the calculation for you and draw two tiny lines without messing up the chart so that you can easily see your stoploss levels and get an idea about the volatility and risk amount as well.
One line is below the last candle as a long trade stop loss level and the other one is above the last candle as a short trade stop loss level.
Calculation is simple:
For short trades, 2 times ATR added to last price;
For long trades, 2 times ATR subtracted from last price.
You can change ATR length, ATR multiplier and the line length.
Good luck.
TradingGroundhog - Strategy & Fractal V1#-- Public Strategy - No Repaint - Fractals -- Short term
Here I come with another script, more simple than Wavetrend V1. You will love it.
#-- Synopsis --
Another simple idea, on a small time frame (15 min) we buy when the opening price goes below a Bottom fractals and sell when it goes over a Top fractals, but as this script do not use Wavetrends. You should stop by your self to use the script during long lasting downtrends.
I developed the strategy using BTC /EUR 3 MIN BINANCE but it can be applied to many other cryptos, I don't know for forex or others. You can use it for short term (to a month of uptrend) and automated trading.
#-- Graph reading --
And now, how to read it ?
Fractals:
Yellow Flags occur when the opening price goes below a Bottom fractal , it means Buy.
White Flags appear when the opening price goes over a Top fractal , it means Sell.
#-- Parameters --
*** Parameters have been intensively optimized using 10 cryptocurrency markets in order to have potent efficiency for each of them. I would recommend to only change the Can Be touch parameter. For the others, I don't recommend any modifications. The idea behind the script is to be able to switch between markets without having to optimize parameters, less work, easy to target active crypto and therefor limit the risks. ***
Can be touch :
'Filter fractals' : Activate or Disable the filtering fractal operation. If Enable, buy during less risky periods. (Activate is often better)
Can be touch but not necessary :
'VolumeMA' : The Volume corrector used by the fractals
'Extreme window' : The number of price individuals to look for if we want to remove extreme fractals.
Not to touch :
'Long Sop Loss (%)' : The minimal difference of price between a Fractal bottom and the opening price to buy.
#-- Time frame --
Should be used with the following time frames depending on the necessity:
1 MIN
3 MIN (Preferred with the parameters set)
5 MIN
#-- Last words --
The script can be set up to send Tradingview signals to 3comma just by adding comment = " " in strategy.close_all() and strategy.entry().
Good trades !
Disclaimer (As it should always be one to any script)
***
This script is intended for and only to be used for personal purposes only. No such information provided by it constitutes advice or a recommendation for any investment or trading strategy for any specific person. There is no guarantee presented or implied as to the accuracy of specific forecasts, projections, or predictive statements offered by the script. Users of the script agree that its original developer does not take responsibility for any of your investment decisions. Please seek professional advice before trading.
***
# Here are the results from the 20rst of September 2021 with 100% of equity on the BTC /EUR 3 Min and with a capital of 10 000 EUR. So almost, one month.
# As I saw, it goes from +30% to more than +160% (the great SHIB) depending on the selected crypto. It may be negative if you spot a downtrend.
TradingGroundhog - Strategy & Wavetrend V2#-- Public Strategy - No Repaint - Fractals - Wavetrend --
Here I come with another script, a nice and simple strategy based on fractals and Wavetrends.
#-- Synopsis --
A simple idea, on a small time frame (15 min) we buy when the opening price goes below a Bottom fractals and sell when it goes over a Top fractals, but in order to avoid bad and evil downtrends, we use Wavetrends based on a Daily time frame. From it, Tops and Bottoms are extracted. If the opening price goes above Wavetrend Tops, no trades will be conducted during the day. If the price goes below Wavetrend bottoms, no trades will be executed from 1 to N days, until a new Wavetrend bottom is generated.
I developed the strategy using BTC /EUR 15 MIN BINANCE but it can be applied to many other cryptos, I don't know for forex or others. You can use it for long term and automated trading, I implemented the Wavetrend indicator to do so, or for short term if you have spot a long coming uptrend. Test it, look at its profit and long or short period on your crypto of choice.
#-- Graph reading --
And now, how to read it ?
Wavetrends:
Red Backgrounds are associated to No Trade periods. These periods occur when the price goes below a Wavetrend bottom or above a Wavetrend Top. They are here to limit the loss.
Blue Gradient lines represent the past Tops. For each bar, only the increasing values of the Wavetrend tops are acquired. Going from light to dark blue based on the age of the Tops. Thus, if on line goes from dark to light, this means the price is approaching a previous Wavetrend top. In the opposite, if it darken, thus the price say 'buy buy' and go dropping.
Yellow Gradient lines represent the past Bottoms. They are based on the same principe that the blue lines.
Fractals:
Yellow Flags occur when the opening price goes below a Bottom fractal , it means Buy.
White Flags appear when the opening price goes over a Top fractal , it means Sell.
#-- Parameters --
*** Parameters have been intensively optimized using 10 cryptocurrency markets in order to have potent efficiency for each of them. I would recommend to only change the Can Be touch parameter. For the others, I don't recommend any modifications. The idea behind the script is to be able to switch between markets without having to optimize parameters, less work, easy to target active crypto and therefor limit the risks. ***
Can be touch :
'Combined Smoothness' : The number of open individuals used by the Wavetrend. (6 or 9, often 9 is better but with less volatile crypto it will be 6)
'Filter fractals' : Activate or Disable the filtering fractal operation. If Enable, buy during less risky periods. (Disable is often better)
Can be touch but not necessary :
'VolumeMA' : The Volume corrector used by the fractals
'Extreme window' : The number of price individuals to look for if we want to remove extreme fractals.
Not to touch :
'Limit_candle to look on' : Number of candles to use to compute the Wavetrend Tops and Bottoms.
'Length top bottom drawn' : Size of the lines
'Long Sop Loss (%)' : The minimal difference of price between a Fractal bottom and the opening price to buy.
#-- Time frame --
Should be used with the following time frames depending on the necessity:
1 MIN
3 MIN (Interesting for short term profit, may need some parameter ajustements)
5 MIN
15 MIN (Preferred for long term profit, the script was developed on it)
#-- Last words --
The script can be set up to send Tradingview signals to 3comma just by adding comment = " " in strategy.close_all() and strategy.entry().
Good trades !
Disclaimer (As it should always be one to any script)
***
This script is intended for and only to be used for personal purposes only. No such information provided by it constitutes advice or a recommendation for any investment or trading strategy for any specific person. There is no guarantee presented or implied as to the accuracy of specific forecasts, projections, or predictive statements offered by the script. Users of the script agree that its original developer does not take responsibility for any of your investment decisions. Please seek professional advice before trading.
***
# Here are the results from the 1rst of July 2021 with 100% of equity on the BTC /EUR 15 Min and with a capital of 1 000 EUR.
# As I saw, it goes from +20% to more than +100% depending on the selected crypto. Sometimes it's negative but it's quite rare on crypto using the EUR.
INDIGO - Cloud System ©INDIGO Cloud System ©
This script shows the monthly dip and peak zones and the daily highs & lows.
The green zone is the dip zone. It's the place to enter a long position if you think there is or will be a reversal.
The red zone is the peak zone. It's the place to enter a short position if you think there is or will be a reversal.
The script uses the INDIGO Cloud System ©, the Ultimate RSI and the Market Direction Indicator to find an entry at the most optimal point in space and time.
The exit for the long trade is on the purple line and the exit for the short trade is on the blue line.
It also has an RSI exit to minimize the risk of a sudden reversal in the wrong direction while in trade.
You can set TP and SL to see the effects of it on the chart. Be aware that these change a lot of trades so use it wisely.
The labels are connected to alerts to notify you of a possible entry or exit.
This script uses the Ultimate RSI by ChrisMoody, thanks for creating this Chris !
This script also uses the Market Direction Indicator by LazyBear, great script !
You can use the MD Filter to filter out some bad trades. It decreases losses but also some profits.
Experiment with the settings, each pairing needs different settings.
--> Use this script at your own risk. Do your own research, never invest money you're not willing to lose and never put your trust in one indicator !
To my best knowledge this script doesn't repaint. I never use the close and only use high/low when value can't be untrue again. If you find repainting in this script PLEASE let me know !
Feel free to contact me for questions or feedback.
Enjoy the script :)
Bjorgum AutoTrailOne Time Trade Risk Management
Incorporating the new interactive feature, this script is meant as a one time trailing stop for the active trader to manage positional risk of an ongoing trade. As a crypto trader or Fx trader, many may find themselves in a position late into the evening, or perhaps daily life is calling while a trade progresses in their favor. Adding a trailing stop to a position thats trending can help to keep you in the trade and lock in gains if things turn around when you are unable to react.
To use the trail, the user would add the script to the chart. Once added, a set of crosshairs will appear allowing the user to choose a point to begin. Often choosing to start a trail from a swing high/ low can be an ideal option. This tends to provide some protection for a stop by placing it under support for a long trade or above resistance for a short trade.
Price based trail
The trail will automatically plot and the offset is a factor of the distance from price action selected by the crosshairs. If placed above price action the script will plot a short trail, if placed below it will trail for a long position.
Additionally, there are several other trail types other than price based. There is also percent based, which offsets the trail as a percent from close. A hard stop is placed at the cross hair value, then once the distance is exceeded by the percentage specified, the trail begins.
There are 2 more volatility based trails. There is a PSAR trail which can provide quicker and tighter stops that accelerate with the trend locking in gains faster, and an ATR trail that keeps a distance from price action as a function of volatility. Volatility levels can be adjusted from the menu.
Volatility based trail (ATR)
Volatility based trail (PSAR)
Lastly, within the code for more the more technical savvy, is some starting setups for string alerts to be sent to exchanges via 3rd party or custom API applications. Some string manipulation is required for specific providers to meet their requirements, but there is some building block alerts that will take the ticker symbol, recognize the asset your trading (Fx, Crypto, etc) and take input quantity or exchange names from the settings via inputs.
Complex strings can be built to perform almost any trade related task when to comes to alerts via web hook. A little setup this way with some technology to back your system can mean a semi-automated half man, half machine setup that actually manages your trail stop while you cannot. For those that don’t go this far, there is some basic alert functionality that well trigger when a trail is hit so you can react and make a decision.
Please note that for now, interactive mode is engaged only when the script is added to the chart. Additional stops, or for adjustments to be made it is best to add a new version. Also as real trades could be at play managing an actual position, alerts are designed to go off only once to ensure no duplicate orders are sent meaning alerts are not reoccurring. Once an alert is triggered, a new trail is to be set up.
A modified version of the TradingView built in SAR equation was used in this script. To provide the value of the SAR on the stop candle, it was necessary to alter the equation to extract this value as the regular SAR “flips” at this point. Thank you to TradingView for supplying access to the built in formula so that this SAR could behave the same as the built-in function outside of these alterations
Example of SAR value maintained in trigger candle
Cheers and happy trading.
Average Highest High and Lowest Low Swinger StrategyThis is a full price action strategy designed for trending markets such as crypto and stocks.
Its purely made on calculations for the highest high and lowest low using 2 different length , a faster and a slower one.
With those we make multiple averages.
Rules for entry:
For long: our close of the candle is above both the average using fast and slow line
For short: our close of the candle is below both the average using fast and slow line
Rules for exit
We always exit when we have an opposite order
Caution
This strategy use no risk management system, so be careful with it
If you have any questions, let me know
Pivot Reversal Strategy + alerts via TradingConnector to indicesSoftware part of algotrading is simpler than you think. TradingView is a great place to do this actually. To present it, I'm publishing each of the default strategies you can find in Pinescript editor's "built-in" list with slight modification - I'm only adding 2 lines of code, which will trigger alerts, ready to be forwarded to your broker via TradingConnector and instantly executed there. Alerts added in this script: 14 and 22.
How it works:
1. TradingView alert fires.
2. TradingConnector catches it and forwards to MetaTrader4/5 you got from your broker.
3. Trade gets executed inside MetaTrader within 1 second of fired alert.
When configuring alert, make sure to select "alert() function calls only" in CreateAlert popup. One alert per ticker is required.
Adding stop-loss, take-profit, trailing-stop, break-even or executing pending orders is also possible. These topics have been covered in other example posts.
This routing works for Forex, indices, stocks, crypto - anything your broker offers via their MetaTrader4 or 5.
Disclaimer: This concept is presented for educational purposes only. Profitable results of trading this strategy are not guaranteed even if the backtest suggests so. By no means this post can be considered a trading advice. You trade at your own risk.
If you are thinking to execute this particular strategy, make sure to find the instrument, settings and timeframe which you like most. You can do this by your own research only.
Consecutive Up/Down Strat + alerts via TradingConnector to ForexSoftware part of algotrading is simpler than you think. TradingView is a great place to do this actually. To present it, I'm publishing each of the default strategies you can find in Pinescript editor's "built-in" list with slight modification - I'm only adding 2 lines of code, which will trigger alerts, ready to be forwarded to your broker via TradingConnector and instantly executed there. Alerts added in this script: 12 and 15.
How it works:
1. TradingView alert fires.
2. TradingConnector catches it and forwards to MetaTrader4/5 you got from your broker.
3. Trade gets executed inside MetaTrader within 1 second of fired alert.
When configuring alert, make sure to select "alert() function calls only" in CreateAlert popup. One alert per ticker is required.
Adding stop-loss, take-profit, trailing-stop, break-even or executing pending orders is also possible. These topics have been covered in other example posts.
This routing works for Forex, indices, stocks, crypto - anything your broker offers via their MetaTrader4 or 5.
Disclaimer: This concept is presented for educational purposes only. Profitable results of trading this strategy are not guaranteed even if the backtest suggests so. By no means this post can be considered a trading advice. You trade at your own risk.
If you are thinking to execute this particular strategy, make sure to find the instrument, settings and timeframe which you like most. You can do this by your own research only.
RSI Strategy with alerts via TradingConnector to ForexSoftware part of algotrading is simpler than you think. TradingView is a great place to do this actually. To present it, I'm publishing each of the default strategies you can find in Pinescript editor's "built-in" list with slight modification - I'm only adding 2 lines of code, which will trigger alerts, ready to be forwarded to your broker via TradingConnector and instantly executed there. Alerts added in this script: 12 and 17.
How it works:
1. TradingView alert fires.
2. TradingConnector catches it and forwards to MetaTrader4/5 you got from your broker.
3. Trade gets executed inside MetaTrader within 1 second of fired alert.
When configuring alert, make sure to select "alert() function calls only" in CreateAlert popup. One alert per ticker is required.
Adding stop-loss, take-profit, trailing-stop, break-even or executing pending orders is also possible. These topics have been covered in other example posts.
This routing works for Forex, indices, stocks, crypto - anything your broker offers via their MetaTrader4 or 5.
Disclaimer: This concept is presented for educational purposes only. Profitable results of trading this strategy are not guaranteed even if the backtest suggests so. By no means this post can be considered a trading advice. You trade at your own risk.
If you are thinking to execute this particular strategy, make sure to find the instrument, settings and timeframe which you like most. You can do this by your own research only.
FTB Strategy (Automated)Hey traders!
This is a profitable strategy script I created to teach my students how to automate their scripts using 3rd party APIs (more info available in my profile link at the bottom of this page).
What Is This?
This strategy is called the "Follow The Bear" strategy.
It's a forex trading strategy designed for one purpose and one purpose only: to take advantage of a recurring pattern on EURUSD's 1-Hour chart during the European market open.
The basic explanation is this:
During the European open we want to see a rally followed by a swing high shooting star / reversal pinbar candle. This typically means that traders buying EURUSD during the European/London open are now trapped long, and as price begins to retrace they are forced to sell, fueling a short-term retracement.
This strategy takes advantage of that pattern by aggressively selling short with a tight stop-loss above the pinbar candle and a conservative target.
There are many ways to trade this pattern, but this script represents my personal method for trading it.
It is not 100% accurate (no strategy is), but it does have a considerably high win rate over the past 6+ years considering its simplicity and I've been trading it for several months and can attest to its edge over the markets (at least through the Oanda data feed which is what I use).
The strategy rules are this:
Market: EURUSD
Timeframe: 1-Hour
Direction: Short Only
Timezone: 6AM-10AM GMT
Days: Tuesday, Wednesday, Thursday
Entry: Close of Pinbar Setup
Stop: 2 pips above signal candle
Target: 1:1
Risk: Up to you (backtest first! I use 1%)
The rule for the pinbar/shooting star candle pattern is that the candle must both open and close in the lower 50% of the bar's total size.
Automation
This script is already prepared to be auto-traded through a 3rd-party API that was created to relay TradingView alerts to your broker to execute and manage trades.
Sorry for the lack of information - due to TradingView's house rules I cannot go into any more detail here, but if you're interested in automating this script there is more info available in the resources offered under my profile link at the bottom of this page.
Disclaimer
The material and the resources offered here are for educational purposes only. Always do your own research and only execute trades based on your own personal judgement.
Trading foreign currencies can be a challenging and potentially profitable opportunity for investors. However, before deciding to participate in the forex market, you should carefully consider your investment objectives, level of experience, and risk appetite. Most importantly, do not invest money you cannot afford to lose.
There is considerable exposure to risk in any foreign exchange transaction. Any transaction involving currencies involves risks including, but not limited to, the potential for changing political and/or economic conditions that may substantially affect the price or liquidity of a currency, investments in foreign exchange speculation may also be susceptible to sharp rises and falls as the relevant market values fluctuate.
The leveraged nature of forex trading means that any market movement will have an equally proportional effect on your deposited funds. This may work against you as well as for you. Not only may investors get back less than they invested, but in the case of higher risk strategies, investors may lose the entirety of their investment. It is for this reason that when speculating in such markets it is advisable to use only risk capital.
Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. Past performance is not indicative of future results. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts.
3 Auto Fibonacci RetracementsThe Indicator displays 3 different Auto Fibonacci Retracements with top, bottom, the 0.618 and 0.382 levels.
Also it displays 3 Moving Averages with the same length as the AutoFibos.
If the MA over the 0.618 level it colors itself yellow, if between 0.618 ans 0.382 white and under 0.382 blue.
The green lines are the top of the AutoFibos, red lines the bottom, blue lines are resistance/supports and yellow lines are stronger resistance/supports.