Syntax Maker

With the release of the new JuBot Syntax Maker, you can have your ideal set of syntax generated for you with no coding knowledge required.

Required Syntax

Your TradingView alert message field must contain one of the following (only pick one!): ENTRY LONG , ENTRY SHORT , EXIT LONG , EXIT SHORT
JuBot automatically cancels all orders and closes all positions before any strategy entry/exit is made. This means it only requires 1 command line unlike Autoview.
This means an "ENTRY LONG" will do the following: cancel all orders for this symbol, cancel all positions for this symbol, place an order based on the settings given. Likewise an "EXIT SHORT" will do the following: cancel all orders for this symbol, cancel all positions for this symbol
ENTRY has 4 required fields: e, s, q, tf
EXIT has 3 required fields: e, s, tf

Syntax Explanation
e Name of exchange (e=bitfinex only please)
s Symbol of the coin being traded, eg bitcoin in Bitfinex is btcusd
q Quantity of currency being traded. If the quantity ends in '%' it will use a percentage of your current available currency balance to trade. If no '%' is present at the end, it will use a fixed number of currency as the trade size Eg if you set q=100 in a BTCUSD market, it will try to buy 100 USD worth of BTC. Eg, if you set q=50 in a EOSUSD market, it will try to buy 50 USD worth of EOS (Couple of things to note in terms of syntax: eg "BTCUSD" the instrument being traded is "BTC" and "USD" is the currency. Likewise, "TRXBTC", the instrument being traded is "TRX" and the currency being traded is "BTC". More examples: in "EOSBTC" the instrument is "EOS" and the currency is "BTC".)

EXIT alerts normally default to closing 100% of the open position. Setting a q=#% will mean that only a portion of the open position is closed. The quantity q must end with a '%' for EXIT alerts.
tf Timeframe, enter your timeframe in seconds, this enables the TradingView duplicate detection feature to work. (eg 3H = 10800) If not specified, the value "Default Timeframe" option in the Settings tab is used. For example if you have 4 strategies, 3 of them use 2H timeframe, and one of them uses 1H, then for the 1H strategy, set "tf=3600". The other 3 strategies will default to the "Default Timeframe" option in the Settings tab which is 7200 seconds or 2H.
When writing your syntax, please make sure that you have an actual space/gap between the commands, having a new line might not necessarily mean there was a proper " " space between the commands.
NOTE: The bot is set to ONLY TRADE ON MARGIN account. Hence both short and longs work, but make sure you have checked whether the coin you are using is available for margin trading. (eg TRXUSD is only available in Exchange and not in Margin) Also note that the leverage on Bitfinex is fixed at (10/3) or 3.333.... hence no leverage syntax is required

Easy Examples

  1. This will submit an ENTRY LONG that will long 500 USD worth of BTC at market price. This happens to be a 45M strategy.
    ENTRY LONG e=bitfinex s=btcusd q=500 tf=2700

  2. This will submit an ENTRY SHORT that will short 500 USD worth of BTC at market price. This happens to be a 1H strategy.
    EXIT LONG e=bitfinex s=btcusd q=500 tf=3600

  3. This will submit an EXIT LONG that will exit all positions in btcusd. This happens to be a 4H strategy.
    EXIT LONG e=bitfinex s=btcusd tf=14400

  4. This will submit an EXIT SHORT that will exit all positions in btcusd. This happens to be a 2H strategy.
    EXIT LONG e=bitfinex s=btcusd tf=7200

Optional Syntax

Syntax Explanation
a API account to use, default is set to "a=1" if you dont fill it in, this corresponds to the first set of api keys for the exchange
n Strategy name (optional)(mostly cosmetic but recommended)
p Price (if "p" is provided, the order is submitted as a limit order. If "p" is not provided, the order is submitted as a Market order)This price is set relative to the current BestPrice, ie the price closest to the other side of the orderbook. Hence if you wanted to put a limit order right at the edge of the orderbook, you would put p=0% (make sure you only enter POSITIVE NUMBERS and don't forget to add the % at the end)(eg "p=2%") (NOTE: Make sure price is POSITIVE, no negative prices) (Eg p=2% for an ENTRY LONG means the order will be placed at 2% lower than the current price) (Eg p=2% for an ENTRY SHORT means the order will be placed at 2% higher than the current price)
sl Stop loss (default is 0 ie disabled)(make sure you only enter POSITIVE NUMBERS and don't forget to add the % at the end)(eg "sl=2%") The stop loss order is made as "GoodTillCancel" (NOTE: Make sure stop loss is POSITIVE, no negative stop losses) Eg if you are in a short and you set sl=2%, a conditional market order will be placed and this might trigger, closing off your short if the mark price moves against you by 2% (ie 2% higher than your short entry price) Likewise if you are in a long and you set sl=2%, a conditional market order will be placed and this might trigger, closing off your long if the mark price moves against you by 2% (ie 2% lower than your long entry price)
ts Trailing stop order (default is 0 ie disabled)(make sure you only enter POSITIVE NUMBERS and don't forget to add the % at the end)(eg "ts=2%") The trailing stop order is made as "GoodTillCancel" (NOTE: Make sure stop loss is POSITIVE, no negative trailing stop losses)
tp Take profit (default is 0 ie disabled)(make sure you only enter POSITIVE NUMBERS and don't forget to add the % at the end)(eg "tp=2%"). Take note that this will mainly apply to market orders or orders that are filled instantly, any quantity that is left pending / unfilled will not be taken into account for the Take Profit order quantity. (NOTE: Make sure stop loss is POSITIVE, no negative take profits) Eg if you are in a long and you set tp=2%, a limit sell order will be placed at 2% higher than your executed long price

NOTE: Because there is no documented API methods provided by Bitfinex to post the order via REST as "ReduceOnly", it is recommended you only pick one type of stop loss (sl/ts), otherwise there is a chance that you might end up in a nett position that is opposite to your original order.
Note: For p, tp, sl syntax you can use ABSOLUTE values ie without the % at the end, take note that tp=5000 means a take profit order at a price of 5000 is placed, hence this is not relative to the current price.

More Examples

  1. This submits an ENTRY LONG on account 1, that will long 5000 USD worth of BTC using a limit order with the price equalling the current BestPrice/BestBid, also putting down a take profit of 2% (ie a limit sell order set at 2% higher than the long entry price). This happens to be a 2H strategy.
    ENTRY LONG a=1 n=CU2H e=bitfinex s=btcusd q=5000 p=0% tf=7200 tp=2%

  2. This submits an ENTRY SHORT on account 2, that will short 0.2 BTC worth of ETH using a limit order with the price 1% higher than the current BestPrice/BestAsk, also putting down a stop loss of 2% (this triggers a market buy to close the short position if the market moves against you by 2%, ie 2% higher than your short entry price). This happens to be a 1H strategy.
    ENTRY SHORT a=2 n=MR e=bitfinex s=ethbtc q=0.2 p=1% tf=3600 sl=2%

  3. This submits an EXIT LONG on account 1 to cancel all positions in BTCUSD, by placing a limit order with price set at 2% higher than the current BestPrice/BestAsk. This happens to be a 2H strategy.
    EXIT LONG a=1 n=CU2H e=bitfinex s=btcusd p=2% tf=7200

  4. This submits an EXIT SHORT on account 2 to cancel all positions in ETHBTC, by placing a limit order with price equalling the current BestPrice/BestBid. This happens to be a 1H strategy.
    EXIT SHORT a=2 n=MR e=bitfinex s=ethbtc p=0% tf=3600

Advanced Syntax

In addition to the standard 4 alerts of ENTRY LONG, ENTRY SHORT, EXIT LONG, EXIT SHORT, you can also use the following:
EXIT ALL = same effect as EXIT LONG or EXIT SHORT, but is given purely for users that want this option for visual purposes etc
Syntax Explanation
tpq Take profit quantity, ie partial take profit (default is 100% ie the take profit quantity equals the original main order quantity)(Don't forget to add the % at the end)(eg "tpq=50%") Eg if your main order submitted a long/short quantity of 5000 and you set tpq=50%, it will place the take profit quantity as 2500 ie half of the original order
cos Cancel one side (default is 0 which means that all sides (both long & short) of orders and positions will be cancelled whenever an alert is triggered)(setting "cos=1" means that only one side will be cancelled whenever an alert is triggered). This allows for multiple pyramiding orders to be done in a row.

With cos=1:
"ENTRY LONG" = cancel short/sell orders, cancel short positions, place an order based on the settings given
"ENTRY SHORT" = cancel long/buy orders, cancel long positions, place an order based on the settings given
"EXIT LONG" = cancel long/buy orders, cancel long positions
"EXIT SHORT" = cancel short/sell orders, cancel short positions
sco Skip cancelling order during the Trade, (default is 0)

Usual flow of an ENTRY order:
Cancel Order (sco=1 will skip this step)
Cancel Position
Main Entry Order
scp Skip cancelling positions during the Trade, (default is 0) - If you plan to use this to do dual orders/pyramiding orders etc, make sure the very first ENTRY does NOT have scp

Usual flow of an ENTRY order:
Cancel Order
Cancel Position (scp=1 will skip this step)
Main Entry Order

Additional options to regular syntax:
Syntax Explanation
a If you want to clone/duplicate the alert onto multiple accounts , just put a comma, eg a=1,2,3,4,5 (make sure there is no space after the comma). This will clone exactly the action onto multiple accounts. Hence one single ENTRY LONG can affect many accounts if you wish. Alternatively, if you want to act on ALL given API keys, use a=all
p If you want to use ladder multiple entry orders, just put a comma, eg. p=m,0%,2.5% (make sure there is no space after the comma, p=m means the first order will be a market order). When laddering entry orders, the order quantity % or q=#% is shared equally across the total number of price levels provided. Eg "p=1%,2%,3% q=300" means that each price level would have 100 contracts/quantities assigned to it.
tp If you want to use multiple take profit syntax, just put a comma, eg. tp=1.5%,2.5%,4% (make sure there is no space after the comma). When using multiple take profit syntaxes, the take profit quantity % or tpq=#% is shared equally across the total number of TPs provided. Eg "tp=1%,2%,3% tpq=60%" means that each take profit will take 20% of the original main order as its individual quantity, such that 20%+20%+20% = 60%. If all take profit targets are hit, this leaves a remainder 40% of the main order that is left running with profit.

Things To Note:
  • Laddering orders:
    Since the order quantity is divided equally across the number of price levels given, you will have to modify your syntax if you want unequal sized order quantities: For example if you want to make 3 orders at price levels p=0%,2.5%,5% but want to set their quantity to be 100 contracts, 150 contracts and 200 contracts respectively; you'll have to use sort of a workaround by find the highest common factor (50 in this example), use this if u wish https://www.calculatorsoup.com/calculators/math/gcf.php

    First price needs to have (100/50) = 2 orders
    Second price needs to have (150/50) = 3 orders
    Third price needs to have (200/50) = 4 orders

    Hence:
    p=0%,0%,2.5%,2.5%,2.5%,5%,5%,5%,5%
    (Note this also applies to tp syntax)