Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 53 online users. » 0 Member(s) | 50 Guest(s) Bing, Google, Yandex
|
Latest Threads |
Installation
Forum: Getting Started
Last Post: admin
04-20-2023, 08:00 AM
» Replies: 22
» Views: 19,371
|
Strategy allocation with ...
Forum: General Discussion
Last Post: admin
12-24-2022, 12:28 AM
» Replies: 1
» Views: 1,954
|
Adding color to the Portf...
Forum: General Discussion
Last Post: anis
12-20-2022, 02:57 AM
» Replies: 0
» Views: 1,215
|
Stock Signals
Forum: Documentation
Last Post: ds_13
08-08-2022, 01:25 AM
» Replies: 12
» Views: 22,999
|
Troubleshooting and Known...
Forum: Bugs and Problems
Last Post: admin
05-22-2022, 10:38 AM
» Replies: 12
» Views: 14,686
|
Scaling Factor
Forum: General Discussion
Last Post: admin
05-22-2022, 10:36 AM
» Replies: 3
» Views: 3,762
|
Support allocation method...
Forum: General Discussion
Last Post: Marcel
04-21-2022, 04:05 PM
» Replies: 3
» Views: 5,218
|
Check Out our YouTube Cha...
Forum: News
Last Post: MarkeyMark101
04-11-2022, 08:13 AM
» Replies: 1
» Views: 12,958
|
Time stop
Forum: Feature Requests
Last Post: Marcel
03-30-2022, 10:30 AM
» Replies: 2
» Views: 2,631
|
Rounding Shares
Forum: Feature Requests
Last Post: admin
03-21-2022, 06:28 PM
» Replies: 6
» Views: 5,445
|
|
|
Stock Signals |
Posted by: admin - 09-11-2018, 07:03 PM - Forum: Documentation
- Replies (12)
|
|
What are Signals?
Signals are used to create orders in the market and are sent by what we call Signal Providers (SPs). There are various types of signals that are tailored for specific purposes in order to allow customization of signals and prevent errors on the side of the SP and the user. This guide presents all the types of signals, how they are processed, and how to create them.
Further reading: Conditional Signals and Delayed Signals
Actions
The action specifies the purpose of the order and ensures that the current position can be properly changed by the order. Note that if the signal is not ignored as result of the action (see below for when a signal is ignored), then the signal will replace any existing order.
Buy To Open (BTO) - Signal to open a long position (i.e positive number of shares)
- If the current position is not neutral, this signal will be ignored
Sell To Open (STO)- Signal to open a short position (i.e negative number of shares)
- If the current position is not neutral, this signal will be ignored
Close (CLOSE)- Signal to entirely close a position, regardless of whether it is short or long
- If the current position is neutral, it will cancel any existing orders
Sell To Close (STC)- Signal to entirely close a long position
- If the current position is not long, this signal will be ignored
Buy To Close (BTC)- Signal to entirely close a short position
- If the current position is not short, this signal will be ignored
Long (LONG)- Signal to make the current position long
- This will work even if the current position is short
Short (SHORT)
- Signal to make the current position short
- This will work even if the current position is long
Add to Long (ATL)
- Signal to increase the current long position
- If the current position is not long, this signal will be ignored
- Requires a signal ID to be processed
Add to Short (ATS)
- Signal to increase the current short position (i.e. go more short)
- If the current position is not short, this signal will be ignored
- Requires a signal ID to be processed
Subtract from Long (SFL)
- Signal to decrease the current long position
- If the current position is not long, this signal will be ignored
- Requires a signal ID to be processed
Subtract from Short (SFS)
- Signal to decrease the current short position (i.e. go less short)
- If the current position is not short, this signal will be ignored
- Requires a signal ID to be processed
Quantity and Units
The quantity is used to specify how much of a stock is bought. When a quantity is specified, the unit must also be specified. Note that when using CLOSE, STC, and BTC actions, you do not need to specify a quantity because those actions will close your entire position regardless.
Shares (SHARES)
- Specifies the number of shares to buy
Dollars ($)
- Specifies the total dollar value to be bought
Percent Portfolio (%PORTFOLIO)
- Specifies that the total dollar value bought should be a percent of the portfolio/strategy allocation
Percent Position (%POSITION)
- Specifies that the total dollar value bought should be a percent of the current position (this means if the current position is neutral, then the signal is ignored)
Percent Cash (%CASH)
- Specifies that the total dollar value bought should be a percent of the current cash available to the strategy
- Available cash is calculated as: strategy allocation - total exposure, where total exposure = (long exposure + short exposure)
- Note that whatever asset you are purchasing will not be included in the total exposure calculation
- For example, if strategy allocation is $10,000 and you are long $1,000 of AAPL, short $500 of IBM, and long $500 of SPY, then the signal
would see that total exposure is $1,500 (AAPL and IBM), so available cash is $10,000-$1,500 = $8,500. Therefore, we want to hold $8,500/2 = $4,250 of SPY, which means we need to BUY $3750 of SPY (since we already have $500)
- This unit type may be confusing to understand at first, but it will make more sense as you read the rest of the documentation.
Percent Account Cash (%ACCTCASH)
- Specifies that the total dollar value bought should be a percent of the current cash available to ALL your strategies
- Available cash is calculated as: total allocation among all strategies - total account exposure, where total exposure = (long exposure + short exposure)
- Note that whatever asset you are purchasing will not be included in the total exposure calculation
- For example, if Strategy1 and Strategy2 each have allocation $10,000, and you are long $1,000 of AAPL, short $500 of IBM, and long $500 of SPY, then the signal
would see that total exposure is $1,500 (AAPL and IBM), so available cash is 2x$10,000-$1,500 = $18,500. Therefore, we want to hold $18,500/2 = $9,250 of SPY, which means we need to BUY $8750 of SPY (since we already have $500)
Custom Lots (LOTS)
- Specifies that the unit to be used is whatever the user specified in the Custom Lot Size field in the strategy window.
- Note that the Custom Lot Size field is limited to the Shares and Dollars as units.
Order Type
The order type is used to specify what kind of order is used to enter the market.
Note that some order types (such as MOO) might be automatically cancelled in PAPER trading accounts on Interactive Brokers, but will work correctly in LIVE accounts. You may want to use MKT orders for paper trading and then switch to MOO on your live account if you're having issues.
Market (MKT)
- An order which will be executed at the current market price
Market on Close (MOC)
- A market order that will be placed when the market closes
- Note that these orders must be placed before 3:45pm EST, so your strategies must run before then
- The advantage of these kinds of orders is that there is no spread (difference between bid and ask price) when the market closes
Market on Open (MOO)
- A market order that will be placed when the market opens
- Similar to MOC orders
- Note that in Interactive Brokers these orders will appear as MKT orders with a Time in Force of OPG
Limit (LMT)
Limit on Close (LOC)
- A limit order that will be placed when the market closes
- Similar to the Market on Close order, this type of order must be placed before 3:45PM EST on most US exchanges
Limit on Open (LOO)
- A limit order that will be placed when the market open
- Similar to the Market on Open order, this type of order must be placed before 9:28AM EST on most US exchanges
Stop Market (STPMKT)
Stop Limit (STPLMT)
Limit If Touched (LIT)
Time in Force
The time in force specifies how long an order will stay in the market.
Day (DAY) - Day orders stay in the market until it closes. If they are not executed, then they are automatically removed.
Good 'Til Cancelled (GTC) - GTC orders stay in the market until they are executed or cancelled.
Good 'Til Date (GTD) - GTD orders stay in the market until the specified time. Format should be YYYYMMdd hh:mm:ss zzz where zzz is the timezone e.g. 20200108 15:30:00 EST
Immediate or Cancel (IOC) - IOC orders will be cancelled if they are not immediately filled when they hit the market.
*NOTE* In order to get London time, you should use GMT as the timezone. In APM we include daylight savings time in GMT in order to give users a way to specify London time. If you don't want the adjusted time, you should use UTC as the timezone.
It is recommended to use DAY or GTD orders because there is no fee if they are not executed and automatically cancelled (whereas there is a cancellation fee for GTC orders).
Reference Market Price
When submitting market orders to APM there will be cases where APM needs the market price in order to compute order quantity. In these cases, APM will try to get the market price from the broker if possible, otherwise it will try to get the data from the data provider specified in your account settings (e.g. Yahoo). Sometimes the data provider may be down, and in those cases APM will not be able to compute order quantity, and therefore not be able to place certain types of market orders.
If you have a data provider, whose prices you'd prefer to use when placing orders, then you can specify the reference price you'd like to use in your signal instead of having APM look for that price itself. Note that if you're running a system where signals are processed in APM several hours after they are generated, then this reference price may not be practical because the price may not be accurate -- keep in mind however that the price does not need to be perfectly accurate since it is only used for computing quantity and some other non-critical values.
To specify a reference price you can add REF_PRICE <price> to the end of your signal. For example
LONG AAPL REF_PRICE 120.25
Signal ID
A signal ID is a positive integer that allows APM to identify duplicate orders and prevent them from causing potential issues. Most of the actions do not have issues with placing duplicate orders, so signal IDs are not required (although they are allowed) for these actions. However, some of the actions, namely ATL, SFL, ATS, and SFS, do not naturally prevent duplicate orders, so they require signal IDs.
The first signal ID can begin at 1 (not 0), and every ID after must be greater than the last. To reset signal IDs back to 1, the next signal ID must be 1 AND smaller than the last signal ID by at least 10,000 (this will ignore the normal rule for signal IDs).
Note that when no signal ID is specified, orders with the actions BTO, STO, CLOSE, STC, BTC, LONG, and SHORT will be placed even if other signals do have IDs.
Signal Structure
Signals must follow the format below in order for them to be processed correctly:
[Action] [Ticker] [Quantity Units] [Type Price] [Time in Force] [ID]
The Action is one of BTO, STO, CLOSE, STC, BTC, LONG, SHORT, ATL, ATS, SFL, SFS
The Ticker must be of a valid US stock, for example AAPL.
The Quantity must be a positive real number followed by one of the Units: $, SHARES, %PORTFOLIO, %POSITION, LOTS
The Type is one of MKT, MOC, MOO, LMT, LOC, LOO, STPLMT. The types LOC, LOO, LMT must be followed by a price. And STPLMT must be followed by two prices (the stop and limit)
The Time in Force is one of GTC and DAY.
The ID is of the form 'ID <number>' and specifies the signal ID.
Here are some example signals:
BTO AAPL
STO AAPL 100 SHARES DAY
LONG AAPL 1000 $
CLOSE AAPL
CLOSE AAPL LMT 230 GTC
LONG AAPL 10 %PORTFOLIO MKT
ATL AAPL 50 %POSITION LMT 200 DAY ID 20
ATL AAPL ID 30
LONG AAPL STPLMT 400 401 DAY
LONG AAPL LIT 200 195 DAY
LONG AAPL LMT 200 GTD 20200108 15:30:00 EST
The only mandatory fields are the Action and Ticker.
If the Quantity and Units are not specified, the system will use the user defined Custom Lot Size to determine the number of shares to trade.
This happens in the signals BTO AAPL and ATL AAPL ID 30.
Closing All Positions
You can send the following signal to place a CLOSE order for all symbols in your strategy.
Creating and Processing Signals
File
A file with one signal per line can be processed by the 'Local File' Signal Provider. This file must end with a valid extension (.sig .sig.txt .sig.csv) and placed in the folder specified by the path on the status bar at the bottom of the APM window. Note that this folder is not created until the strategy is saved for the first time (i.e. it is not a 'new' strategy).
Set the Max Number of Positions field to limit the number of positions your strategy will take from the signal provider. If you do not need this field, then set it to a large value like 1000.
Try to run Order Preview to make sure that the signals are processed correctly. You can view any errors in the log tab if some signals are not processed as expected.
Note that once you run your strategy for real, the signal will be moved to the ProcessedSignals folder (which is also located at the path on the status bar).
This means you wont be able to run your strategy again because there won't be any signal files left to process (running Order Preview won't move your signal files).
Other Signal Types
Signals can also be created from stock screeners or be pulled from online.
|
|
|
Startup |
Posted by: admin - 09-06-2018, 06:31 AM - Forum: Getting Started
- Replies (1)
|
|
Startup
Open the Alera Dashboard and choose a workspace to store all your data. Make sure the workspace you choose is an empty folder that the software will be able to read/write to. If you are unsure, choose an empty folder in your documents.
Next click the + button to create an account which will handle your portfolio. Choose a descriptive name for your account without spaces, keeping in mind that it can't be changed in the future.
Next choose the broker your account will be with. For now, only Interactive Brokers is supported.
Interactive Brokers (IB) Setup
It's strongly suggested you use the IB Gateway (IBG) for placing orders instead of the Trader Workstation (TWS) because TWS will automatically shutdown everyday.
Note that you should try to use the stable version of IBG (the one that is linked) and not the latest (unstable) version
Once you download the IBG, login to your account. Make sure that the API type is set to IB API before you login. It is also suggested that, if this is your first time using the application, you set up your IB paper trading account first so that you can play around with strategy settings.
Next go to Configure -> Settings -> API -> Settings. You will see the window below. Setting the fields in the window the same as the ones below is all you need to get started.
The only two fields you may need to change in the future are the Socket Port and possibly the Trusted IPs.
Now we need to configure the IBG to automatically restart (otherwise it will shut off once a day).
Go to Configure -> Lock and Exit. Set the restart time to something outside of market hours and check Auto restart.
If you do not see this setting then you need to download a more recent version of the IB Gateway (975 or higher).
Now go back to APM to set up your broker. You can leave the IP Address as 127.0.0.1, unless you are hosting the IBG on a different computer than APM and changed the Trusted IPs in your settings. The Port should match the port you set in the IBG settings. The Client ID can be set to 0, unless you are planning on connecting to the same IBG with a different piece of software. Then you will have to be aware of what Client ID the other software uses and choose a different one. Lastly, set the Account ID to your IB account ID and click Save. Note that this is not the same as your login credentials. A paper trading account should start with 'DU' and a normal account should start with 'U', for example DU123456. This can usually be found at the top of the settings window from above, in TWS, or online.
Licenses
Note: Currently all paper-trading accounts will receive a free three month license without requiring sign up or credit card details. Leave the License Token as 117425.
Licenses for real accounts are paid, so we suggest you try APM with a free paper-trading account first. When you're ready to go live visit alerasubscriptions.com to purchase a license. If you have issues with PayPal then contact me at contact@aleratrading.com.
Once you've paid for your license (or if you're using a free one), you can click Start to connect to the IBG. If you successfully connect, then you can go ahead and start creating strategies. Otherwise, you will need to double check that your IBG settings are correct and that the ports match. The port you selected could already be taken by your computer, so try a different one (in the thousands) if you're certain your other settings are correct.
Strategies
There are various ways to approach creating strategies and an in depth explanation of the strategies page is posted elsewhere in the Documentation. If you'd like to get something setup that you can play around with, then you can select the Finviz Screener under Signal Provider Type. Select a screener from Finviz and paste the URL in the Buy URL text box. You can also changed the Max Dollar Value to 100,000 in order to make sure that your paper trading orders are actually placed. Leave the other settings as their default values and click Save.
Now you can click Order Preview to see the strategy run without actually placing orders. Check the Log tab to see extra information about what happened. You can also click the button beside Signal Processing Schedule to run the strategy and place orders. Now orders will be placed in IB and you can view them in the Portfolio tab.
|
|
|
|