![]() |
Strategies - 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: Strategies (/showthread.php?tid=4) |
Strategies - admin - 11-18-2018 Strategies You can configure the strategies you want to run in the strategy settings, which is the default page that opens once you've created an account. Your strategies are listed as tabs at the top of the window, and each individual strategy has 3 tabs: settings, logs and portfolio. This guide will go over the various sections of the settings tab and then explain what the portfolio and log tabs do. Before you get started, remember that every time you change a setting, you should click Save, otherwise your settings won't be updated. Also note that most of the information in this guide can be found directly on APM by hovering over the text boxes. ![]() Strategy This section is used to configure the where your strategy will get its signals from. Choose a signal provider type from the ones listed and fill out the fields. There are guides to using the individual signals and screeners that explain the fields in detail. Strategy Type This field lets you select the type of asset you will be trading (stocks, crypto, fx) as well as the country and currency the assets are in. Note that you cannot trade assets of two different types in the same strategy, e.g. you cannot trade stocks and fx, nor can you trade UK stocks and USD stocks in the same strategy. Strategy Priority Strategy priority allows a strategy to trade tickers from other strategies with lower priority. For example, suppose strategy A has priority 2, strategy B has priority 1, and strategy B is trading AAPL. If strategy A receives a signal for AAPL, then it can "take" AAPL from B and trade it. However, if strategy B then receives a signal for AAPL, it will not be able to trade it since strategy A has higher priority. If two strategies have the same priority, then neither one can trade tickers from the other. Also note that in the account settings there is an Orphan Ticker Priority text box, which lets you set the priority value for orphan tickers. This allow you to manage which strategies can process orphan tickers -- by default orphan ticker priority is 0, so all strategies can process orphan tickers. To add accommodate different use cases for strategy priority, the signal types CLOSE, BTC, STC will not be able to "take" positions from other strategies and close them. Instead, if you'd like to force this behaviour, you can use signal of the form LONG X 0 SHARES, where X is the ticker name. Max Number of Positions - non-screener strategies only This field determines the max number of positions your strategy can hold. There are three ways to cap your positions. Hard Cap This option ensures that you cannot place orders if the number of positions + orders is larger than the cap. For example, if your cap is 5 positions, and you have 3 positions in AAPL, IBM, SPY and 2 orders for TLT, GOOG, then you CANNOT place anymore orders in this strategy (unless they are for those 5 tickers) Hard Cap+ This option functions similar to Hard Cap, except now we don't count CLOSE market orders (MKT/MOC/MOO) towards the number of positions you own. This allows you to "replace" positions by first placing sell market orders and then placing buy orders. Note that by cancelling a CLOSING market orders, the number of positions may go over the cap. In this case, APM will automatically cancel any remaining limit orders. Hard Cap++ This is the same as Hard Cap+, but we don't count any CLOSE towards the number of positions you own. So, a closing limit order, would be considered to be closing your position even if it may not execute. This feature is mainly intended for crypto traders who may avoid market orders. Soft Cap This option only counts your current positions + market (MKT/MOC/MOO) + limit auction (LOO/LOC) orders towards the cap. Then when your cap is full, all remaining orders are automatically cancelled. For example, suppose your cap is 5 and you have 3 positions in AAPL, IBM, SPY, a MKT order to open TLT, three LMT orders to open GOOG, AMZN, V, and a close MKT order for AAPL. Then you are considered to currently have 3 positions in your cap: IBM, SPY, and TLT. We do not count AAPL since there is a market (MKT/MOO/MOC) order closing AAPL. If the LMT orders for GOOG and AMZN are executed, then we will count 5 total positions towards the cap, so the remaining LMT order for V will be cancelled.
Soft Cap++ Similar to soft cap, except now any CLOSE order is not counted towards the number of positions you own. Once again, this is mainly intended for crypto traders. Number of Positions - screener strategies only This is the number of positions from your screener that APM will hold. External Program The purpose of using external programs is to have the ability to run other software to create signals for APM to process. The guide here goes in detail over how to do this. Scheduler The scheduler section allows you to schedule your strategy. Refer to the cron guide to learn how to fill in schedule fields. There is also a 'play' button to the right of the schedule, which we will call the run button. It will run the strategy immediately instead of waiting for the schedule to trigger, but it will only be enabled when the account is connected and the strategy is not already running. You also have the option to disable the scheduler for the strategy by unchecking the checkbox beside Enable Scheduler. Everything else will remain the same, except that the strategy won't run. Position Sizing This section allows you to allocate how much money you would like to allocate to each strategy and each trade. Refer to the signals guide for details on Unit types. Strategy Allocation
There are three types of position sizing types that determine how large position will be
Allows you to specify the position you want to take if it is not specified by the signal provider or you choose the Custom position sizing type. The value you specify will be treated as percent of your Strategy Allocation or a dollar amount. Note that if you are connected to your broker, then the current dollar value of the custom lot size will be displayed to the left of the text box. Very Important!! Your Strategy Allocation value does not prevent orders from being placed if they will make the strategy exceed its allocation. This means if you allocate $100,000 to your strategy, and set the Custom Lot Size to 10% (which is $10,000), and the signal provider gives 20 signals, then the strategy will have a total dollar value of $200,000. You should choose your Custom Lot Size based on how many positions you think you will take. You also have the ability to limit the number of positions your strategy will use with the Max Number of Positions field under the Strategy section (where your signal provider settings are). This way if your Custom Lot Size is 10%, you can set the Max Number of Positions to 10 and put a hard limit on the number of positions you take. Allow Odd Lots Check this if you want to allow orders/positions of any size to be placed/held. Otherwise, all orders will be rounded such that the final position held will be a multiple of 100 shares. Order Types This section is used to specify the kind of orders you want placed in the market. Refer to the signals guide for details on Order Types. Default Market Order Type If no order type is specified by the signal provider, then the order will be a market order. Here you can specify whether you would like to place a Market (MKT) or Market On Close (MOC) order in this case. This also applies to screeners as well since they use market orders. Override Market Order Type This option allows you to override the market order type specified by the signal provider with the Default Market Order Type. This will only override MKT and MOC orders, not LMT or LOC. Protect Market Orders This allows the user to 'protect' their market orders by converting them to limit orders as follows:
This only works for Market orders and not Market on Close orders. Note that this is broker dependent and the order may not literally be converted to a limit order. For example, in Interactive Brokers, we use SNAP PRIM orders Override Limit Order Type This option allows you to override the limit order type specified by the signal provider with your own (keeping the same limit price). Default Time in Force If a time in force is not specified by the signal provider, then you can specify a default value. Note that MOC and LOC orders are always going to have DAY time in force. The time in force specified here will be applied to all screeners as well, but we recommend you use DAY orders. Email settings related to your strategy Send Email After Strategy Runs Check this to send an email after you strategy runs. It will contain data relevant to this specific strategy. If this check box is disabled, then either your email has not been set up or is disabled in your Account Settings. Position Management This section allows you do automatically manage stop loss and target orders for your current positions. Stop Loss Order Type Allows you to place stop loss orders with the Stop Loss Percent Trailing
Generate Target Orders Allows you to place target profit orders with the Target Profit Percentage. Note that updating the Target Profit Percentage will not update any existing orders, similar to the stop loss orders. It is important to note that for both Stop Loss and Target Profit orders, the amount of shares will adjust so the position will be closed if all other regular orders that shrink that position were to be executed at once. This means if we had a 100 shares of AAPL plus an order to sell 30 shares of AAPL, and we enabled both stop and target orders, we would end up with 3 orders in the market, one to sell 30 shares of AAPL, a stop loss to sell 70, and a target profit to sell 70. Since APM continuously monitors all positions, if the order to sell 30 shares of AAPL gets canceled for any reason at a later time, the quantities for both the stop and target orders will be adjusted to 100 shares automatically by APM. Order Limits This section allows you put limits on the number of shares, stock price, or total dollar value (shares x price) of an order. Minimums The Min fields specify that an order that does not CLOSE positions will be ignored if it does not meet the min criteria (the exception to this is Min Price, which only applies to non-shrinking orders) The reason we do not limit close orders is that we need to be able to close positions even if they have a small number of shares. Maximums The Max fields specify that an order that does not SHRINK positions will be ignored if it does not meet the criteria. This is slightly different than Min because we don't apply the limits to close orders and orders that shrink positions. Why? Because we want you to be able to shrink positions that are very large without having to close them (think about going from long 1000 shares to 100 shares). We do, however, want the Min conditions to apply to 'shrinking' orders because you may not want to buy/sell one share. For example, processing a signal LONG AAPL everyday may change the number of shares you hold by 1-2 everyday. You can prevent this behavior by setting Min Shares to maybe 10. This feature is not useful for Min Price, so it behaves the same way as the Max fields. Order Preview and Skip Orders APM allows you preview the orders that would be placed in the market by clicking the Order Preview button on the bottom left of the settings page. This feature allows you to semi-automate your system by having the ability to process your signals automatically, review them, and only then place them in the market. You will notice that in the order preview window, there is a checkbox beside each order that allows you skip the associated ticker or not. Once you click Update Skip Orders List at the bottom of the order preview window, the tickers associated with the orders you selected will be stored in the Skip Orders text box on the bottom right of the strategy page. Now whenever your strategy runs (for real), it will skip the orders for the tickers in Skip Orders. You can also manually edit skip orders when the strategy is not running. ![]() Log The log tab mainly logs signals as they are being processed and serves as a way to check that your strategy is running correctly. Any issues that will cause a signal (or order) to not be processed will appear here. If you notice that some signals have not been processed, check the log to find the reason for having unprocessed signals. Portfolio The portfolio tab stores a table of the positions you own and any active orders for the strategy. You can sort by a specific column by clicking on the column's header. You can remove a ticker from the strategy by clicking the Remove button on the right. This will not sell the position, it will simply remove it from the strategy so that another strategy can take it. Trades The trades tab lists the latest trades for the strategy. The trades go back one or more days depending on the broker API. (e.g. IB reports only the trades since the last closing while the crypto brokers report trades going back weeks) The partial trades that belong to the same order are aggregated in one entry. The tickers removed from the strategy (either manually or automatically) will not show in the trades tab. Order Ref Field (Interactive Brokers) Each order that is placed by APM in IB has an Order Ref field which is set as the ID of the strategy placing the order. This allows you to keep track of all your trades in each strategy through IB Flex reports. You need to specify "Include Audit Trail Fields" in your Flex Query configuration in order for the Order Ref field to be included in your reports. This solution was originally posted by a user in the following thread: https://aleratrading.com/forum/showthread.php?tid=125&pid=601#pid601 ![]() Signal Processing A ticker can only belong to one strategy at a time. When a strategy processes a signal for a ticker, it needs to check that the ticker does not already belong to a different strategy. If it does belong to a different strategy, then the signal is ignored. RE: Strategies - PTRDL - 05-20-2021 Hi, I noticed that "trail" is an option with IBKR, but there is no option for trailing stops in a BinanceUS strategy. Is this by design? RE: Strategies - admin - 05-21-2021 (05-20-2021, 08:47 PM)PTRDL Wrote: Hi, I noticed that "trail" is an option with IBKR, but there is no option for trailing stops in a BinanceUS strategy. Is this by design? Yes that's correct. Binance does not support trail orders, while IB does. RE: Strategies - Marcel - 03-04-2022 I really like the protection offset for Alera, I think it's a great feature. I wonder if it's possible to create a limit on open order with it? That is, I'd like to send a limit on open order at the bid plus around 5%. If it is possible, what could I send for a csv file? What settings would I use for Alera? If it isn't possible, would it be possible to add this feature to Alera? Above is a copy and paste of something that I tried, but it just ended up sending a market on open order. RE: Strategies - admin - 03-07-2022 I think this would be easier to implement on the user's end -- when your strategy runs in Alera, get the current price and send an LOO order at 5% higher than the current price (5 mins before market open). Also, I believe that the auction is locked a couple mins before market open, meaning that it's not really possible to adjust the prices as the market is about to open. |