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
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 LONG" will do the following: cancel all orders for this symbol, cancel all positions for this symbolENTRY has 4 required fields: e, s, q, tf
EXIT has 3 required fields: e, s, tf
Syntax | Explanation |
---|---|
e | Name of exchange (e=binance only please) |
s | Symbol of the coin being traded, eg bitcoin in Binance is btcusdt |
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 ETHBTC market,
it will try to use 100% of your available BTC to purchase ETH. Eg. if
you set q=0.1 in a TRXBTC market, it will try to buy 0.1 BTC worth of
TRX. Eg. if you set q=50 in a EOSUSDT market, it will try to buy 50
USDT worth of EOS. (Couple of things to note in terms of syntax: eg
"BTCUSDT" the instrument being traded is "BTC" and "USDT" 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.
Easy Examples
-
This submits an ENTRY LONG to buy 100 Tether worth of BTC using a market
order. This happens to be a 15M strategy.
ENTRY LONG e=binance s=btcusdt q=100 tf=900
-
This submits an EXIT LONG to sell all available BTC for Tether using a
market order. This happens to be a 30M strategy.
EXIT LONG e=binance s=btcusdt tf=1800
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) |
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%") 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. The stop loss order is made as "GoodTillCancel". Because Binance only has "Stop-Limit" and does not have a proper "market order stop loss", I've set the maximum slippage price to 20% from your stop loss trigger price. eg if BTCUSDT is $5000 and you have an long order with "sl=10%", a limit sell order will trigger if BTC falls below $4500 (and the price of this limit sell order will be set at $3600) (NOTE: Make sure stop loss is POSITIVE, no negative 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: 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
-
This submits an ENTRY LONG to buy 0.1 BTC worth of TRX using a limit order
with price set at 1% lower than the current BestPrice/BestBid. This one
happens to be a 2H strategy.
ENTRY LONG a=1 n=JAWS e=binance s=trxbtc q=0.1 p=1% tf=7200
-
This submits an EXIT LONG to sell all available TRX for BTC using a limit
order with price set at 1% higher than the current BestPrice/BestAsk. This
one happens to be a 2H strategy.
EXIT LONG a=1 n=JAWS e=binance s=trxbtc p=1% tf=7200
-
This submits an ENTRY LONG on account 2 to buy 0.2 BTC worth of ADA using
a market order. This also places down a stop loss that triggers if the
current price drops 5% below your long entry price (the stop loss is
placed as a "Stop Limit" order with a maximum slippage of 20% relative to
the stop loss trigger price, which in effect triggers instantly in most
cases hence acting as a market order stop loss). This also places down a
take profit limit order set at 3% higher. This one happens to be a 1H
strategy
Detailed price example using the syntax: Let's say current ADABTC price is 1000 sats. Your market long order manages to buy 0.2 BTC worth of ADA which in this instance is 20000 ADA (ignoring fees in this example) at a price of 1000 sats each. The stop loss trigger price is set at 950 sats, which means that if the LastPrice of ADABTC drops below 950 sats, a limit sell order will be placed at 760 sats. Assume the LastPrice drops to 949 sats, and the highest bidder/BestBid is 948 sats. Because the sell limit order of 760 sats is below the BestBid of 948 sats in this instance, this limit order is executed instantly (at 948 sats) as there is enough bid volume in the orderbook to fulfill itENTRY LONG a=2 n=mystrategy e=binance s=adabtc q=0.2 sl=5% tf=3600
-
This submits an EXIT LONG on account 2 to sell all available ADA for BTC
using a market order. This one happens to be a 1H strategy.
EXIT LONG a=2 n=mystrategy e=binance s=adabtc tf=3600
Advanced Syntax
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 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 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%