Syntax Maker

With the release of the new JuBot Syntax Maker, you can have your ideal set of syntax conveniently generated for you.

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 most of the time.
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 5 required fields: e, s, q, l, tf
EXIT has 3 required fields: e, s, tf

Syntax Explanation
e Name of exchange (e=bitmex only please)
s Symbol of the coin being traded, eg bitcoin in Bitmex is xbtusd
q Quantity being traded. If the quantity ends in '%' it will use a percentage of your current available margin balance to trade. If no '%' is present at the end, it will use a fixed number of contracts as the trade size

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.
l Leverage (in case you're wondering, it is the lowercase letter "L") (NOTE: Cross leverage will be l=0) Also, you can put l=N/A if you want the bot to skip checking for and updating leverage, eg if u constantly use a fixed leverage this will save u some time in the order execution
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.

Easy Examples

  1. This will submit an ENTRY LONG that will use 100% of your current available balance to buy XBTUSD long contracts (at market price) with a leverage of 3. This happens to be a 15M strategy.
    ENTRY LONG e=bitmex s=xbtusd q=100% l=3 tf=900

  2. This will submit an ENTRY SHORT that will use 100% of your current available balance to buy XBTUSD short contracts (at market price) with a leverage of 3. This happens to be a 1H strategy.
    ENTRY SHORT e=bitmex s=xbtusd q=100% l=3 tf=3600

  3. This will submit an EXIT LONG that will exit all positions in xbtusd. This happens to be a 2H strategy.
    EXIT LONG e=bitmex s=xbtusd tf=7200

  4. This will submit an EXIT SHORT that will exit all positions in ethusd. This happens to be a 5M strategy.
    EXIT SHORT e=bitmex s=ethusd tf=300

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%. All limit orders are submitted as PostOnly by default, with 5 automated PostOnly order retries to avoid fees.

NOTE: Make sure price is POSITIVE, no negative prices. If you do not add the % at the end, it will be treated as an order with an ABSOLUTE value, eg p=3500 means it will place an order at a price of 3500
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" and "ReduceOnly". (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 LastPrice 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 LastPrice 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" and "ReduceOnly". (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%") The take profit order is made as "GoodTillCancel" and "ReduceOnly". (NOTE: Make sure stop loss is POSITIVE, no negative stop losses) Eg if you are in a short and you set tp=2%, a conditional market order will be placed and this might trigger, closing off your short if the LastPrice moves in your favour by 2% (ie 2% lower than your short entry price) Likewise if you are in a long and you set tp=2%, a conditional market order will be placed and this might trigger, closing off your long if the LastPrice moves in your favour by 2% (ie 2% higher than your long entry price)
fp Fiat protection on exit, aka shorting your full account balance using XBTUSD at leverage 1 when an EXIT type alert is given. Set fp=1 to enable it, or fp=0 to disable it. If you're using this syntax make sure you have it set for your ENTRY alert as well, ESPECIALLY if you are trading another instrument other than XBTUSD. This syntax takes priority over the setting provided in the Settings tab. For more info view the Bitmex downloads channel on Discord

More Examples

  1. This submits an ENTRY LONG on account 1, to buy the maximum number of long contracts possible on XBTUSD, with a leverage of 5, also putting down a stop loss of 5.5% relative to the order price, placing down a 2% trailing stop loss, placing down a conditional market sell that triggers if market moves in your favour by 4%. This happens to be a 2H strategy
    ENTRY LONG a=1 n=CU2H e=bitmex s=xbtusd q=100% l=5 sl=5.5% ts=2% tp=4% tf=7200

  2. This submits an ENTRY SHORT on account 2, to buy 500 short contracts on ETHUSD with a leverage of 5 (meaning that the final order size is 500 contracts but the margin you used for this would be the equivalent of 5x less), also putting down a stop loss of 4% relative to the order price, placing down a 2% trailing stop loss, placing down a conditional market sell that triggers if market moves in your favour by 3%. This happens to be a 3H strategy
    ENTRY SHORT a=2 n=mystrat e=bitmex s=ethusd q=500 l=5 sl=4% ts=2% tp=3% tf=10800

  3. This submits an EXIT LONG on account 1 to cancel all positions in XBTUSD, using a limit order at the BestPrice. This happens to be a 2H strategy.
    EXIT LONG a=1 n=CU2H e=bitmex s=xbtusd p=0% tf=7200

  4. This submits an EXIT SHORT on account 2 to cancel all positions in ETHUSD, using a limit order 1% lower than the BestBid. This happens to be a 3H strategy.
    EXIT SHORT a=2 n=mystrat e=bitmex s=ethusd p=1% tf=10800

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
UPDATE = (Bitmex only) what this does is it cancel all orders, and place TP/SL/TS onto the account based on the existing open position. eg "UPDATE e=bitmex s=xbtusd tp=5% tpq=60% sl=2% ts=3%
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)
  • Laddering orders (2):
    For take profit orders you can also add multiple tpq values

    Example: tp=1%,2%,3% tpq=50%,30%,20% would mean that 3 take profit orders are placed, with the first take profit order having 50%, the second one 30%, and the third one 20% of the total quantity .

    The requirements for it are :

    • Rule 1: If more than 1 tpq values are provided, the number of tpq provided must match exactly the number of tp orders
    • Rule 2: Each value provided MUST end in "%"
    • Rule 3: The sum of all provided tpq values must not exceed 100%
  • Stop type orders (sl/ts/tp):
    In terms of the price referenced:
    - If there is an open position, the AveragePrice of the position is used as the reference price
    - If there is no open position, the first order is used, eg p=1%,2%,3% means that the price at 1% is used as the price reference in this laddered order example. If it's just a simple 1 order like p=2%, then that single price is used as the reference price

    In terms of the quantity referenced:
    - If there is a (resulting) open position, the quantity of the open position PLUS the new pending orders (if any) are used as the reference quantity
    - If there is no open position, the quantities from the new order are used as the reference quantity