Stock Signals - Printable Version +- Alera Forum (https://aleratrading.com/forum) +-- Forum: Alera Portfolio Manager (https://aleratrading.com/forum/forumdisplay.php?fid=1) +--- Forum: Documentation (https://aleratrading.com/forum/forumdisplay.php?fid=2) +--- Thread: Stock Signals (/showthread.php?tid=2) Pages:
1
2
|
Stock Signals - admin - 09-11-2018 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)
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)
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)
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 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. CLOSE __ALL__ 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. RE: Stock Signals - C0101 - 09-28-2020 Regarding Close (CLOSE), what if my signal file contains QUANLTY but not exact position size quantity? Will Alera close all position size, whatever the QUANTITY is? RE: Stock Signals - admin - 09-29-2020 (09-28-2020, 08:57 PM)C0101 Wrote: Regarding Close (CLOSE), what if my signal file contains QUANLTY but not exact position size quantity? Yes, Alera ignores the quantity field for CLOSE orders and closes whatever quantity you have RE: Stock Signals - C0101 - 09-29-2020 I got a error [9/29/2020 2:12:02 PM][1002] [ ERROR] [ Signal.INVALID] Invalid quantity [ 135.911 %POSITION] for signal [ADBE,9/29/2020 2:11:00 PM,0.00,1.00,1.00,0.00,0.00,Short, 135.911 %POSITION,1.23,3.30,1] What's wrong with [ 135.911 %POSITION]? I want to use leverage. the leverage could range from 0 to 3, including fraction. i.e. 5% or 300% RE: Stock Signals - admin - 09-29-2020 (09-29-2020, 01:16 PM)C0101 Wrote: I got a error The QUANTITY and UNIT are different columns. So you would need to specify [135.911, %POSITION] with a comma: [ADBE,9/29/2020 2:11:00 PM,0.00,1.00,1.00,0.00,0.00,Short, 135.911, %POSITION,1.23,3.30,1] Make sure you also include a QUANTITY and UNIT column in your csv file header. RE: Stock Signals - C0101 - 10-01-2020 Hi, Alera sent MKT order even if my signal is LMT and price provided. Attached is my setting screenshot. Thank Ticker,Date/Time,Buy,Sell,Short,Cover,CloseAll,Action,QUANTITY,UNIT,Type,Price,Sharpe,PositionScore,Rank(Sharpe) GM,10/1/2020 11:14:00 AM,1.00,0.00,0.00,0.00,0.00,BTO,5,%PORTFOLIO,LMT,29.79,1.14,-10.84,1 RE: Stock Signals - admin - 10-05-2020 (10-01-2020, 09:51 AM)C0101 Wrote: Hi, Alera sent MKT order even if my signal is LMT and price provided. Attached is my setting screenshot. Thank The 'Price' column should be LIMIT instead. Please see https://aleratrading.com/forum/showthread.php?tid=55 for more details on CSV files. RE: Stock Signals - C0101 - 10-05-2020 Do you mean it should be Ticker,Date/Time,Buy,Sell,Short,Cover,CloseAll,Action,QUANTITY,UNIT,Type,Price,Sharpe,PositionScore,Rank(Sharpe) GM,10/1/2020 11:14:00 AM,1.00,0.00,0.00,0.00,0.00,BTO,5,%PORTFOLIO,LIMIT,29.79,1.14,-10.84,1 OR Ticker,Date/Time,Buy,Sell,Short,Cover,CloseAll,Action,QUANTITY,UNIT,Type,LIMIT,Sharpe,PositionScore,Rank(Sharpe) GM,10/1/2020 11:14:00 AM,1.00,0.00,0.00,0.00,0.00,BTO,5,%PORTFOLIO,LMT,29.79,1.14,-10.84,1 RE: Stock Signals - admin - 10-05-2020 (10-05-2020, 02:37 PM)C0101 Wrote: Do you mean it should be The second one RE: Stock Signals - admin - 10-07-2021 (10-05-2021, 08:38 AM)hoanganhm81 Wrote: Is there a big difference between orders in forex and orders in stocks? visit https://m8winpro.com/ exchange about forex We tried to make them very similar in APM. See https://aleratrading.com/forum/showthread.php?tid=128 |