Welcome to the core of Autoview automation: constructing commands. Autoview acts as the crucial link between your trading signals from platforms like TradingView, Trendspider, or custom scripts and the execution on your chosen brokerage or exchange account. Understanding how to build precise commands is essential for translating your strategy's logic into actionable trades.
Every alert sent to Autoview contains one or more commands that tell it exactly what action to take on your connected exchange account.
The Basic Structure
At its simplest, a command consists of a series of parameters, each defining a specific aspect of the order or action you want to perform. For example, to open a position or place an order, you need to specify the instrument (s), the action (b for buy/sell, or implicit in other parameters), and typically the quantity (q) or price (p). Other parameters refine the order type, add stop losses, take profits, and more.
Usage Rules
To ensure Autoview correctly interprets your instructions, follow these fundamental rules:
- Single Order per Command: Every command that Autoview processes is treated as a single order or action (like cancelling orders).
- Multiple Commands per Alert: You can include multiple commands within a single alert message.
- Separators: Each command within an alert must be separated by a new line or the pipe character (|).
- Unique Parameters: Generally, every parameter can only be used once per command.
- Value Types: Most parameters support static numerical values (e.g.,
q=10
), percentages (e.g.,q=10%
), and ranges for randomisation (e.g.,delay=1-9
). - Combined Orders: Specific order types like Take Profit (tp), Stop Loss (sl), and Trailing Stop (ts) can be added to a primary command using an ampersand (&) separator. This allows you to define multiple related orders without duplicating the main command's parameters.
- Exchange Errors: Be aware that the majority (95%) of errors encountered when using Autoview originate from the exchange itself, not Autoview. Consulting your exchange's documentation is often necessary during testing and debugging.
Key Parameters Explained
Here are explanations of some common and important parameters you'll use to build your commands, designed to be generally applicable across integrated exchanges:
- Symbol (s)
- Description: Specifies the trading instrument or pair for the command (e.g., EUR/USD, BTC/USD)
- Example:
- Buy 100 contracts
-
s=symbol b=buy q=100
- Book (b)
- Description: Specifies the order book side (buy/long or sell/short) for certain actions or orders
- Examples::
- Open a limit long at the current highest buy price for 100% of your balance
-
s=symbol b=long
- Open a limit short at the current lowest sell price for 100% of your balance
-
s=symbol b=short
- Quantity (q)
- Description: Defines the size of the order or position. Can be a static number, percentage, or a range. You need to use a quantity that is at or above the exchange's minimum allowed trade size to avoid errors like MIN_NOTIONAL.
- Examples:
- Open a buy for 0.001 Bitcoin
-
s=symbol b=buy q=0.001
- Open a sell for a random value between 5 and 10 of your available Bitcoin
-
s=symbol b=sell q=5%-10%
- Price (p)
- Description: Calculates the price for limit orders. Can be a static number, percentage, or a range.
- Examples:
- Limit Buy 1.095 below current price
-
s=symbol b=buy p=-1.095
- Limit Sell 5% above current price
-
s=symbol b=buy p=-5%
- Cancel / Close (c)
- Description: Used to cancel open orders with c=order or close existing positions with c=position
- Examples:
- Cancel all open orders on this pair
-
s=symbol c=order
- Close all open positions on this pair
-
s=symbol c=position
- Cancel/Close Maximum (cm)
- Description: Specifies how many orders should be affected by a cancel command.
- Examples:
- Cancel 2 orders for EUR/USD
-
s=symbol c=order cm=2
- Delay (delay)
- Description: Pauses the execution of the command in an alert message for a specified number of seconds. Can be a static value or a range.
- Examples:
- Wait 5 seconds before placing the buy order
-
delay=5 s=symbol b=buy q=1
- Wait a random time between 2 and 7 seconds before closing the position
-
delay=2-7 s=symbol c=position
- Delay 5 seconds
-
delay=5
- Disabled (d)
- Description: Disables live action for a command, effectively performing a "dry run" or simulation. This is invaluable for testing your command syntax without risking real capital. When d=1 is included, Autoview will process the command and show you what it would have done in the logs, but it will not send the order to the exchange.
- Example:
- (Process this command but do not send the order to the exchange)
-
s=symbol b=short d=1
- Take Profit (tp)
- Description: Specifies a target to trigger and automatically close a profitable position. Used with the & separator. Can be a static number, percentage, or a range.
- Example:
- Buy BTC and set a take profit 10% above the entry price
-
s=symbol b=buy q=1 & tp=10%
- Stop Loss (sl)
- Description: Specifies a target to trigger and automatically close a losing position. Used with the & separator. Can be a static number, percentage, or a range.
- Example:
- Buy BTC and set a stop loss 5% below the entry price
-
s=symbol b=buy q=1 & sl=5%
- Trailing Stop (ts)
- Description: Specifies a distance for a stop order that trails the market price as it moves favourably, locking in profits while limiting losses. Used with the & separator". Can be a static number, percentage, or a range.
- Example:
- Buy BTC and set a trailing stop 1% below the current price, which will trail upwards if the price rises
-
s=symbol b=buy q=1 & ts=1%
- Reduce Only (ro)
- Description: Ensures that an order will only decrease the size of an existing position, not increase it or open a new one. Often used for take profit or stop loss orders.
- Example:
- Sell 50% of the position only if a long position exists
-
s=symbol b=sell q=50% ro=1
- Exchange (e)
- Description: (Primarily for Chrome Extension) Specifies which connected exchange account the command should be sent to. You may need to name your API keys if using multiple accounts.
- Example:
-
e=exchange s=symbol b=buy q=0.01
- Account (a)
- Description: Specifies which connected exchange account (by the name you gave the API keys) the command should be sent to.
- Example:
-
a=apiname s=symbol b=buy q=0.01
(Please note that this is not an exhaustive list of all parameters. A comprehensive Command Reference is available for all supported parameters and their specific usage per exchange).
Combining Parameters and Advanced Orders
Commands become powerful when you combine multiple parameters to define complex orders or sequences of actions. As mentioned in the rules, related orders like Take Profit, Stop Loss, and Trailing Stop are often added to the primary entry command using the ampersand (&).
Example of Combining Parameters:
- Open a new long stop market order 1% below the current price. Add a take profit 2.3 points away and a trailing stop of 1%.
- Syntax would look like:
s=symbol b=buy p=-1%--2% & tp=2.3 ts=1%
- Note: The
p=-1%--2%
range andtpv=points
parameter are specific examples from a source, illustrating how parameters can have different value types or sub-parameters.
- Syntax would look like:
- Open an order at market price with take profit, stop loss, and trailing stop attached.
- Syntax would look like:
s=symbol b=buy q=1 & tp=1.1 sl=1.09 ts=50
(Example based on parameter function, specific parameter names/values may vary by exchange)
- Syntax would look like:
- Add TP, SL, and TS to an existing long position.
- Syntax would look like:
s=symbol b=long & tp=1.1 sl=1.09 ts=50
(Example based on parameter function, specific parameter names/values may vary by exchange)
- Syntax would look like:
Autoview also supports more complex order types like One-Cancels-the-Other (OCO) and One Sends the Other (OSO), allowing for sophisticated strategy implementation. These often involve combining parameters in specific sequences or using dedicated OCO/OSO parameters.
Testing Your Commands
Before deploying commands with live capital, thorough testing is crucial.
- Use the d=1 Parameter: As highlighted earlier, the
d=1
parameter is your primary tool for verifying command syntax. Included=1
in your alert message. Autoview will process the command and log what it would have done without sending anything to the exchange. Review the Autoview logs to check for any syntax errors or unexpected behaviour. - Small Live Trades: Once your syntax is verified with
d=1
perform small test commands on your live account using a minimal quantity that meets your exchange's minimum trade size. This confirms the end-to-end connection and order execution process. Test placing and cancelling a simple order first.
Next Steps
You are now familiar with the basics of building Autoview commands, including key parameters and testing methods. To fully leverage Autoview's capabilities, explore the comprehensive Command Reference which provides details on all supported parameters and specific examples for your chosen exchange. This will guide you in implementing advanced strategies and risk management features.
Comments
0 comments
Please sign in to leave a comment.