<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Alera Forum - Documentation]]></title>
		<link>https://aleratrading.com/forum/</link>
		<description><![CDATA[Alera Forum - https://aleratrading.com/forum]]></description>
		<pubDate>Thu, 16 Apr 2026 01:01:58 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Specifying Interactive Brokers Algos in Orders]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=505</link>
			<pubDate>Sun, 06 Feb 2022 20:34:40 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=505</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">IB Algos</span><br />
To learn about IB Algos see this <a href="https://www.interactivebrokers.com/en/trading/ordertypes.php" target="_blank" rel="noopener" class="mycode_url">overview</a> and their <a href="https://interactivebrokers.github.io/tws-api/ibalgos.html" target="_blank" rel="noopener" class="mycode_url">API docs</a>.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">IB Algo JSON File</span><br />
First we need to define the IB Algos we want to use in a JSON file called <span style="font-weight: bold;" class="mycode_b">ibAlgos.json</span>, which should be placed in your APM account directory. Below is an example JSON file that defines two different sets of parameters for the Adaptive IB Algo. Note that we can give each set of Algo parameters whatever name we want (<span style="font-weight: bold;" class="mycode_b">adaptive1</span> and <span style="font-weight: bold;" class="mycode_b">adaptive2</span> in this case), but we must fill the field <span style="font-weight: bold;" class="mycode_b">algo_strategy</span> with the correct name for the IB Algo (as specified in the IB API Docs linked above). The parameters for the IB Algo (in this case <span style="font-weight: bold;" class="mycode_b">adaptivePriority</span>) must be specified <span style="font-weight: bold;" class="mycode_b">as strings</span> (and according to IB API docs).<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>{<br />
    "adaptive1": {<br />
        "algo_strategy" : "Adaptive",<br />
        "adaptivePriority": "Patient"<br />
    },<br />
    "adaptive2": {<br />
        "algo_strategy" : "Adaptive",<br />
        "adaptivePriority": "Urgent"<br />
    }<br />
}<br />
</code></div>
</div>
<br />
<span style="font-size: x-large;" class="mycode_size">Specifying IB Algos in Signals</span><br />
To specify that an order should use an IB Algo simply add keyword ALGO followed by the name of the Algo you created. For example<br />
<div class="codeblock">
<div class="body" dir="ltr"><code> BTO AAPL ALGO adaptive1<br />
BTO SPY ALGO adaptive2<br />
</code></div>
</div>
<br />
To specify the IB Algo in a CSV file, use the column ALGO.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Notes</span><ul class="mycode_list"><li>You must disconnect and then reconnect APM to reflect any changes to the IB Algo file.<br />
</li>
<li>It is recommended to run some tests on a paper trading account to make sure that the orders using IB Algos are successfully placed (i.e. you should make sure the JSON file is correctly formatted and that all Algo parameters are specified)<br />
</li>
</ul>
]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">IB Algos</span><br />
To learn about IB Algos see this <a href="https://www.interactivebrokers.com/en/trading/ordertypes.php" target="_blank" rel="noopener" class="mycode_url">overview</a> and their <a href="https://interactivebrokers.github.io/tws-api/ibalgos.html" target="_blank" rel="noopener" class="mycode_url">API docs</a>.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">IB Algo JSON File</span><br />
First we need to define the IB Algos we want to use in a JSON file called <span style="font-weight: bold;" class="mycode_b">ibAlgos.json</span>, which should be placed in your APM account directory. Below is an example JSON file that defines two different sets of parameters for the Adaptive IB Algo. Note that we can give each set of Algo parameters whatever name we want (<span style="font-weight: bold;" class="mycode_b">adaptive1</span> and <span style="font-weight: bold;" class="mycode_b">adaptive2</span> in this case), but we must fill the field <span style="font-weight: bold;" class="mycode_b">algo_strategy</span> with the correct name for the IB Algo (as specified in the IB API Docs linked above). The parameters for the IB Algo (in this case <span style="font-weight: bold;" class="mycode_b">adaptivePriority</span>) must be specified <span style="font-weight: bold;" class="mycode_b">as strings</span> (and according to IB API docs).<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>{<br />
    "adaptive1": {<br />
        "algo_strategy" : "Adaptive",<br />
        "adaptivePriority": "Patient"<br />
    },<br />
    "adaptive2": {<br />
        "algo_strategy" : "Adaptive",<br />
        "adaptivePriority": "Urgent"<br />
    }<br />
}<br />
</code></div>
</div>
<br />
<span style="font-size: x-large;" class="mycode_size">Specifying IB Algos in Signals</span><br />
To specify that an order should use an IB Algo simply add keyword ALGO followed by the name of the Algo you created. For example<br />
<div class="codeblock">
<div class="body" dir="ltr"><code> BTO AAPL ALGO adaptive1<br />
BTO SPY ALGO adaptive2<br />
</code></div>
</div>
<br />
To specify the IB Algo in a CSV file, use the column ALGO.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Notes</span><ul class="mycode_list"><li>You must disconnect and then reconnect APM to reflect any changes to the IB Algo file.<br />
</li>
<li>It is recommended to run some tests on a paper trading account to make sure that the orders using IB Algos are successfully placed (i.e. you should make sure the JSON file is correctly formatted and that all Algo parameters are specified)<br />
</li>
</ul>
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Programmatically Start APM]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=464</link>
			<pubDate>Thu, 11 Nov 2021 00:33:37 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=464</guid>
			<description><![CDATA[You can programmatically start APM and connect to your broker using Powershell (or some other program)<br />
<div class="codeblock">
<div class="body" dir="ltr"><code> &amp; 'C:\Program Files (x86)\Alera\Alera Portfolio Manager\Alera Portfolio Manager.exe' AccountName --start<br />
</code></div>
</div>
where AccountName should be replaced by the name of the account you want to open, and the --start argument indicates that APM should connect to your broker.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note that this was added in version 3.3.8</span>]]></description>
			<content:encoded><![CDATA[You can programmatically start APM and connect to your broker using Powershell (or some other program)<br />
<div class="codeblock">
<div class="body" dir="ltr"><code> &amp; 'C:\Program Files (x86)\Alera\Alera Portfolio Manager\Alera Portfolio Manager.exe' AccountName --start<br />
</code></div>
</div>
where AccountName should be replaced by the name of the account you want to open, and the --start argument indicates that APM should connect to your broker.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Note that this was added in version 3.3.8</span>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Delayed Signals]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=413</link>
			<pubDate>Thu, 17 Jun 2021 20:01:32 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=413</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Delayed Signals</span><br />
Delayed Signals allow you to specify when you want a signal to be processed by APM.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Formatting</span><br />
A delayed signal is specified by writing AFTER &lt;date&gt; in the signal. The date is formatted as <span style="font-weight: bold;" class="mycode_b">YYYYMMdd hh:mm<img src="https://aleratrading.com/forum/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />s zzz</span> where zzz is the timezone e.g. 20200108 15:30:00 EST. This is the exact same as the format for GTD (Good Til' Date) orders.<br />
<br />
Here are some sample signals<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>LONG SPY AFTER 20210601 10:00:00 EST<br />
CLOSE AAPL LMT 400 AFTER 20210601 13:00:00 EST<br />
RSN IBM ID 100 AFTER 20210601 13:00:00 PST <br />
</code></div>
</div>
<br />
<span style="font-size: x-large;" class="mycode_size">Important Notes</span><ul class="mycode_list"><li>Any signal can be delayed.<br />
</li>
<li>You can only have one delayed signal stored at time per ticker. If you place a second delayed signal for the same ticker, it will override the existing one.<br />
</li>
<li>To cancel a delayed signal, simply write AFTER 0 instead of a date. The Action in the signal doesn't matter. For example,<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>LONG SPY AFTER 0</code></div>
</div>
will cancel an existing delayed signal.<br />
</li>
<li>Delayed signals can be placed in a strategy for a ticker even if the ticker is not owned by the strategy. At the time that the delayed signal triggers, the signal will be processed as usual.<br />
</li>
<li>Delayed signals that are not owned by a strategy will show up with the exposure ORPHAN or STR_{ID} in your portfolio tab. This is to indicate whether the ticker is currently orphaned or belongs to a strategy with the id {ID}. The current quantity is also displayed.<br />
</li>
<li>Delayed signals are highlighted in orange in your portfolio tab.<br />
</li>
<li>For CSV files the column name you need to use is AFTERDATE. Note that in this column you only need the date and <span style="font-weight: bold;" class="mycode_b">not</span> the keyword AFTER before the date.<br />
</li>
</ul>
]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Delayed Signals</span><br />
Delayed Signals allow you to specify when you want a signal to be processed by APM.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Formatting</span><br />
A delayed signal is specified by writing AFTER &lt;date&gt; in the signal. The date is formatted as <span style="font-weight: bold;" class="mycode_b">YYYYMMdd hh:mm<img src="https://aleratrading.com/forum/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />s zzz</span> where zzz is the timezone e.g. 20200108 15:30:00 EST. This is the exact same as the format for GTD (Good Til' Date) orders.<br />
<br />
Here are some sample signals<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>LONG SPY AFTER 20210601 10:00:00 EST<br />
CLOSE AAPL LMT 400 AFTER 20210601 13:00:00 EST<br />
RSN IBM ID 100 AFTER 20210601 13:00:00 PST <br />
</code></div>
</div>
<br />
<span style="font-size: x-large;" class="mycode_size">Important Notes</span><ul class="mycode_list"><li>Any signal can be delayed.<br />
</li>
<li>You can only have one delayed signal stored at time per ticker. If you place a second delayed signal for the same ticker, it will override the existing one.<br />
</li>
<li>To cancel a delayed signal, simply write AFTER 0 instead of a date. The Action in the signal doesn't matter. For example,<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>LONG SPY AFTER 0</code></div>
</div>
will cancel an existing delayed signal.<br />
</li>
<li>Delayed signals can be placed in a strategy for a ticker even if the ticker is not owned by the strategy. At the time that the delayed signal triggers, the signal will be processed as usual.<br />
</li>
<li>Delayed signals that are not owned by a strategy will show up with the exposure ORPHAN or STR_{ID} in your portfolio tab. This is to indicate whether the ticker is currently orphaned or belongs to a strategy with the id {ID}. The current quantity is also displayed.<br />
</li>
<li>Delayed signals are highlighted in orange in your portfolio tab.<br />
</li>
<li>For CSV files the column name you need to use is AFTERDATE. Note that in this column you only need the date and <span style="font-weight: bold;" class="mycode_b">not</span> the keyword AFTER before the date.<br />
</li>
</ul>
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Tips and Tricks (Miscellaneous)]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=405</link>
			<pubDate>Tue, 25 May 2021 16:03:51 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=405</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Tips and Tricks</span><br />
This thread has several tips and tricks that may be useful to you. Some of these are listed elsewhere in the documentation as well.<br />
Please feel free to suggest additions to this list by replying to this thread.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Interactive Brokers</span><br />
<br />
<span style="font-size: medium;" class="mycode_size">Preload Contract Details</span><br />
You can specify a list of tickers to preload contract details for at APM startup (connection to IB) so that your orders can be placed more efficiently (since sometimes IB provides contract details very slowly). You can place a file called <span style="font-weight: bold;" class="mycode_b">cd_ticker_list.txt</span> in the account level directory with a list of tickers (comma, new-line, or space separated tickers). Note that you need to specify the country of the ticker in the name using the following rules:<ul class="mycode_list"><li>The format is &lt;ticker&gt;:&lt;country&gt;, for example BHP:AX where AX is the country code for Australia<br />
</li>
<li>Valid country codes are AX (Australia), US (USA), UK (UK), NS (India)<br />
</li>
<li>US tickers do not need a country code. You can use SPY and not SPY:US<br />
</li>
<li>To indicate a CFD, prefix the ticker with @ (e.g. @SPY) <br />
</li>
<li>This does not work for UK tickers that are not in GBP (or GBX) currency. We will add support for other currencies in the future if there is interest<br />
</li>
<li>Note that the formatting rules above correspond exactly to the formatting rules you see used in APM for tickers<br />
</li>
</ul>
<br />
<span style="font-size: medium;" class="mycode_size">Order Ref Field</span><br />
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: <a href="https://aleratrading.com/forum/showthread.php?tid=125&amp;pid=601#pid601" target="_blank" rel="noopener" class="mycode_url">https://aleratrading.com/forum/showthrea...601#pid601</a><br />
<img src="http://aleratrading.com/forum/images/documentation/ib_orderref.png" loading="lazy"  width="900" height="400" alt="[Image: ib_orderref.png]" class="mycode_img" />]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Tips and Tricks</span><br />
This thread has several tips and tricks that may be useful to you. Some of these are listed elsewhere in the documentation as well.<br />
Please feel free to suggest additions to this list by replying to this thread.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Interactive Brokers</span><br />
<br />
<span style="font-size: medium;" class="mycode_size">Preload Contract Details</span><br />
You can specify a list of tickers to preload contract details for at APM startup (connection to IB) so that your orders can be placed more efficiently (since sometimes IB provides contract details very slowly). You can place a file called <span style="font-weight: bold;" class="mycode_b">cd_ticker_list.txt</span> in the account level directory with a list of tickers (comma, new-line, or space separated tickers). Note that you need to specify the country of the ticker in the name using the following rules:<ul class="mycode_list"><li>The format is &lt;ticker&gt;:&lt;country&gt;, for example BHP:AX where AX is the country code for Australia<br />
</li>
<li>Valid country codes are AX (Australia), US (USA), UK (UK), NS (India)<br />
</li>
<li>US tickers do not need a country code. You can use SPY and not SPY:US<br />
</li>
<li>To indicate a CFD, prefix the ticker with @ (e.g. @SPY) <br />
</li>
<li>This does not work for UK tickers that are not in GBP (or GBX) currency. We will add support for other currencies in the future if there is interest<br />
</li>
<li>Note that the formatting rules above correspond exactly to the formatting rules you see used in APM for tickers<br />
</li>
</ul>
<br />
<span style="font-size: medium;" class="mycode_size">Order Ref Field</span><br />
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: <a href="https://aleratrading.com/forum/showthread.php?tid=125&amp;pid=601#pid601" target="_blank" rel="noopener" class="mycode_url">https://aleratrading.com/forum/showthrea...601#pid601</a><br />
<img src="http://aleratrading.com/forum/images/documentation/ib_orderref.png" loading="lazy"  width="900" height="400" alt="[Image: ib_orderref.png]" class="mycode_img" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Custom Stop and Target Orders]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=404</link>
			<pubDate>Wed, 12 May 2021 20:00:05 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=404</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Custom Stop and Target Orders</span><br />
As of version 3.3.0, we have added the ability to have APM manage custom Stop and Target orders. These are different from regular signals since APM will manage <span style="font-weight: bold;" class="mycode_b">two orders</span> at once for a given position alongside any regular orders.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Order Types</span><br />
To distinguish between the custom stop/target orders and regular STP/TGT orders, we use the names <span style="font-weight: bold;" class="mycode_b">Exit Stop (E_STP)</span> and <span style="font-weight: bold;" class="mycode_b">Exit Target (E_TGT)</span>. These names (somewhat) intuitively imply that these stop and target prices will be used for exiting positions, essentially functioning as highly customizable bracket orders. It's important to note that E_STP and E_TGT orders are handled by the same system that is described in the Position Management system described in the <a href="https://aleratrading.com/forum/showthread.php?tid=4" target="_blank" rel="noopener" class="mycode_url">Strategies</a> documentation. The major difference is that you as a user can specify the STP and TGT prices instead of letting APM choose.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Signals Formats</span><br />
There are two ways to specify to use custom stop/target orders: directly in signals for regular orders OR as separate signals.<br />
<br />
<span style="font-size: large;" class="mycode_size">Regular Signals</span><ul class="mycode_list"><li>When you want to open (or modify) a position with an order, you can specify a E_STP or E_TGT price in the signal. <br />
For example, all of the following are valid signals<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>BTO SPY 500 SHARES MKT E_STP 200<br />
LONG SPY 500 SHARES LOC 300 E_TGT 600<br />
LONG SPY 500 SHARES LMT 300 E_STP 200 E_TGT 600<br />
</code></div>
</div>
<br />
</li>
<li>Once one of the above signals open a position, then E_STP and E_TGT prices will be used to create orders.<br />
</li>
<li>Note that the signal must be valid in order for the E_STP or E_TGT price to be processed<br />
</li>
</ul>
<br />
<span style="font-size: large;" class="mycode_size">E_STP and E_TGT Signals</span><ul class="mycode_list"><li>When we only want to update the E_STP and E_TGT price, we can use custom signals in the following format:<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>[OrderType] [Ticker] [Price]<br />
</code></div>
</div>
<br />
For example, <br />
<div class="codeblock">
<div class="body" dir="ltr"><code>E_TGT SPY 600<br />
E_STP SPY 400<br />
</code></div>
</div>
<br />
</li>
<li>Note that these signals can only be processed <span style="font-weight: bold;" class="mycode_b">if a position or order already exists</span> for the ticker.<br />
</li>
</ul>
<br />
<span style="font-size: large;" class="mycode_size">Cancelling Custom Stop/Target Orders</span><br />
You can cancel a custom Stop and Target order by using a -1 in the price spot of an E_STP or E_TGT signal. For example,<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>E_TGT SPY -1<br />
E_STP SPY -1<br />
</code></div>
</div>
Note that you <span style="font-weight: bold;" class="mycode_b">cannot</span> set the E_STP/E_TGT price to -1 in a <span style="font-weight: bold;" class="mycode_b">regular</span> signal to cancel stop/target orders. <br />
<br />
<span style="font-size: large;" class="mycode_size">General  Notes</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">When opening a position</span>, the E_STP and E_TGT values will be of the most recent signal. This means that if you try to open a position without an E_STP (or E_TGT) price, the existing E_STP (or TGT) price <span style="font-weight: bold;" class="mycode_b">will be removed</span>.<br />
  - If you already have a position open then the E_STP and E_TGT can only be removed by sending a new E_STP (or E_TGT) signal with price to -1 or manually cancelling the order in the portfolio tab.<br />
</li>
<li>You can cancel these E_STP and E_TGT orders. If regular STP and TGT orders are enabled, then those will be placed once you cancel the E_STP or E_TGT order.<br />
</li>
<li>If you close a position, all E_STP and E_TGT orders are cancelled. Furthermore, if you cancel the order associated with an E_STP (or E_TGT) order (<span style="font-weight: bold;" class="mycode_b">and there is no position</span>), then the E_STP (or E_TGT) order will be cancelled<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Conditional Orders (RSN,REL,RES, etc.) don't place E_STP or E_TGT immediately.</span> The E_STP and E_TGT orders are only registered after the conditional order triggers. This also means that using a different E_STP or E_TGT value than the current one for something like a ReEnter Long (REL) signal <span style="font-weight: bold;" class="mycode_b">will not</span> affect your current E_STP or E_TGT price, until that REL signal is converted to a regular order later.<br />
</li>
</ul>
<br />
<span style="font-size: x-large;" class="mycode_size">CSV Signal File Format</span><br />
Please see the <a href="https://aleratrading.com/forum/showthread.php?tid=55" target="_blank" rel="noopener" class="mycode_url">File Formats</a> documentation for details.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Custom Stop and Target Orders</span><br />
As of version 3.3.0, we have added the ability to have APM manage custom Stop and Target orders. These are different from regular signals since APM will manage <span style="font-weight: bold;" class="mycode_b">two orders</span> at once for a given position alongside any regular orders.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Order Types</span><br />
To distinguish between the custom stop/target orders and regular STP/TGT orders, we use the names <span style="font-weight: bold;" class="mycode_b">Exit Stop (E_STP)</span> and <span style="font-weight: bold;" class="mycode_b">Exit Target (E_TGT)</span>. These names (somewhat) intuitively imply that these stop and target prices will be used for exiting positions, essentially functioning as highly customizable bracket orders. It's important to note that E_STP and E_TGT orders are handled by the same system that is described in the Position Management system described in the <a href="https://aleratrading.com/forum/showthread.php?tid=4" target="_blank" rel="noopener" class="mycode_url">Strategies</a> documentation. The major difference is that you as a user can specify the STP and TGT prices instead of letting APM choose.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Signals Formats</span><br />
There are two ways to specify to use custom stop/target orders: directly in signals for regular orders OR as separate signals.<br />
<br />
<span style="font-size: large;" class="mycode_size">Regular Signals</span><ul class="mycode_list"><li>When you want to open (or modify) a position with an order, you can specify a E_STP or E_TGT price in the signal. <br />
For example, all of the following are valid signals<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>BTO SPY 500 SHARES MKT E_STP 200<br />
LONG SPY 500 SHARES LOC 300 E_TGT 600<br />
LONG SPY 500 SHARES LMT 300 E_STP 200 E_TGT 600<br />
</code></div>
</div>
<br />
</li>
<li>Once one of the above signals open a position, then E_STP and E_TGT prices will be used to create orders.<br />
</li>
<li>Note that the signal must be valid in order for the E_STP or E_TGT price to be processed<br />
</li>
</ul>
<br />
<span style="font-size: large;" class="mycode_size">E_STP and E_TGT Signals</span><ul class="mycode_list"><li>When we only want to update the E_STP and E_TGT price, we can use custom signals in the following format:<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>[OrderType] [Ticker] [Price]<br />
</code></div>
</div>
<br />
For example, <br />
<div class="codeblock">
<div class="body" dir="ltr"><code>E_TGT SPY 600<br />
E_STP SPY 400<br />
</code></div>
</div>
<br />
</li>
<li>Note that these signals can only be processed <span style="font-weight: bold;" class="mycode_b">if a position or order already exists</span> for the ticker.<br />
</li>
</ul>
<br />
<span style="font-size: large;" class="mycode_size">Cancelling Custom Stop/Target Orders</span><br />
You can cancel a custom Stop and Target order by using a -1 in the price spot of an E_STP or E_TGT signal. For example,<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>E_TGT SPY -1<br />
E_STP SPY -1<br />
</code></div>
</div>
Note that you <span style="font-weight: bold;" class="mycode_b">cannot</span> set the E_STP/E_TGT price to -1 in a <span style="font-weight: bold;" class="mycode_b">regular</span> signal to cancel stop/target orders. <br />
<br />
<span style="font-size: large;" class="mycode_size">General  Notes</span><ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">When opening a position</span>, the E_STP and E_TGT values will be of the most recent signal. This means that if you try to open a position without an E_STP (or E_TGT) price, the existing E_STP (or TGT) price <span style="font-weight: bold;" class="mycode_b">will be removed</span>.<br />
  - If you already have a position open then the E_STP and E_TGT can only be removed by sending a new E_STP (or E_TGT) signal with price to -1 or manually cancelling the order in the portfolio tab.<br />
</li>
<li>You can cancel these E_STP and E_TGT orders. If regular STP and TGT orders are enabled, then those will be placed once you cancel the E_STP or E_TGT order.<br />
</li>
<li>If you close a position, all E_STP and E_TGT orders are cancelled. Furthermore, if you cancel the order associated with an E_STP (or E_TGT) order (<span style="font-weight: bold;" class="mycode_b">and there is no position</span>), then the E_STP (or E_TGT) order will be cancelled<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Conditional Orders (RSN,REL,RES, etc.) don't place E_STP or E_TGT immediately.</span> The E_STP and E_TGT orders are only registered after the conditional order triggers. This also means that using a different E_STP or E_TGT value than the current one for something like a ReEnter Long (REL) signal <span style="font-weight: bold;" class="mycode_b">will not</span> affect your current E_STP or E_TGT price, until that REL signal is converted to a regular order later.<br />
</li>
</ul>
<br />
<span style="font-size: x-large;" class="mycode_size">CSV Signal File Format</span><br />
Please see the <a href="https://aleratrading.com/forum/showthread.php?tid=55" target="_blank" rel="noopener" class="mycode_url">File Formats</a> documentation for details.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Trading CFDs (Contracts for Difference)]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=334</link>
			<pubDate>Tue, 05 Jan 2021 16:59:50 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=334</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">CFDs for Stocks</span><br />
These instruments allow you to get the returns of an underlying stock, but are traded directly through your broker and not an exchange. They can be useful if you are European and looking to trade US ETFs and Stocks that may not be available in your country. Please read the IB documentation <a href="https://www.interactivebrokers.co.uk/en/index.php?f=39284" target="_blank" rel="noopener" class="mycode_url">doc 1</a> and <a href="https://ibkr.info/article/1912" target="_blank" rel="noopener" class="mycode_url">doc 2</a>. Trade at your own risk.<br />
<br />
CFDs are not available to those residing in the US or Canada for legal reasons. If you attempt to trade CFDs on your IB accounts, the orders will be rejected from IB (and you can see the error message in your account log).<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">How Trade CFDs in APM</span><br />
In your strategy settings there is a <span style="font-weight: bold;" class="mycode_b">Security Type</span> setting that allows you to select different options for trading.<br />
CFDs are prefixed with the @ symbol, e.g. the CFD for SPY will be displayed as @SPY<br />
<br />
<span style="font-size: medium;" class="mycode_size">Stocks Only</span><br />
Standard APM stock trading.<br />
<br />
<span style="font-size: medium;" class="mycode_size">CFDs Only</span><br />
Trade only CFDs. <span style="font-weight: bold;" class="mycode_b">All signals should be formatted the same</span>. The only difference is that instead of buying the stock, APM will buy the CFD.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Stocks and CFDs</span><br />
This setting allows you trade both Stocks and CFDs. Click the ... beside this option to open a settings window that allows you to specify which tickers you would like to trade as Stocks and CFDs.<br />
<span style="font-weight: bold;" class="mycode_b">IMPORTANT:</span> Even though we distinguish between Stocks and CFDs, signals <span style="font-weight: bold;" class="mycode_b">must</span> still only contain the ticker name, e.g. SPY and <span style="font-weight: bold;" class="mycode_b">not</span> @SPY<br />
<span style="font-weight: bold;" class="mycode_b">IMPORTANT:</span> You can only trade <span style="font-weight: bold;" class="mycode_b">either</span> the Stock or the CFD for a ticker in the strategy. For example, if the stock is currently in the strategy, then any signals in the strategy will be for the stock <span style="font-weight: bold;" class="mycode_b">regardless of your settings</span>. Once the stock position closes, then you can trade the CFD in the strategy.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">CFDs for Stocks</span><br />
These instruments allow you to get the returns of an underlying stock, but are traded directly through your broker and not an exchange. They can be useful if you are European and looking to trade US ETFs and Stocks that may not be available in your country. Please read the IB documentation <a href="https://www.interactivebrokers.co.uk/en/index.php?f=39284" target="_blank" rel="noopener" class="mycode_url">doc 1</a> and <a href="https://ibkr.info/article/1912" target="_blank" rel="noopener" class="mycode_url">doc 2</a>. Trade at your own risk.<br />
<br />
CFDs are not available to those residing in the US or Canada for legal reasons. If you attempt to trade CFDs on your IB accounts, the orders will be rejected from IB (and you can see the error message in your account log).<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">How Trade CFDs in APM</span><br />
In your strategy settings there is a <span style="font-weight: bold;" class="mycode_b">Security Type</span> setting that allows you to select different options for trading.<br />
CFDs are prefixed with the @ symbol, e.g. the CFD for SPY will be displayed as @SPY<br />
<br />
<span style="font-size: medium;" class="mycode_size">Stocks Only</span><br />
Standard APM stock trading.<br />
<br />
<span style="font-size: medium;" class="mycode_size">CFDs Only</span><br />
Trade only CFDs. <span style="font-weight: bold;" class="mycode_b">All signals should be formatted the same</span>. The only difference is that instead of buying the stock, APM will buy the CFD.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Stocks and CFDs</span><br />
This setting allows you trade both Stocks and CFDs. Click the ... beside this option to open a settings window that allows you to specify which tickers you would like to trade as Stocks and CFDs.<br />
<span style="font-weight: bold;" class="mycode_b">IMPORTANT:</span> Even though we distinguish between Stocks and CFDs, signals <span style="font-weight: bold;" class="mycode_b">must</span> still only contain the ticker name, e.g. SPY and <span style="font-weight: bold;" class="mycode_b">not</span> @SPY<br />
<span style="font-weight: bold;" class="mycode_b">IMPORTANT:</span> You can only trade <span style="font-weight: bold;" class="mycode_b">either</span> the Stock or the CFD for a ticker in the strategy. For example, if the stock is currently in the strategy, then any signals in the strategy will be for the stock <span style="font-weight: bold;" class="mycode_b">regardless of your settings</span>. Once the stock position closes, then you can trade the CFD in the strategy.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[FX and Crypto Trading]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=128</link>
			<pubDate>Fri, 28 Aug 2020 18:36:03 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=128</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">FX and Crypto Trading</span><br />
This guide explains how to trade FX and Crypto with APM. We will refer to both FX and Crypto trading as Currency Trading from here on out.<br />
Available with APM version 3.0.0+<br />
<br />
You should be familiar with APM before reading this guide.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">How Currency Pairs are Represented</span><br />
Our goal was to make Currency trading as similar to stock trading as possible, so that you can enjoy all the same features as with stocks. The main idea here is that for an Currency trading strategy, you choose a <span style="font-weight: bold;" class="mycode_b">base</span> currency to trade in, where any currency you trade will be paired with the base currency. For example, you might choose USD as the base currency for your strategy and trade CAD, GBP, and EUR on that strategy. This means you would be trading CAD-USD, GBP-USD, and EUR-USD pairs. Note that some exchanges/brokers use a different convention and call this the "quote" currency, while calling the left currency in the pair the "base" currency.<br />
<br />
You should also note that even though your broker might only support the CAD-USD pair (in that order), APM allows you trade both CAD-USD and USD-CAD by automatically converting to the pair supported by your broker. This means that when you view your portfolio for a strategy, you will see all the pairs in the same direction (i.e. XXX-USD when USD is the base currency).<br />
<br />
Also note that when you select a base currency for a strategy, that currency can no longer be traded by any other strategy.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Currency Signals</span><br />
Behavior is very similar to <a href="https://aleratrading.com/forum/editpost.php?pid=2" target="_blank" rel="noopener" class="mycode_url">stock signals</a>. Your signals <span style="font-weight: bold;" class="mycode_b">must</span> only contain the non-base pair. i.e., if your base currency is USD, and you want to trade CAD-USD, then the <span style="font-weight: bold;" class="mycode_b">ticker</span> in your signal must be CAD (<span style="font-weight: bold;" class="mycode_b">not</span> CAD-USD). <br />
<br />
Also, the <span style="font-weight: bold;" class="mycode_b">unit types</span> are slightly different. Instead of DOLLARS/&#36; and SHARES, you should use PRIMARY and the currency name itself, respectively. The other unit types remain the same.<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code># instead of BTO USD 10000 SHARES DAY                       <br />
BTO USD 10000 USD DAY <br />
<br />
# instead of BTO USD 500 &#36;    <br />
BTO USD 500 PRIMARY<br />
         <br />
# other examples<br />
BTO BTC 5 BTC LMT 9000 GTC    # bitcion<br />
LONG USD 10 %PORTFOLIO MKT<br />
</code></div>
</div>
<br />
<span style="font-size: x-large;" class="mycode_size">Quantity and Price Precision</span><br />
Since it's possible to purchase fractional quantities with currencies, each currency trading pair has its own unique <span style="font-weight: bold;" class="mycode_b">min tick</span> size designated by the broker. Since the pairs we are trading are fixed, e.g. we can BTC-USD (and not USD-BTC), there is a precision specified on the quantity of BTC (8 decimal places) and a precision specified on price in USD (2 decimal places). You can view both the quantity and price precision for each trading pair in the <span style="font-weight: bold;" class="mycode_b">currency info</span> tab in your account settings (when you are connected to your broker).<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Min Currency Quantities for Positions</span><br />
In Currency trading, it is often not possible to completely close your position in a currency (i.e. it's hard to make your position exactly 0). However, when you close your position, APM will consider your position <span style="font-weight: bold;" class="mycode_b">neutral</span> if the final balance is small enough. For Crypto trading, this threshold is when your position is less than &#36;1 USD. For FX trading in IB, this threshold is when your position is less than &#36;50 USD.<br />
<br />
Note that sometimes in IB, a close order may not be able to shrink a position past this &#36;50 threshold. This is rare, but when it does happen, you will have to enter another CLOSE or close the position manually in order to free up the ticker from the strategy.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Brokers</span><br />
<span style="font-size: large;" class="mycode_size">Interactive Brokers</span><ul class="mycode_list"><li>You can use the same IB gateway as for stock trading, just make sure the client IDs are different in APM if you want to trade both stocks and FX at the same time. By default stock trading has client ID 0 and FX has client ID 1.<br />
</li>
<li>Base currencies: USD, AUD, EUR, GBP, CAD<br />
</li>
</ul>
<br />
<span style="font-size: large;" class="mycode_size">Binance and Binance US</span><ul class="mycode_list"><li>Only non-margin trading as of now<br />
</li>
<li>STPLMT and LIT orders are converted to LMT orders if the target price is already met. Otherwise, Binance rejects these orders if we leave them as STPLMT/LIT<br />
</li>
<li>Alera STP and TGT orders cannot both be in the market at the same time because of margin restrictions. To resolve this, APM will swap between STP and TGT orders depending on which is closer to being executed.<br />
</li>
<li>No fee for <span style="font-weight: bold;" class="mycode_b">cancelling</span> orders, so we can get around any potential problems caused by the above points by internally managing orders<br />
</li>
<li>Base currencies: USD (only Binance US), EUR (only Binance), USDT, BTC<br />
</li>
</ul>
]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">FX and Crypto Trading</span><br />
This guide explains how to trade FX and Crypto with APM. We will refer to both FX and Crypto trading as Currency Trading from here on out.<br />
Available with APM version 3.0.0+<br />
<br />
You should be familiar with APM before reading this guide.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">How Currency Pairs are Represented</span><br />
Our goal was to make Currency trading as similar to stock trading as possible, so that you can enjoy all the same features as with stocks. The main idea here is that for an Currency trading strategy, you choose a <span style="font-weight: bold;" class="mycode_b">base</span> currency to trade in, where any currency you trade will be paired with the base currency. For example, you might choose USD as the base currency for your strategy and trade CAD, GBP, and EUR on that strategy. This means you would be trading CAD-USD, GBP-USD, and EUR-USD pairs. Note that some exchanges/brokers use a different convention and call this the "quote" currency, while calling the left currency in the pair the "base" currency.<br />
<br />
You should also note that even though your broker might only support the CAD-USD pair (in that order), APM allows you trade both CAD-USD and USD-CAD by automatically converting to the pair supported by your broker. This means that when you view your portfolio for a strategy, you will see all the pairs in the same direction (i.e. XXX-USD when USD is the base currency).<br />
<br />
Also note that when you select a base currency for a strategy, that currency can no longer be traded by any other strategy.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Currency Signals</span><br />
Behavior is very similar to <a href="https://aleratrading.com/forum/editpost.php?pid=2" target="_blank" rel="noopener" class="mycode_url">stock signals</a>. Your signals <span style="font-weight: bold;" class="mycode_b">must</span> only contain the non-base pair. i.e., if your base currency is USD, and you want to trade CAD-USD, then the <span style="font-weight: bold;" class="mycode_b">ticker</span> in your signal must be CAD (<span style="font-weight: bold;" class="mycode_b">not</span> CAD-USD). <br />
<br />
Also, the <span style="font-weight: bold;" class="mycode_b">unit types</span> are slightly different. Instead of DOLLARS/&#36; and SHARES, you should use PRIMARY and the currency name itself, respectively. The other unit types remain the same.<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code># instead of BTO USD 10000 SHARES DAY                       <br />
BTO USD 10000 USD DAY <br />
<br />
# instead of BTO USD 500 &#36;    <br />
BTO USD 500 PRIMARY<br />
         <br />
# other examples<br />
BTO BTC 5 BTC LMT 9000 GTC    # bitcion<br />
LONG USD 10 %PORTFOLIO MKT<br />
</code></div>
</div>
<br />
<span style="font-size: x-large;" class="mycode_size">Quantity and Price Precision</span><br />
Since it's possible to purchase fractional quantities with currencies, each currency trading pair has its own unique <span style="font-weight: bold;" class="mycode_b">min tick</span> size designated by the broker. Since the pairs we are trading are fixed, e.g. we can BTC-USD (and not USD-BTC), there is a precision specified on the quantity of BTC (8 decimal places) and a precision specified on price in USD (2 decimal places). You can view both the quantity and price precision for each trading pair in the <span style="font-weight: bold;" class="mycode_b">currency info</span> tab in your account settings (when you are connected to your broker).<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Min Currency Quantities for Positions</span><br />
In Currency trading, it is often not possible to completely close your position in a currency (i.e. it's hard to make your position exactly 0). However, when you close your position, APM will consider your position <span style="font-weight: bold;" class="mycode_b">neutral</span> if the final balance is small enough. For Crypto trading, this threshold is when your position is less than &#36;1 USD. For FX trading in IB, this threshold is when your position is less than &#36;50 USD.<br />
<br />
Note that sometimes in IB, a close order may not be able to shrink a position past this &#36;50 threshold. This is rare, but when it does happen, you will have to enter another CLOSE or close the position manually in order to free up the ticker from the strategy.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Brokers</span><br />
<span style="font-size: large;" class="mycode_size">Interactive Brokers</span><ul class="mycode_list"><li>You can use the same IB gateway as for stock trading, just make sure the client IDs are different in APM if you want to trade both stocks and FX at the same time. By default stock trading has client ID 0 and FX has client ID 1.<br />
</li>
<li>Base currencies: USD, AUD, EUR, GBP, CAD<br />
</li>
</ul>
<br />
<span style="font-size: large;" class="mycode_size">Binance and Binance US</span><ul class="mycode_list"><li>Only non-margin trading as of now<br />
</li>
<li>STPLMT and LIT orders are converted to LMT orders if the target price is already met. Otherwise, Binance rejects these orders if we leave them as STPLMT/LIT<br />
</li>
<li>Alera STP and TGT orders cannot both be in the market at the same time because of margin restrictions. To resolve this, APM will swap between STP and TGT orders depending on which is closer to being executed.<br />
</li>
<li>No fee for <span style="font-weight: bold;" class="mycode_b">cancelling</span> orders, so we can get around any potential problems caused by the above points by internally managing orders<br />
</li>
<li>Base currencies: USD (only Binance US), EUR (only Binance), USDT, BTC<br />
</li>
</ul>
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Conditional Signals (REL/RES/RSN/OTS/OTL)]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=132</link>
			<pubDate>Wed, 15 Jul 2020 01:45:12 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=132</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Conditional Orders</span><br />
These orders allow users to automatically place orders that will enter and exit positions given certain conditions.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">On-Trigger Signals</span><br />
Allows you to preemptively place an order to modify a position once it opens. These are useful for when you want to place two orders in the market, but you only want the second order to be placed after the first is executed. You can also use them to automatically place orders to close positions.<br />
<br />
<span style="font-size: large;" class="mycode_size">On-Trigger Long (OTL)</span><ul class="mycode_list"><li>Signal to go long a specified amount as soon as a position opens<br />
</li>
<li>If there is currently a position, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing OTL order can be cancelled by sending an OTL order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like OTL SPY ID 200 won't cancel the order)<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">On-Trigger Short (OTS)</span><ul class="mycode_list"><li>Signal to go short a specified amount as soon as a position opens<br />
</li>
<li>If there is currently a position, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing OTS order can be cancelled by sending an OTS order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like OTL SPY ID 200 won't cancel the order)<br />
</li>
</ul>
The following will double our position if the initial BTO order is executed. Note that the OTL order is placed FIRST in case the BTO order executes immediately.<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>OTL AAPL 200 %POSITION LMT 90  ID 200 <br />
BTO AAPL 10 SHARES LMT 100<br />
</code></div>
</div>
<br />
<span style="font-size: large;" class="mycode_size">ReSet to Neutral (RSN)</span><ul class="mycode_list"><li>Signal to close a position as soon it opens<br />
</li>
<li>If there is currently a position, this signal will become a CLOSE order immediately<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing RSN order can be cancelled by sending a RSN order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like RSN SPY ID 200 won't cancel the order)<br />
</li>
</ul>
The following will place a CLOSE AAPL MOC DAY order if the initial AAPL position opens<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>BTO AAPL LMT 100<br />
RSN AAPL MOC DAY ID 200<br />
</code></div>
</div>
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">ReEnter Signals</span><br />
Allows you to preemptively place an order to re-enter the market once the original position in a stock is closed. This may be useful if you want to maintain a long-term position in a stock, but you think it will go down. Hence, you can put a CLOSE LMT order to close the position and a REL LMT order to re-enter the position at lower price.<br />
<br />
<span style="font-size: large;" class="mycode_size">ReEnter Long (REL)</span><ul class="mycode_list"><li>Signal to re-enter a long position as soon as it is closed<br />
</li>
<li>If the current position is not long, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing REL order can be cancelled by sending a REL order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like REL SPY ID 200 won't cancel the order)<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">ReEnter Short (RES)</span><ul class="mycode_list"><li>Signal to re-enter a short position as soon as it is closed<br />
</li>
<li>If the current position is not short, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing RES order can be cancelled by sending a RES order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like RES SPY ID 200 won't cancel the order)<br />
</li>
</ul>
Suppose we are currently long AAPL. Then placing the order<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>REL AAPL LMT 100 ID 201</code></div>
</div>
will place an order BTO AAPL LMT 100 <span style="font-weight: bold;" class="mycode_b">when</span> our position in AAPL is closed. <br />
Note that a closing order(CLOSE/STC/BTC) should be placed AFTER the REL order to ensure that the REL order is not ignored if the closing order is executed immediately.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Conditional Order Expiration Time</span><br />
Since it may be desirable to have REL/RES/RSN/OTL/OTS orders automatically cancelled after sometime, we have added a <span style="font-weight: bold;" class="mycode_b">Conditional Orders</span> section that allows you to do this in the Strategy Settings.<br />
<br />
Note that when you specify a Time In Force (TIF) in a Conditional Signal, that TIF is for the order that will be placed, not the Conditional Signal itself. That means if you place<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>REL AAPL LMT 100 DAY ID 201</code></div>
</div>
then <span style="font-weight: bold;" class="mycode_b">IF</span> this limit order is placed, its TIF will be DAY. The Conditional Signal itself is not cancelled unless you specify a cancellation time in your strategy settings.<br />
<br />
The expiration time format is simply <span style="font-weight: bold;" class="mycode_b">hh:mm<img src="https://aleratrading.com/forum/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />s zzz</span> where zzz is the timezone, e.g. <span style="font-weight: bold;" class="mycode_b">15:30:00 EST</span><br />
<br />
<span style="font-size: x-large;" class="mycode_size">Notes</span><ul class="mycode_list"><li>The signals you place with RSN/REL/RES/OTL/OTS actions work exactly the same as regular signals. That means that all parameters (like price, order type, TIF) will be stored and passed onto the signal that may eventually be placed as an order.<br />
</li>
</ul>
]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Conditional Orders</span><br />
These orders allow users to automatically place orders that will enter and exit positions given certain conditions.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">On-Trigger Signals</span><br />
Allows you to preemptively place an order to modify a position once it opens. These are useful for when you want to place two orders in the market, but you only want the second order to be placed after the first is executed. You can also use them to automatically place orders to close positions.<br />
<br />
<span style="font-size: large;" class="mycode_size">On-Trigger Long (OTL)</span><ul class="mycode_list"><li>Signal to go long a specified amount as soon as a position opens<br />
</li>
<li>If there is currently a position, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing OTL order can be cancelled by sending an OTL order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like OTL SPY ID 200 won't cancel the order)<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">On-Trigger Short (OTS)</span><ul class="mycode_list"><li>Signal to go short a specified amount as soon as a position opens<br />
</li>
<li>If there is currently a position, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing OTS order can be cancelled by sending an OTS order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like OTL SPY ID 200 won't cancel the order)<br />
</li>
</ul>
The following will double our position if the initial BTO order is executed. Note that the OTL order is placed FIRST in case the BTO order executes immediately.<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>OTL AAPL 200 %POSITION LMT 90  ID 200 <br />
BTO AAPL 10 SHARES LMT 100<br />
</code></div>
</div>
<br />
<span style="font-size: large;" class="mycode_size">ReSet to Neutral (RSN)</span><ul class="mycode_list"><li>Signal to close a position as soon it opens<br />
</li>
<li>If there is currently a position, this signal will become a CLOSE order immediately<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing RSN order can be cancelled by sending a RSN order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like RSN SPY ID 200 won't cancel the order)<br />
</li>
</ul>
The following will place a CLOSE AAPL MOC DAY order if the initial AAPL position opens<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>BTO AAPL LMT 100<br />
RSN AAPL MOC DAY ID 200<br />
</code></div>
</div>
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">ReEnter Signals</span><br />
Allows you to preemptively place an order to re-enter the market once the original position in a stock is closed. This may be useful if you want to maintain a long-term position in a stock, but you think it will go down. Hence, you can put a CLOSE LMT order to close the position and a REL LMT order to re-enter the position at lower price.<br />
<br />
<span style="font-size: large;" class="mycode_size">ReEnter Long (REL)</span><ul class="mycode_list"><li>Signal to re-enter a long position as soon as it is closed<br />
</li>
<li>If the current position is not long, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing REL order can be cancelled by sending a REL order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like REL SPY ID 200 won't cancel the order)<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">ReEnter Short (RES)</span><ul class="mycode_list"><li>Signal to re-enter a short position as soon as it is closed<br />
</li>
<li>If the current position is not short, this signal will be ignored<br />
</li>
<li><span style="font-weight: bold;" class="mycode_b">Requires</span> a signal ID to be processed<br />
</li>
<li>An existing RES order can be cancelled by sending a RES order with quantity 0 (<span style="font-weight: bold;" class="mycode_b">MUST</span> specify 0 SHARES; something like RES SPY ID 200 won't cancel the order)<br />
</li>
</ul>
Suppose we are currently long AAPL. Then placing the order<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>REL AAPL LMT 100 ID 201</code></div>
</div>
will place an order BTO AAPL LMT 100 <span style="font-weight: bold;" class="mycode_b">when</span> our position in AAPL is closed. <br />
Note that a closing order(CLOSE/STC/BTC) should be placed AFTER the REL order to ensure that the REL order is not ignored if the closing order is executed immediately.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Conditional Order Expiration Time</span><br />
Since it may be desirable to have REL/RES/RSN/OTL/OTS orders automatically cancelled after sometime, we have added a <span style="font-weight: bold;" class="mycode_b">Conditional Orders</span> section that allows you to do this in the Strategy Settings.<br />
<br />
Note that when you specify a Time In Force (TIF) in a Conditional Signal, that TIF is for the order that will be placed, not the Conditional Signal itself. That means if you place<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>REL AAPL LMT 100 DAY ID 201</code></div>
</div>
then <span style="font-weight: bold;" class="mycode_b">IF</span> this limit order is placed, its TIF will be DAY. The Conditional Signal itself is not cancelled unless you specify a cancellation time in your strategy settings.<br />
<br />
The expiration time format is simply <span style="font-weight: bold;" class="mycode_b">hh:mm<img src="https://aleratrading.com/forum/images/smilies/confused.png" alt="Confused" title="Confused" class="smilie smilie_13" />s zzz</span> where zzz is the timezone, e.g. <span style="font-weight: bold;" class="mycode_b">15:30:00 EST</span><br />
<br />
<span style="font-size: x-large;" class="mycode_size">Notes</span><ul class="mycode_list"><li>The signals you place with RSN/REL/RES/OTL/OTS actions work exactly the same as regular signals. That means that all parameters (like price, order type, TIF) will be stored and passed onto the signal that may eventually be placed as an order.<br />
</li>
</ul>
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Using Google Drive for Signals]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=101</link>
			<pubDate>Sun, 19 Apr 2020 22:51:06 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=101</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Using Google Drive for Signals</span><br />
You can connect APM to your Google Drive to pull signals from a specified folder. <br />
NOTE: Since APM requires read access to Google Drive, it is recommended that you create a new Google account if you do not wish to grant APM access to all your Google Drive files.<br />
<ul class="mycode_list"><li>Find or create the folder in Google Drive that will store the signals<br />
</li>
<li>Open the folder in your browser and copy the <span style="font-weight: bold;" class="mycode_b">Folder Id</span> from the URL (it is the last part of the URL, should look like in the image below)<br />
</li>
<li>Paste this <span style="font-weight: bold;" class="mycode_b">Folder Id</span> into the settings page and click <span style="font-weight: bold;" class="mycode_b">Save</span><br />
</li>
<li>The first time you do this, you will be redirected to your browser in order to login into your Google account<br />
</li>
<li>Allow Alera to have <span style="font-weight: bold;" class="mycode_b">readonly</span> access to your Google Drive. You may want to create a new Google account just to use with APM.<br />
</li>
<li>If you gave a correct <span style="font-weight: bold;" class="mycode_b">Folder Id</span>, then the settings will save, otherwise you will see an error in APM<br />
</li>
<li>To test that everything is working, place a signal file in the Google Drive folder and hit the folder button beside the Folder ID to view your files (or hit Order Preview)<br />
</li>
</ul>
<br />
<img src="http://aleratrading.com/forum/images/documentation/google_drive_example2.png" loading="lazy"  alt="[Image: google_drive_example2.png]" class="mycode_img" /><br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Posting Your Signals</span><br />
There are two main ways to post your signals to Google Drive<br />
<br />
<span style="font-size: medium;" class="mycode_size">Backup and Sync </span><br />
Use Google Backup and Sync to sync a local folder on your computer to your Google Drive. You can then write signals to this folder and they will automatically be uploaded to your Drive. <span style="font-weight: bold;" class="mycode_b">Note that Backup and Sync only recognizes file changes WHEN the file contents change. This means the last modified time on your file will not update when you change it locally on your computer, unless you change the file contents too. You can change file contents without modifying signals by adding a blank new line to the file.</span><br />
<br />
<span style="font-size: medium;" class="mycode_size">Google Drive API</span><br />
If you're familiar with programming, you can attempt to upload files to your Drive directly through your code.<br />
<br />
<span style="font-size: medium;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">*IMPORTANT*</span></span><br />
Google Drive only stores the last modified time up to one second accuracy AND since signal files are processed in the order of OLDEST to NEWEST, you need to make sure that your files are generated 2 seconds apart to ensure that they are processed in the desired order, e.g. process sell signals first, then buy signals. If you do not care about the order of your signals, then the last modified time does not matter.<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Sharing Your Signals</span><br />
Simply share your Google Drive folder with the desired party and have them use the same Folder ID in their APM instance.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Using Google Drive for Signals</span><br />
You can connect APM to your Google Drive to pull signals from a specified folder. <br />
NOTE: Since APM requires read access to Google Drive, it is recommended that you create a new Google account if you do not wish to grant APM access to all your Google Drive files.<br />
<ul class="mycode_list"><li>Find or create the folder in Google Drive that will store the signals<br />
</li>
<li>Open the folder in your browser and copy the <span style="font-weight: bold;" class="mycode_b">Folder Id</span> from the URL (it is the last part of the URL, should look like in the image below)<br />
</li>
<li>Paste this <span style="font-weight: bold;" class="mycode_b">Folder Id</span> into the settings page and click <span style="font-weight: bold;" class="mycode_b">Save</span><br />
</li>
<li>The first time you do this, you will be redirected to your browser in order to login into your Google account<br />
</li>
<li>Allow Alera to have <span style="font-weight: bold;" class="mycode_b">readonly</span> access to your Google Drive. You may want to create a new Google account just to use with APM.<br />
</li>
<li>If you gave a correct <span style="font-weight: bold;" class="mycode_b">Folder Id</span>, then the settings will save, otherwise you will see an error in APM<br />
</li>
<li>To test that everything is working, place a signal file in the Google Drive folder and hit the folder button beside the Folder ID to view your files (or hit Order Preview)<br />
</li>
</ul>
<br />
<img src="http://aleratrading.com/forum/images/documentation/google_drive_example2.png" loading="lazy"  alt="[Image: google_drive_example2.png]" class="mycode_img" /><br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Posting Your Signals</span><br />
There are two main ways to post your signals to Google Drive<br />
<br />
<span style="font-size: medium;" class="mycode_size">Backup and Sync </span><br />
Use Google Backup and Sync to sync a local folder on your computer to your Google Drive. You can then write signals to this folder and they will automatically be uploaded to your Drive. <span style="font-weight: bold;" class="mycode_b">Note that Backup and Sync only recognizes file changes WHEN the file contents change. This means the last modified time on your file will not update when you change it locally on your computer, unless you change the file contents too. You can change file contents without modifying signals by adding a blank new line to the file.</span><br />
<br />
<span style="font-size: medium;" class="mycode_size">Google Drive API</span><br />
If you're familiar with programming, you can attempt to upload files to your Drive directly through your code.<br />
<br />
<span style="font-size: medium;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">*IMPORTANT*</span></span><br />
Google Drive only stores the last modified time up to one second accuracy AND since signal files are processed in the order of OLDEST to NEWEST, you need to make sure that your files are generated 2 seconds apart to ensure that they are processed in the desired order, e.g. process sell signals first, then buy signals. If you do not care about the order of your signals, then the last modified time does not matter.<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Sharing Your Signals</span><br />
Simply share your Google Drive folder with the desired party and have them use the same Folder ID in their APM instance.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Alera API]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=89</link>
			<pubDate>Tue, 14 Apr 2020 15:58:52 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=89</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Alera API</span><br />
This guide explains how the Alera API works and how you can use it.<br />
Available with APM version 2.1.0+<br />
<br />
The Alera API allows you to:<ul class="mycode_list"><li>Send signals directly to the APM signal queue for immediate processing<br />
</li>
<li>Retrieve account and strategy settings programmatically<br />
</li>
<li>Retrieve current portfolio, order and trade information on a strategy by strategy basis<br />
</li>
</ul>
All of this is achieved through an HTTP endpoint.<br />
<br />
This feature is only available for fully automated licenses.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">HTTP Endpoints</span><br />
All end-points are prefixed with <span style="font-family: monospace;"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a>:&lt;port&gt;/api</span> where <span style="font-family: monospace;">&lt;port&gt;</span> is the API Port set up in the account setting page. <span style="font-weight: bold;" class="mycode_b">Don't forget to actually enable the API</span>. We've also gone ahead and prevented any traffic to the API from a non-local IP. This means you should only be accessing the API from the same computer that the APM runs on.<br />
<br />
Port 7425 is the default port and will be used throughout this document. Please make sure that you select a different port for each account when enabling the API for multiple accounts and that you are connected to the proper account.<br />
<br />
<table border="0" cellspacing="1" cellpadding="3" class="tborder" style="width:Summary%;">
<tr>
<th class="tcat" align="left"><strong>Type</strong></th>
<th class="tcat" align="left"><strong>URL</strong></th>
<th class="tcat" align="left"><strong>Description</strong></th>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/account?cmd=start</td>
<td class="trow1" valign="top" align="left">Start the account (connect to broker)</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/account?cmd=stop</td>
<td class="trow1" valign="top" align="left">Stop the account</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;</td>
<td class="trow1" valign="top" align="left">Add multiple signals to the queue</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;?cmd=run</td>
<td class="trow1" valign="top" align="left">Run this strategy</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/account</td>
<td class="trow1" valign="top" align="left">Get the account settings</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/account/stats/&lt;currency&gt;</td>
<td class="trow1" valign="top" align="left">Get the account stats</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies</td>
<td class="trow1" valign="top" align="left">Get the settings for all strategies</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;</td>
<td class="trow1" valign="top" align="left">Get the settings a specific strategy</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/portfolio/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the portfolio for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/orders/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the orders for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/trades/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the trades for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/reenter/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the ReEnter orders for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/stats</td>
<td class="trow1" valign="top" align="left">Get statistics for a strategy</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/symbols</td>
<td class="trow1" valign="top" align="left">Get a list of symbols assigned to the strategy by the APM</td>
</tr>
</table>
<br />
<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">HTTP POST Requests</span><br />
<br />
<span style="font-size: x-large;" class="mycode_size">Account</span><br />
These calls allow us to start/stop the account.<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account?cmd=start" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account?cmd=start</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: None<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account?cmd=stop" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account?cmd=stop</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: None<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Strategies</span><br />
This call allows the http client to send signals directly to APM for immediate processing. It requires the account to be running. <br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Signals</span></span><br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/strategies/" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/</a>&lt;id&gt;</span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>:<br />
<ul class="mycode_list"><li><span style="font-family: monospace;">Header:</span><ul class="mycode_list"><li><span style="font-family: monospace;">Content-Type: application/json</span><br />
</li>
</ul>
</li>
<li><span style="font-family: monospace;">Body:</span><ul class="mycode_list"><li><span style="font-family: monospace;">Key: “signals”</span><br />
</li>
<li><span style="font-family: monospace;">Value:</span> A string containing multiple lines with the same format as the flat signal files (i.e. each line contains one signal. Comments are allowed). Invalid signals will be ignored. No csv formatting supported at this time.<br />
</li>
</ul>
</li>
</ul>
The response will be a list that contains only the signals with a valid format that were sent to the signal queue. The execution can be monitored via the  log tab.<br />
<br />
<span style="font-size: large;" class="mycode_size">Example</span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code>URL: <a href="http://localhost:7425/api/strategies/1002" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002</a><br />
Header: Content-Type: application/json<br />
Body:{"signals":"<br />
    # This is just a comment<br />
    BTO SPY<br />
    LONG IVV 20 %position <br />
    SHORT DELL 100 shares LMT 45<br />
"}<br />
<br />
Response:<br />
BTO SPY<br />
LONG IVV 20 %POSITION<br />
SHORT DELL 100 SHARES LMT 45<br />
</code></div>
</div>
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Run Strategy</span></span><br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/strategies/" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/</a>&lt;id&gt;?cmd=run</span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: None<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/strategies/1011?cmd=run" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1011?cmd=run</a><br />
</code></div>
</div>
<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">HTTP GET Requests</span><br />
<br />
<span style="font-size: x-large;" class="mycode_size">Account</span><br />
This call returns the account settings that were setup in the APM user interface.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: NONE<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account/stats" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account/stats</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>:<ul class="mycode_list"><li><span style="font-family: monospace;">Currency:</span><ul class="mycode_list"><li>This is the <span style="font-weight: bold;" class="mycode_b">currency</span> you wish to receive the account stats in. Note that only valid strategy base currencies can be used here.<br />
</li>
<li>This field is optional. Not providing it retrieves the stats in your account's base currency.<br />
</li>
</ul>
</li>
</ul>
<br />
<span style="font-size: x-large;" class="mycode_size">Strategies</span><br />
This call returns information regarding the strategies setup in the APM user interface.<br />
Any call to a specific strategy requires the account to be running.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/strategies" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>:<ul class="mycode_list"><li><span style="font-family: monospace;">Id:</span><ul class="mycode_list"><li>This is the <span style="font-weight: bold;" class="mycode_b">strategyId</span> of the strategy you wish to query. Usually a 4 digit number (e.g. 1002)<br />
</li>
<li>If no strategy with this id exists, the call returns Bad Request and an error message <br />
</li>
</ul>
</li>
<li><span style="font-family: monospace;">Info:</span><ul class="mycode_list"><li>This parameter is used to specify the type of information that is requested for a specific strategy<br />
</li>
<li>The following values are valid:<ul class="mycode_list"><li><span style="font-family: monospace;">Portfolio</span> - returns the current portfolio<br />
</li>
<li><span style="font-family: monospace;">Orders</span>  - returns all active orders. This includes the Stop and Target orders. The ReEnter orders are not listed here as they are not active in the market.<br />
</li>
<li><span style="font-family: monospace;">ReEnter</span> - returns all ReEnter orders<br />
</li>
<li><span style="font-family: monospace;">Trades</span>  - returns the trades executed in the last 24 hours<br />
</li>
<li><span style="font-family: monospace;">Stats</span>    - returns the strategy statistics <br />
</li>
<li><span style="font-family: monospace;">Symbols</span> - return a list of symbols assigned to the strategy (you do <span style="font-weight: bold;" class="mycode_b">not</span> necessarily hold positions for assigned symbols)<br />
</li>
</ul>
</li>
</ul>
</li>
<li><span style="font-family: monospace;">Format:</span><ul class="mycode_list"><li>The response for <span style="font-family: monospace;">Portfolio, Orders, ReEnter, Trades</span> can be requested in two different formats (<span style="font-weight: bold;" class="mycode_b">optional</span>: default <span style="font-family: monospace;">Text</span>)<ul class="mycode_list"><li><span style="font-family: monospace;">JSON</span> - returns a list of JSON formatted objects<br />
</li>
<li><span style="font-family: monospace;">Text</span> - returns a nicely formatted string (use this for displaying info)<br />
</li>
</ul>
</li>
<li>The response for <span style="font-family: monospace;">Symbols, Stats</span> come in JSON format (see examples below)<br />
</li>
</ul>
</li>
</ul>
<br />
If no parameters are specified, the GET request returns <span style="font-weight: bold;" class="mycode_b">settings</span> information for all strategies.<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">GET Examples</span><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Settings</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/account" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account</a><br />
<a href="http://localhost:7425/api/strategies" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies</a><br />
</code></div>
</div>
The outputs for these are not specified here since there are a lot of settings.<br />
If you want to use this information, we suggest you look at the output yourself and determine what information you might want to use.<br />
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Orders</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code>URL:  <a href="http://localhost:7425/api/strategies/1002/orders" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/orders</a><br />
Response:<br />
[<br />
  {<br />
    "Symbol": "QQQ",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Action": "SELL",<br />
    "Type": "TGT",<br />
    "Quantity": 100.0,<br />
    "TimeInForce": "GTC",<br />
    "LimitPrice": null,<br />
    "StopPrice": null,<br />
    "TargetPrice": 215.5,<br />
    "TrailingPercent": null<br />
  },<br />
  {<br />
    "Symbol": "QQQ",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Action": "SELL",<br />
    "Type": "STP",<br />
    "Quantity": 100.0,<br />
    "TimeInForce": "GTC",<br />
    "LimitPrice": null,<br />
    "StopPrice": 195.36,<br />
    "TargetPrice": null,<br />
    "TrailingPercent": null<br />
  },<br />
]<br />
</code></div>
</div>
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>URL: http://localhost:7425/api/strategies/1002/orders/text<br />
<br />
Response:<br />
 ORDERS    Action   Quantity   Type    Limit       %    TIF       ID <br />
-------------------------------------------------------------------<br />
  1.   QQQ   SELL        100    TGT   215.50            GTC<br />
  2.   QQQ   SELL        100    STP   195.36            GTC<br />
  3.  SVXY   SELL        917    MKT                     DAY<br />
  4.   TLT   SELL      1,000    STP   160.47            GTC<br />
  5.   TLT   SELL      1,000    TGT   177.01            GTC<br />
  6.   TLT   SELL      1,018    LOC   100.00            DAY<br />
  7.  TSLA    BUY         80    TGT   551.95            GTC<br />
  8.  TSLA    BUY         80    STP   611.31            GTC<br />
  9.  TSLA    BUY         49    MKT                     DAY<br />
 10.   USD    BUY        370    MKT                     DAY<br />
-------------------------------------------------------------------</code></div></div>The following two URLs also produce the above result:<br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/strategies/1002/orders" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/orders</a><br />
<a href="http://localhost:7425/api/strategies?id=1002&amp;info=orders&amp;format=text" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies?id=...ormat=text</a></code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">ReEnter Orders</span></span><br />
The responses to these requests are the same as regular order requests:<br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/strategies/1002/reenter" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/reenter</a><br />
<a href="http://localhost:7425/api/strategies/1002/reenter/json" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/reenter/json</a><br />
<a href="http://localhost:7425/api/strategies/1002/reenter/text" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/reenter/text</a></code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Portfolio</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code>URL: <a href="http://localhost:7425/api/strategies/1002/portfolio" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/portfolio</a><br />
<br />
Response:<br />
[<br />
  {<br />
    "Symbol": "QQQ",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Quantity": 100.0,<br />
    "Exposure": "LONG",<br />
    "MarketPrice": 201.3999939,<br />
    "MarketValue": 20140.0,<br />
    "AverageCost": 216.555,<br />
    "UnrealizedPNL": -1515.5,<br />
    "RealizedPNL": null,<br />
    "Hold": null<br />
  },<br />
  {<br />
    "Symbol": "SVXY",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Quantity": 917.0,<br />
    "Exposure": "LONG",<br />
    "MarketPrice": 32.54999925,<br />
    "MarketValue": 29848.35,<br />
    "AverageCost": 53.88827155,<br />
    "UnrealizedPNL": -19567.2,<br />
    "RealizedPNL": null,<br />
    "Hold": null<br />
  },<br />
]</code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Trades</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code> URL: <a href="http://localhost:7425/api/strategies/1002/symbols" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/symbols</a><br />
<br />
Response:<br />
[<br />
   {<br />
    "Symbol": "GS",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Side": "BOT",<br />
    "Quantity": 181.0,<br />
    "AveragePrice": 183.21,<br />
    "Value": 33161.01,<br />
    "Time": "20200413  10:30:32"<br />
  },<br />
  {<br />
    "Symbol": "GS",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Side": "BOT",<br />
    "Quantity": 46.0,<br />
    "AveragePrice": 183.38,<br />
    "Value": 8435.48,<br />
    "Time": "20200413  10:33:14"<br />
  },<br />
]</code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Symbols</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code> URL: <a href="http://localhost:7425/api/strategies/1002/symbols" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/symbols</a><br />
<br />
Response: <br />
["QQQ","SVXY","TLT","TSLA"]<br />
</code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Strategy Stats</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code> URL: <a href="http://localhost:7425/api/strategies/1002/stats" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/stats</a><br />
<br />
Response:<br />
{  <br />
    "Allocation": 550000,<br />
    "LongExposure": 383826.07999999996,<br />
    "ShortExposure": -76561.5,<br />
    "NumberOfLongPositions": 3,<br />
    "NumberOfShortPositions": 1,<br />
    "LongPNL": 20382.74,<br />
    "ShortPNL": 23753.41,<br />
    "NetExposure": 307264.57999999996,<br />
    "TotalExposure": 460387.57999999996,<br />
    "TotalNumberOfPositions": 4,<br />
    "TotalPNL": 44136.15<br />
}</code></div>
</div>]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Alera API</span><br />
This guide explains how the Alera API works and how you can use it.<br />
Available with APM version 2.1.0+<br />
<br />
The Alera API allows you to:<ul class="mycode_list"><li>Send signals directly to the APM signal queue for immediate processing<br />
</li>
<li>Retrieve account and strategy settings programmatically<br />
</li>
<li>Retrieve current portfolio, order and trade information on a strategy by strategy basis<br />
</li>
</ul>
All of this is achieved through an HTTP endpoint.<br />
<br />
This feature is only available for fully automated licenses.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">HTTP Endpoints</span><br />
All end-points are prefixed with <span style="font-family: monospace;"><a href="http://localhost" target="_blank" rel="noopener" class="mycode_url">http://localhost</a>:&lt;port&gt;/api</span> where <span style="font-family: monospace;">&lt;port&gt;</span> is the API Port set up in the account setting page. <span style="font-weight: bold;" class="mycode_b">Don't forget to actually enable the API</span>. We've also gone ahead and prevented any traffic to the API from a non-local IP. This means you should only be accessing the API from the same computer that the APM runs on.<br />
<br />
Port 7425 is the default port and will be used throughout this document. Please make sure that you select a different port for each account when enabling the API for multiple accounts and that you are connected to the proper account.<br />
<br />
<table border="0" cellspacing="1" cellpadding="3" class="tborder" style="width:Summary%;">
<tr>
<th class="tcat" align="left"><strong>Type</strong></th>
<th class="tcat" align="left"><strong>URL</strong></th>
<th class="tcat" align="left"><strong>Description</strong></th>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/account?cmd=start</td>
<td class="trow1" valign="top" align="left">Start the account (connect to broker)</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/account?cmd=stop</td>
<td class="trow1" valign="top" align="left">Stop the account</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;</td>
<td class="trow1" valign="top" align="left">Add multiple signals to the queue</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: red;" class="mycode_color">POST</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;?cmd=run</td>
<td class="trow1" valign="top" align="left">Run this strategy</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/account</td>
<td class="trow1" valign="top" align="left">Get the account settings</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/account/stats/&lt;currency&gt;</td>
<td class="trow1" valign="top" align="left">Get the account stats</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies</td>
<td class="trow1" valign="top" align="left">Get the settings for all strategies</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;</td>
<td class="trow1" valign="top" align="left">Get the settings a specific strategy</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/portfolio/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the portfolio for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/orders/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the orders for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/trades/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the trades for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/reenter/&lt;format&gt;</td>
<td class="trow1" valign="top" align="left">Get the ReEnter orders for a strategy as text or json</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/stats</td>
<td class="trow1" valign="top" align="left">Get statistics for a strategy</td>
</tr>
<tr>
<td class="trow1" valign="top" align="left"><span style="color: blue;" class="mycode_color">GET</span></td>
<td class="trow1" valign="top" align="left">api/strategies/&lt;id&gt;/symbols</td>
<td class="trow1" valign="top" align="left">Get a list of symbols assigned to the strategy by the APM</td>
</tr>
</table>
<br />
<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">HTTP POST Requests</span><br />
<br />
<span style="font-size: x-large;" class="mycode_size">Account</span><br />
These calls allow us to start/stop the account.<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account?cmd=start" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account?cmd=start</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: None<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account?cmd=stop" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account?cmd=stop</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: None<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Strategies</span><br />
This call allows the http client to send signals directly to APM for immediate processing. It requires the account to be running. <br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Signals</span></span><br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/strategies/" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/</a>&lt;id&gt;</span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>:<br />
<ul class="mycode_list"><li><span style="font-family: monospace;">Header:</span><ul class="mycode_list"><li><span style="font-family: monospace;">Content-Type: application/json</span><br />
</li>
</ul>
</li>
<li><span style="font-family: monospace;">Body:</span><ul class="mycode_list"><li><span style="font-family: monospace;">Key: “signals”</span><br />
</li>
<li><span style="font-family: monospace;">Value:</span> A string containing multiple lines with the same format as the flat signal files (i.e. each line contains one signal. Comments are allowed). Invalid signals will be ignored. No csv formatting supported at this time.<br />
</li>
</ul>
</li>
</ul>
The response will be a list that contains only the signals with a valid format that were sent to the signal queue. The execution can be monitored via the  log tab.<br />
<br />
<span style="font-size: large;" class="mycode_size">Example</span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code>URL: <a href="http://localhost:7425/api/strategies/1002" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002</a><br />
Header: Content-Type: application/json<br />
Body:{"signals":"<br />
    # This is just a comment<br />
    BTO SPY<br />
    LONG IVV 20 %position <br />
    SHORT DELL 100 shares LMT 45<br />
"}<br />
<br />
Response:<br />
BTO SPY<br />
LONG IVV 20 %POSITION<br />
SHORT DELL 100 SHARES LMT 45<br />
</code></div>
</div>
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Run Strategy</span></span><br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/strategies/" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/</a>&lt;id&gt;?cmd=run</span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: None<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/strategies/1011?cmd=run" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1011?cmd=run</a><br />
</code></div>
</div>
<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">HTTP GET Requests</span><br />
<br />
<span style="font-size: x-large;" class="mycode_size">Account</span><br />
This call returns the account settings that were setup in the APM user interface.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>: NONE<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/account/stats" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account/stats</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>:<ul class="mycode_list"><li><span style="font-family: monospace;">Currency:</span><ul class="mycode_list"><li>This is the <span style="font-weight: bold;" class="mycode_b">currency</span> you wish to receive the account stats in. Note that only valid strategy base currencies can be used here.<br />
</li>
<li>This field is optional. Not providing it retrieves the stats in your account's base currency.<br />
</li>
</ul>
</li>
</ul>
<br />
<span style="font-size: x-large;" class="mycode_size">Strategies</span><br />
This call returns information regarding the strategies setup in the APM user interface.<br />
Any call to a specific strategy requires the account to be running.<br />
<br />
<span style="font-weight: bold;" class="mycode_b">Endpoint</span>: <span style="font-family: monospace;"><a href="http://localhost:7425/api/strategies" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies</a></span><br />
<span style="font-weight: bold;" class="mycode_b">Parameters</span>:<ul class="mycode_list"><li><span style="font-family: monospace;">Id:</span><ul class="mycode_list"><li>This is the <span style="font-weight: bold;" class="mycode_b">strategyId</span> of the strategy you wish to query. Usually a 4 digit number (e.g. 1002)<br />
</li>
<li>If no strategy with this id exists, the call returns Bad Request and an error message <br />
</li>
</ul>
</li>
<li><span style="font-family: monospace;">Info:</span><ul class="mycode_list"><li>This parameter is used to specify the type of information that is requested for a specific strategy<br />
</li>
<li>The following values are valid:<ul class="mycode_list"><li><span style="font-family: monospace;">Portfolio</span> - returns the current portfolio<br />
</li>
<li><span style="font-family: monospace;">Orders</span>  - returns all active orders. This includes the Stop and Target orders. The ReEnter orders are not listed here as they are not active in the market.<br />
</li>
<li><span style="font-family: monospace;">ReEnter</span> - returns all ReEnter orders<br />
</li>
<li><span style="font-family: monospace;">Trades</span>  - returns the trades executed in the last 24 hours<br />
</li>
<li><span style="font-family: monospace;">Stats</span>    - returns the strategy statistics <br />
</li>
<li><span style="font-family: monospace;">Symbols</span> - return a list of symbols assigned to the strategy (you do <span style="font-weight: bold;" class="mycode_b">not</span> necessarily hold positions for assigned symbols)<br />
</li>
</ul>
</li>
</ul>
</li>
<li><span style="font-family: monospace;">Format:</span><ul class="mycode_list"><li>The response for <span style="font-family: monospace;">Portfolio, Orders, ReEnter, Trades</span> can be requested in two different formats (<span style="font-weight: bold;" class="mycode_b">optional</span>: default <span style="font-family: monospace;">Text</span>)<ul class="mycode_list"><li><span style="font-family: monospace;">JSON</span> - returns a list of JSON formatted objects<br />
</li>
<li><span style="font-family: monospace;">Text</span> - returns a nicely formatted string (use this for displaying info)<br />
</li>
</ul>
</li>
<li>The response for <span style="font-family: monospace;">Symbols, Stats</span> come in JSON format (see examples below)<br />
</li>
</ul>
</li>
</ul>
<br />
If no parameters are specified, the GET request returns <span style="font-weight: bold;" class="mycode_b">settings</span> information for all strategies.<br />
<br />
<br />
<span style="font-size: x-large;" class="mycode_size">GET Examples</span><br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Settings</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/account" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/account</a><br />
<a href="http://localhost:7425/api/strategies" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies</a><br />
</code></div>
</div>
The outputs for these are not specified here since there are a lot of settings.<br />
If you want to use this information, we suggest you look at the output yourself and determine what information you might want to use.<br />
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Orders</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code>URL:  <a href="http://localhost:7425/api/strategies/1002/orders" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/orders</a><br />
Response:<br />
[<br />
  {<br />
    "Symbol": "QQQ",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Action": "SELL",<br />
    "Type": "TGT",<br />
    "Quantity": 100.0,<br />
    "TimeInForce": "GTC",<br />
    "LimitPrice": null,<br />
    "StopPrice": null,<br />
    "TargetPrice": 215.5,<br />
    "TrailingPercent": null<br />
  },<br />
  {<br />
    "Symbol": "QQQ",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Action": "SELL",<br />
    "Type": "STP",<br />
    "Quantity": 100.0,<br />
    "TimeInForce": "GTC",<br />
    "LimitPrice": null,<br />
    "StopPrice": 195.36,<br />
    "TargetPrice": null,<br />
    "TrailingPercent": null<br />
  },<br />
]<br />
</code></div>
</div>
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>URL: http://localhost:7425/api/strategies/1002/orders/text<br />
<br />
Response:<br />
 ORDERS    Action   Quantity   Type    Limit       %    TIF       ID <br />
-------------------------------------------------------------------<br />
  1.   QQQ   SELL        100    TGT   215.50            GTC<br />
  2.   QQQ   SELL        100    STP   195.36            GTC<br />
  3.  SVXY   SELL        917    MKT                     DAY<br />
  4.   TLT   SELL      1,000    STP   160.47            GTC<br />
  5.   TLT   SELL      1,000    TGT   177.01            GTC<br />
  6.   TLT   SELL      1,018    LOC   100.00            DAY<br />
  7.  TSLA    BUY         80    TGT   551.95            GTC<br />
  8.  TSLA    BUY         80    STP   611.31            GTC<br />
  9.  TSLA    BUY         49    MKT                     DAY<br />
 10.   USD    BUY        370    MKT                     DAY<br />
-------------------------------------------------------------------</code></div></div>The following two URLs also produce the above result:<br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/strategies/1002/orders" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/orders</a><br />
<a href="http://localhost:7425/api/strategies?id=1002&amp;info=orders&amp;format=text" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies?id=...ormat=text</a></code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">ReEnter Orders</span></span><br />
The responses to these requests are the same as regular order requests:<br />
<div class="codeblock">
<div class="body" dir="ltr"><code><a href="http://localhost:7425/api/strategies/1002/reenter" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/reenter</a><br />
<a href="http://localhost:7425/api/strategies/1002/reenter/json" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/reenter/json</a><br />
<a href="http://localhost:7425/api/strategies/1002/reenter/text" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/reenter/text</a></code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Portfolio</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code>URL: <a href="http://localhost:7425/api/strategies/1002/portfolio" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/portfolio</a><br />
<br />
Response:<br />
[<br />
  {<br />
    "Symbol": "QQQ",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Quantity": 100.0,<br />
    "Exposure": "LONG",<br />
    "MarketPrice": 201.3999939,<br />
    "MarketValue": 20140.0,<br />
    "AverageCost": 216.555,<br />
    "UnrealizedPNL": -1515.5,<br />
    "RealizedPNL": null,<br />
    "Hold": null<br />
  },<br />
  {<br />
    "Symbol": "SVXY",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Quantity": 917.0,<br />
    "Exposure": "LONG",<br />
    "MarketPrice": 32.54999925,<br />
    "MarketValue": 29848.35,<br />
    "AverageCost": 53.88827155,<br />
    "UnrealizedPNL": -19567.2,<br />
    "RealizedPNL": null,<br />
    "Hold": null<br />
  },<br />
]</code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Trades</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code> URL: <a href="http://localhost:7425/api/strategies/1002/symbols" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/symbols</a><br />
<br />
Response:<br />
[<br />
   {<br />
    "Symbol": "GS",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Side": "BOT",<br />
    "Quantity": 181.0,<br />
    "AveragePrice": 183.21,<br />
    "Value": 33161.01,<br />
    "Time": "20200413  10:30:32"<br />
  },<br />
  {<br />
    "Symbol": "GS",<br />
    "Currency": "USD",<br />
    "Country": "US",<br />
    "Side": "BOT",<br />
    "Quantity": 46.0,<br />
    "AveragePrice": 183.38,<br />
    "Value": 8435.48,<br />
    "Time": "20200413  10:33:14"<br />
  },<br />
]</code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Symbols</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code> URL: <a href="http://localhost:7425/api/strategies/1002/symbols" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/symbols</a><br />
<br />
Response: <br />
["QQQ","SVXY","TLT","TSLA"]<br />
</code></div>
</div>
<br />
<br />
<span style="font-size: large;" class="mycode_size"><span style="font-weight: bold;" class="mycode_b">Strategy Stats</span></span><br />
<div class="codeblock">
<div class="body" dir="ltr"><code> URL: <a href="http://localhost:7425/api/strategies/1002/stats" target="_blank" rel="noopener" class="mycode_url">http://localhost:7425/api/strategies/1002/stats</a><br />
<br />
Response:<br />
{  <br />
    "Allocation": 550000,<br />
    "LongExposure": 383826.07999999996,<br />
    "ShortExposure": -76561.5,<br />
    "NumberOfLongPositions": 3,<br />
    "NumberOfShortPositions": 1,<br />
    "LongPNL": 20382.74,<br />
    "ShortPNL": 23753.41,<br />
    "NetExposure": 307264.57999999996,<br />
    "TotalExposure": 460387.57999999996,<br />
    "TotalNumberOfPositions": 4,<br />
    "TotalPNL": 44136.15<br />
}</code></div>
</div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Hedging]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=56</link>
			<pubDate>Sat, 03 Aug 2019 23:23:55 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=56</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Hedging</span><br />
As of version 1.1, we have added the ability to hedge a strategy through <span style="font-weight: bold;" class="mycode_b">hedging actions</span>. The idea is that a user can now place an order based on their strategy's long/short exposure, which essentially grants the ability to hedge a strategy with some asset.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Hedging Actions</span><br />
The two hedging actions are <span style="font-weight: bold;" class="mycode_b">Hedge With Exposure(HWE)</span> and <span style="font-weight: bold;" class="mycode_b">Hedge Against Exposure(HAE)</span>, which each act as their name suggests.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Hedging Unit Types</span><br />
These hedging actions can only be used with some specific <span style="font-weight: bold;" class="mycode_b">hedging unit types</span>, that each behave slightly differently.<br />
<br />
<span style="font-size: large;" class="mycode_size">Percent of Long Exposure (%LONGEXP)</span><ul class="mycode_list"><li>Open a position based on only the long exposure of your strategy (i.e. sum of the exposure of all your long stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going long, and HAE means you will be going short<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Short Exposure (%SHORTEXP)</span><ul class="mycode_list"><li>Open a position based on only the short exposure of your strategy (i.e. sum of the exposure of all your short stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going short, and HAE means you will be going long<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Net Exposure (%NETEXP)</span><ul class="mycode_list"><li>Open a position based on the net exposure of your strategy (i.e. long exposure - short exposure)<br />
</li>
<li>Note that in this case, HWE and HAE don't necessarily mean you will go long or short (see below for examples)<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Account Long Exposure (%ACCTLONGEXP)</span><ul class="mycode_list"><li>Open a position based on only the long exposure of all your strategies (i.e. sum of the exposure of all your long stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going long, and HAE means you will be going short<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Account Short Exposure (%ACCTSHORTEXP)</span><ul class="mycode_list"><li>Open a position based on only the short exposure of all your strategies (i.e. sum of the exposure of all your short stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going short, and HAE means you will be going long<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Account Net Exposure (%ACCTNETEXP)</span><ul class="mycode_list"><li>Open a position based on the net exposure of all your strategies (i.e. long exposure - short exposure)<br />
</li>
<li>Note that in this case, HWE and HAE don't necessarily mean you will go long or short (see below for examples)<br />
</li>
</ul>
<br />
<span style="font-size: x-large;" class="mycode_size">Examples</span><br />
Each strategy below examines what happens when hedging with different types of portfolios.<br />
Note that hedging actions still support the different order types, time in force, prices, etc. that regular actions support. For the purpose of these examples, we are using simple signals.<br />
Strategy 1 and 2 are basic cases, but please go over them briefly.<br />
We highly recommend you read the examples under Strategy 3, so you can understand exactly how hedging is handled in APM.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy 1</span><br />
Suppose our current strategy contains the stocks:<br />
AAPL (long &#36;10,000)<br />
IBM (long &#36;5,000)<br />
MSFT (short &#36;4,000)<br />
<br />
Now we will look at what happens with various signals:<br />
<br />
1) Use SH (Proshares Short ETF) to hedge with our long exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %LONGEXP</code></div>
</div>
We are long &#36;15,000, so we would go LONG &#36;7,500 of SH.<br />
<br />
2) Use SH to hedge with our short exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %SHORTEXP</code></div>
</div>
We are short &#36;4,000, so we would go SHORT &#36;2,000 of SH<br />
<br />
3) Use SH to hedge with our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %NETEXP</code></div>
</div>
Our net exposure is &#36;11,000, so we would go LONG &#36;5,500 of SH<br />
<br />
4) Use SPY to hedge against our long exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %LONGEXP</code></div>
</div>
We are long &#36;15,000, so we would go SHORT &#36;7,500 of SPY.<br />
<br />
5) Use SPY to hedge against our short exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %SHORTEXP</code></div>
</div>
We are short &#36;4,000, so we would go LONG &#36;2000 of SPY<br />
<br />
6) Use SPY to hedge against our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %NETEXP</code></div>
</div>
Our net exposure is &#36;11,000, so we would go SHORT &#36;5,500 of SPY <br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy 2</span><br />
Suppose our current strategy contains the stocks:<br />
AAPL (long &#36;1,000)<br />
IBM (long &#36;4,000)<br />
MSFT (short &#36;10,000)<br />
<br />
1) Use SH to hedge with our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %NETEXP</code></div>
</div>
Our net exposure is -&#36;5,000, so we would go SHORT &#36;2,500 of SH<br />
<br />
2) Use SPY to hedge against our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %NETEXP</code></div>
</div>
Our net exposure is -&#36;5,000, so we would go LONG &#36;2,500 of SPY<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy 3</span><br />
Suppose our current strategy contains the same stocks as Strategy 1:<br />
AAPL (long &#36;10,000)<br />
SH (long &#36;5,000)<br />
MSFT (short &#36;4,000)<br />
<br />
But now we will use SH to hedge:<br />
<br />
1) Use SH to hedge with our short exposure.<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 10 %SHORTEXP</code></div>
</div>
Our short exposure is &#36;4,000, so we would go SHORT &#36;400 of SH.<br />
Since we are currently LONG &#36;5,000 of SH, we would SELL &#36;5,400 of SH.<br />
<br />
2) Use SH to hedge with our long exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 10 %LONGEXP</code></div>
</div>
Our long exposure is &#36;10,000 <span style="font-weight: bold;" class="mycode_b">without</span> SH, so we would go LONG &#36;1,000 of SH.<br />
However, we are currently LONG &#36;5,000 of SH, so we have to SELL &#36;4,000 of SH.<br />
<br />
Why do we exclude SH when calculating long exposure? We assume that we are using SH to hedge against the rest of the portfolio. It wouldn't make sense to include SH in the long exposure calculation since then we would essentially be using SH to hedge against SH.<br />
The same is true for short and net exposure calculations.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Limitations</span><br />
1) It only makes sense to hedge with one stock in most cases. For example, take the portfolio:<br />
MSFT (long &#36;10,000)<br />
<br />
and try hedging <span style="font-weight: bold;" class="mycode_b">with</span> it using SH and TLT:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code> HWE SH 10 %LONGEXP<br />
HWE TLT 10 %LONGEXP</code></div>
</div>
<br />
We process the SH signal first, so we go LONG &#36;1,000 of SH.<br />
Now we process the TLT signal (suppose after the SH order has been executed), but now our long exposure is &#36;11,000, so we would go LONG &#36;1,100 of TLT, which is &#36;100 more than we wanted since we did not want to include SH in the calculation.<br />
<br />
Similarly, hedging with multiple stocks using net exposure will also fail since the net exposure calculation will include the other hedges as well.<br />
<br />
On the bright side, this issue <span style="font-weight: bold;" class="mycode_b">does not</span> occur when you hedge <span style="font-weight: bold;" class="mycode_b">against</span> long/short exposure. In this case, you are not including the stocks you are using to hedge in the actual long/short exposure calculation.<br />
<br />
2) The other limitation is that you cannot hedge for strategies using screeners, since they don't take hedging signals.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Hedging</span><br />
As of version 1.1, we have added the ability to hedge a strategy through <span style="font-weight: bold;" class="mycode_b">hedging actions</span>. The idea is that a user can now place an order based on their strategy's long/short exposure, which essentially grants the ability to hedge a strategy with some asset.<br />
<br />
Before reading ahead, make sure you have read the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> tutorial.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Hedging Actions</span><br />
The two hedging actions are <span style="font-weight: bold;" class="mycode_b">Hedge With Exposure(HWE)</span> and <span style="font-weight: bold;" class="mycode_b">Hedge Against Exposure(HAE)</span>, which each act as their name suggests.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Hedging Unit Types</span><br />
These hedging actions can only be used with some specific <span style="font-weight: bold;" class="mycode_b">hedging unit types</span>, that each behave slightly differently.<br />
<br />
<span style="font-size: large;" class="mycode_size">Percent of Long Exposure (%LONGEXP)</span><ul class="mycode_list"><li>Open a position based on only the long exposure of your strategy (i.e. sum of the exposure of all your long stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going long, and HAE means you will be going short<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Short Exposure (%SHORTEXP)</span><ul class="mycode_list"><li>Open a position based on only the short exposure of your strategy (i.e. sum of the exposure of all your short stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going short, and HAE means you will be going long<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Net Exposure (%NETEXP)</span><ul class="mycode_list"><li>Open a position based on the net exposure of your strategy (i.e. long exposure - short exposure)<br />
</li>
<li>Note that in this case, HWE and HAE don't necessarily mean you will go long or short (see below for examples)<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Account Long Exposure (%ACCTLONGEXP)</span><ul class="mycode_list"><li>Open a position based on only the long exposure of all your strategies (i.e. sum of the exposure of all your long stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going long, and HAE means you will be going short<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Account Short Exposure (%ACCTSHORTEXP)</span><ul class="mycode_list"><li>Open a position based on only the short exposure of all your strategies (i.e. sum of the exposure of all your short stocks)<br />
</li>
<li>Note that in this case, HWE means you will be going short, and HAE means you will be going long<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Percent of Account Net Exposure (%ACCTNETEXP)</span><ul class="mycode_list"><li>Open a position based on the net exposure of all your strategies (i.e. long exposure - short exposure)<br />
</li>
<li>Note that in this case, HWE and HAE don't necessarily mean you will go long or short (see below for examples)<br />
</li>
</ul>
<br />
<span style="font-size: x-large;" class="mycode_size">Examples</span><br />
Each strategy below examines what happens when hedging with different types of portfolios.<br />
Note that hedging actions still support the different order types, time in force, prices, etc. that regular actions support. For the purpose of these examples, we are using simple signals.<br />
Strategy 1 and 2 are basic cases, but please go over them briefly.<br />
We highly recommend you read the examples under Strategy 3, so you can understand exactly how hedging is handled in APM.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy 1</span><br />
Suppose our current strategy contains the stocks:<br />
AAPL (long &#36;10,000)<br />
IBM (long &#36;5,000)<br />
MSFT (short &#36;4,000)<br />
<br />
Now we will look at what happens with various signals:<br />
<br />
1) Use SH (Proshares Short ETF) to hedge with our long exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %LONGEXP</code></div>
</div>
We are long &#36;15,000, so we would go LONG &#36;7,500 of SH.<br />
<br />
2) Use SH to hedge with our short exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %SHORTEXP</code></div>
</div>
We are short &#36;4,000, so we would go SHORT &#36;2,000 of SH<br />
<br />
3) Use SH to hedge with our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %NETEXP</code></div>
</div>
Our net exposure is &#36;11,000, so we would go LONG &#36;5,500 of SH<br />
<br />
4) Use SPY to hedge against our long exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %LONGEXP</code></div>
</div>
We are long &#36;15,000, so we would go SHORT &#36;7,500 of SPY.<br />
<br />
5) Use SPY to hedge against our short exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %SHORTEXP</code></div>
</div>
We are short &#36;4,000, so we would go LONG &#36;2000 of SPY<br />
<br />
6) Use SPY to hedge against our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %NETEXP</code></div>
</div>
Our net exposure is &#36;11,000, so we would go SHORT &#36;5,500 of SPY <br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy 2</span><br />
Suppose our current strategy contains the stocks:<br />
AAPL (long &#36;1,000)<br />
IBM (long &#36;4,000)<br />
MSFT (short &#36;10,000)<br />
<br />
1) Use SH to hedge with our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 50 %NETEXP</code></div>
</div>
Our net exposure is -&#36;5,000, so we would go SHORT &#36;2,500 of SH<br />
<br />
2) Use SPY to hedge against our net exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HAE SPY 50 %NETEXP</code></div>
</div>
Our net exposure is -&#36;5,000, so we would go LONG &#36;2,500 of SPY<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy 3</span><br />
Suppose our current strategy contains the same stocks as Strategy 1:<br />
AAPL (long &#36;10,000)<br />
SH (long &#36;5,000)<br />
MSFT (short &#36;4,000)<br />
<br />
But now we will use SH to hedge:<br />
<br />
1) Use SH to hedge with our short exposure.<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 10 %SHORTEXP</code></div>
</div>
Our short exposure is &#36;4,000, so we would go SHORT &#36;400 of SH.<br />
Since we are currently LONG &#36;5,000 of SH, we would SELL &#36;5,400 of SH.<br />
<br />
2) Use SH to hedge with our long exposure<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>HWE SH 10 %LONGEXP</code></div>
</div>
Our long exposure is &#36;10,000 <span style="font-weight: bold;" class="mycode_b">without</span> SH, so we would go LONG &#36;1,000 of SH.<br />
However, we are currently LONG &#36;5,000 of SH, so we have to SELL &#36;4,000 of SH.<br />
<br />
Why do we exclude SH when calculating long exposure? We assume that we are using SH to hedge against the rest of the portfolio. It wouldn't make sense to include SH in the long exposure calculation since then we would essentially be using SH to hedge against SH.<br />
The same is true for short and net exposure calculations.<br />
<br />
<span style="font-size: x-large;" class="mycode_size">Limitations</span><br />
1) It only makes sense to hedge with one stock in most cases. For example, take the portfolio:<br />
MSFT (long &#36;10,000)<br />
<br />
and try hedging <span style="font-weight: bold;" class="mycode_b">with</span> it using SH and TLT:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code> HWE SH 10 %LONGEXP<br />
HWE TLT 10 %LONGEXP</code></div>
</div>
<br />
We process the SH signal first, so we go LONG &#36;1,000 of SH.<br />
Now we process the TLT signal (suppose after the SH order has been executed), but now our long exposure is &#36;11,000, so we would go LONG &#36;1,100 of TLT, which is &#36;100 more than we wanted since we did not want to include SH in the calculation.<br />
<br />
Similarly, hedging with multiple stocks using net exposure will also fail since the net exposure calculation will include the other hedges as well.<br />
<br />
On the bright side, this issue <span style="font-weight: bold;" class="mycode_b">does not</span> occur when you hedge <span style="font-weight: bold;" class="mycode_b">against</span> long/short exposure. In this case, you are not including the stocks you are using to hedge in the actual long/short exposure calculation.<br />
<br />
2) The other limitation is that you cannot hedge for strategies using screeners, since they don't take hedging signals.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[File Formats]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=55</link>
			<pubDate>Mon, 15 Jul 2019 00:15:18 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=55</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">File Formats</span><br />
The different file formats give you freedom in how you want to create/store signals, and can be set using the <span style="font-weight: bold;" class="mycode_b">File Type</span> field under the <span style="font-weight: bold;" class="mycode_b">Local File</span>, <span style="font-weight: bold;" class="mycode_b">File Screener</span>, <span style="font-weight: bold;" class="mycode_b">Google Drive File</span> and <span style="font-weight: bold;" class="mycode_b">Google Drive Screener</span> signal provider types.<br />
There are three types of file formats: <span style="font-weight: bold;" class="mycode_b">text</span>, <span style="font-weight: bold;" class="mycode_b">json</span>, <span style="font-weight: bold;" class="mycode_b">csv</span> with the following file type extensions: <span style="font-weight: bold;" class="mycode_b">.txt</span>, <span style="font-weight: bold;" class="mycode_b">.json</span>, <span style="font-weight: bold;" class="mycode_b">.csv</span><br />
<br />
Note that all signal files should still have the .sig extension either by itself or followed buy the file type extension. ( i.e. oldstrat.sig, newstrat.sig.txt, newerstrat.sig.csv, lateststrat.sig.json are all valid files names while a file named strat.txt will <span style="font-weight: bold;" class="mycode_b">not</span> be processed). <br />
We recommend using .sig.txt, .sig.csv and .sig.json extensions as they can be identified and thus (pre)viewed easier on mobile devices. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">*IMPORTANT*</span><br />
All files are processed OLDEST to NEWEST by the last modified time. When your strategy requires you to process files in a specific order, make sure the last modified time is set appropriately.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">TEXT</span><br />
The <span style="font-weight: bold;" class="mycode_b">text</span> format is described in the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> and <a href="https://aleratrading.com/forum/showthread.php?tid=5" target="_blank" rel="noopener" class="mycode_url">Stock Screeners</a> threads.<br />
Make sure you have read these threads first in order to understand what makes up a stock signal/screener.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">CSV</span><br />
The <span style="font-weight: bold;" class="mycode_b">csv</span> file is for table formatted signals (comma separated values).<br />
You can specify which columns you want to include (in any order) out of TICKER, ACTION, QUANTITY, UNIT, ORDERTYPE, LIMIT, STOP, TIF, TIFDATE, ID, EXITTARGET, EXITSTOP, REFPRICE, AFTERDATE, ALGO<br />
The only mandatory fields, as with the <span style="font-weight: bold;" class="mycode_b">text</span> format, are TICKER and ACTION. Fields <span style="font-weight: bold;" class="mycode_b">do not</span> need to be capitalized.<br />
You can also include column names that are not one of the above, these columns will simply be ignored.<br />
<br />
Notes:<ul class="mycode_list"><li>TIFDATE refers to the date specified for the GTD time in force.<br />
</li>
<li>AFTERDATE refers to the trigger time for delayed signals.<br />
</li>
</ul>
<br />
Here are some sample csv formatted <span style="font-weight: bold;" class="mycode_b">signal </span>files<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>TICKER,ACTION,date,comment,QUANTITY,UNIT,ORDERTYPE,LIMIT<br />
AAPL,BTO,20180909,buy apple,,,,<br />
IBM,LONG,20180909,long ibm,100,SHARES,LMT,100<br />
</code></div>
</div>
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>ACTION,TICKER<br />
LONG,APPL<br />
CLOSE,IBM<br />
</code></div>
</div>
<br />
The following is a specific example for a Custom Target Order (see <a href="https://aleratrading.com/forum/showthread.php?tid=404" target="_blank" rel="noopener" class="mycode_url">documenation</a>)<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>TICKER,ACTION,ORDERTYPE,LIMIT,EXITTARGET<br />
SPY,BTO,LMT,200,500<br />
HPQ,E_TGT,,,400<br />
</code></div>
</div>
<br />
Notice that you can leave fields you don't need blank. You only need to fill out fields such that the signal is valid.<br />
<br />
The csv file format for <span style="font-weight: bold;" class="mycode_b">screeners</span> is very similar, except that only the ACTION and TICKER columns will be read, and the only valid ACTIONS are BUY/SELL (as usual for screeners).<br />
The order of tickers in the screener is from top to bottom, similar to the <span style="font-weight: bold;" class="mycode_b">text</span> format.<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>ACTION,TICKER,comment<br />
BUY,APPL,<br />
BUY,IBM,Buying IBM today<br />
</code></div>
</div>
<br />
<span style="font-size: xx-large;" class="mycode_size">JSON</span><br />
The <span style="font-weight: bold;" class="mycode_b">json</span> file format allows for signals to be directly decoded from a json string, and it is only available for signals (and not screeners) as of now.<br />
<br />
The file should contain a single JSON object that is a list of JSON formatted signals.<br />
The valid signal fields are: Action, Quantity, Unit, Symbol, TimeInForce, OrderType, LimitPrice, SignalId.<br />
Of these fields, Action and Symbol are mandatory.<br />
<br />
Here is a sample json formatted file:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>[<br />
    {<br />
        "Action" : "BTO",<br />
        "Symbol" : "AAPL"<br />
    },<br />
    {<br />
        "Action" : "LONG",<br />
        "Symbol" : "IBM",<br />
        "Quantity" : 100,<br />
        "Unit" : "SHARES",<br />
        "OrderType" : "LMT",<br />
        "LimitPrice" : 100<br />
    }<br />
]<br />
</code></div>
</div>]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">File Formats</span><br />
The different file formats give you freedom in how you want to create/store signals, and can be set using the <span style="font-weight: bold;" class="mycode_b">File Type</span> field under the <span style="font-weight: bold;" class="mycode_b">Local File</span>, <span style="font-weight: bold;" class="mycode_b">File Screener</span>, <span style="font-weight: bold;" class="mycode_b">Google Drive File</span> and <span style="font-weight: bold;" class="mycode_b">Google Drive Screener</span> signal provider types.<br />
There are three types of file formats: <span style="font-weight: bold;" class="mycode_b">text</span>, <span style="font-weight: bold;" class="mycode_b">json</span>, <span style="font-weight: bold;" class="mycode_b">csv</span> with the following file type extensions: <span style="font-weight: bold;" class="mycode_b">.txt</span>, <span style="font-weight: bold;" class="mycode_b">.json</span>, <span style="font-weight: bold;" class="mycode_b">.csv</span><br />
<br />
Note that all signal files should still have the .sig extension either by itself or followed buy the file type extension. ( i.e. oldstrat.sig, newstrat.sig.txt, newerstrat.sig.csv, lateststrat.sig.json are all valid files names while a file named strat.txt will <span style="font-weight: bold;" class="mycode_b">not</span> be processed). <br />
We recommend using .sig.txt, .sig.csv and .sig.json extensions as they can be identified and thus (pre)viewed easier on mobile devices. <br />
<br />
<span style="font-weight: bold;" class="mycode_b">*IMPORTANT*</span><br />
All files are processed OLDEST to NEWEST by the last modified time. When your strategy requires you to process files in a specific order, make sure the last modified time is set appropriately.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">TEXT</span><br />
The <span style="font-weight: bold;" class="mycode_b">text</span> format is described in the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a> and <a href="https://aleratrading.com/forum/showthread.php?tid=5" target="_blank" rel="noopener" class="mycode_url">Stock Screeners</a> threads.<br />
Make sure you have read these threads first in order to understand what makes up a stock signal/screener.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">CSV</span><br />
The <span style="font-weight: bold;" class="mycode_b">csv</span> file is for table formatted signals (comma separated values).<br />
You can specify which columns you want to include (in any order) out of TICKER, ACTION, QUANTITY, UNIT, ORDERTYPE, LIMIT, STOP, TIF, TIFDATE, ID, EXITTARGET, EXITSTOP, REFPRICE, AFTERDATE, ALGO<br />
The only mandatory fields, as with the <span style="font-weight: bold;" class="mycode_b">text</span> format, are TICKER and ACTION. Fields <span style="font-weight: bold;" class="mycode_b">do not</span> need to be capitalized.<br />
You can also include column names that are not one of the above, these columns will simply be ignored.<br />
<br />
Notes:<ul class="mycode_list"><li>TIFDATE refers to the date specified for the GTD time in force.<br />
</li>
<li>AFTERDATE refers to the trigger time for delayed signals.<br />
</li>
</ul>
<br />
Here are some sample csv formatted <span style="font-weight: bold;" class="mycode_b">signal </span>files<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>TICKER,ACTION,date,comment,QUANTITY,UNIT,ORDERTYPE,LIMIT<br />
AAPL,BTO,20180909,buy apple,,,,<br />
IBM,LONG,20180909,long ibm,100,SHARES,LMT,100<br />
</code></div>
</div>
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>ACTION,TICKER<br />
LONG,APPL<br />
CLOSE,IBM<br />
</code></div>
</div>
<br />
The following is a specific example for a Custom Target Order (see <a href="https://aleratrading.com/forum/showthread.php?tid=404" target="_blank" rel="noopener" class="mycode_url">documenation</a>)<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>TICKER,ACTION,ORDERTYPE,LIMIT,EXITTARGET<br />
SPY,BTO,LMT,200,500<br />
HPQ,E_TGT,,,400<br />
</code></div>
</div>
<br />
Notice that you can leave fields you don't need blank. You only need to fill out fields such that the signal is valid.<br />
<br />
The csv file format for <span style="font-weight: bold;" class="mycode_b">screeners</span> is very similar, except that only the ACTION and TICKER columns will be read, and the only valid ACTIONS are BUY/SELL (as usual for screeners).<br />
The order of tickers in the screener is from top to bottom, similar to the <span style="font-weight: bold;" class="mycode_b">text</span> format.<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>ACTION,TICKER,comment<br />
BUY,APPL,<br />
BUY,IBM,Buying IBM today<br />
</code></div>
</div>
<br />
<span style="font-size: xx-large;" class="mycode_size">JSON</span><br />
The <span style="font-weight: bold;" class="mycode_b">json</span> file format allows for signals to be directly decoded from a json string, and it is only available for signals (and not screeners) as of now.<br />
<br />
The file should contain a single JSON object that is a list of JSON formatted signals.<br />
The valid signal fields are: Action, Quantity, Unit, Symbol, TimeInForce, OrderType, LimitPrice, SignalId.<br />
Of these fields, Action and Symbol are mandatory.<br />
<br />
Here is a sample json formatted file:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>[<br />
    {<br />
        "Action" : "BTO",<br />
        "Symbol" : "AAPL"<br />
    },<br />
    {<br />
        "Action" : "LONG",<br />
        "Symbol" : "IBM",<br />
        "Quantity" : 100,<br />
        "Unit" : "SHARES",<br />
        "OrderType" : "LMT",<br />
        "LimitPrice" : 100<br />
    }<br />
]<br />
</code></div>
</div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Account Settings]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=10</link>
			<pubDate>Mon, 19 Nov 2018 18:39:24 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=10</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Account Settings</span><br />
The account settings page is where you will manage your broker settings and other account related settings.<br />
Details about setting up your broker are in the <a href="https://aleratrading.com/forum/showthread.php?tid=1&amp;pid=1#pid1" target="_blank" rel="noopener" class="mycode_url">startup</a> guide.<br />
<br />
<img src="http://aleratrading.com/forum/images/documentation/apm_fullaccountsettings.png" loading="lazy"  width="600" height="381" alt="[Image: apm_fullaccountsettings.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Licenses</span><br />
Refer to the startup guide for details about licenses. When you obtain a license for a real account, you will have to input your license token into the <span style="font-weight: bold;" class="mycode_b">Token</span> field.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Tickers</span><br />
This section lets you manage the tickers that APM uses at the account level.<br />
<br />
<span style="font-size: large;" class="mycode_size">Ignore Tickers</span><br />
You can use this text box to prevent APM from trading a ticker across <span style="font-weight: bold;" class="mycode_b">all</span> strategies. This will allow you to manually trade the ticker yourself without worrying about it affecting your APM strategies.<br />
<br />
<span style="font-size: large;" class="mycode_size">Orphaned Tickers</span><br />
This text box will tell you if there are non-ignored tickers that you own (or have orders for) in your portfolio that do not belong to a strategy.<br />
If you want to trade these tickers manually yourself, then you should add them to <span style="font-weight: bold;" class="mycode_b">Ignored Tickers</span> because otherwise any manual orders for them will be automatically cancelled by APM.<br />
If you want to assign some of these tickers to a specific strategy, then simply highlight the ones you want with your mouse and use the buttons above the orphaned tickers text box to transfer them.<br />
If you don't care about what happens to these tickers, then you can leave them and a strategy will be able to take the ticker over and place orders for it.<br />
Note that the orphan tickers text box will only have tickers in it once you connect to your broker.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Email</span><br />
You have the option to email yourself account information on a schedule that you input.<br />
We suggest you create a new email account that will be used to send the outgoing mail (preferably Gmail). The password you use will be encrypted and stored locally on your computer. The reason we do not use an Alera email to send your data is because we want to preserve the privacy of your data by keeping it off of our own servers.<br />
Once you input this information and set a schedule (refer to the <a href="https://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">cron</a> guide), you should save the strategy and click the 'play' button beside your schedule to send a test email. If you there is an error with the information you inputted, there will be a message displayed on APM.<br />
<br />
Some email services, like Gmail, will not accept automated email messages by default. APM may not be able to detect this issue on its end, so you will have to make sure you modify the settings on your email service to allow this (if you didn't receive the test email). For Gmail, you can find out how to do this <a href="https://support.google.com/accounts/answer/6010255?hl=en" target="_blank" rel="noopener" class="mycode_url">here</a>.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Start and Strategies</span><br />
The <span style="font-weight: bold;" class="mycode_b">Start </span>button will initiate a connection to your broker. If it is successful, the status bar on the bottom of your screen will turn blue.<br />
The <span style="font-weight: bold;" class="mycode_b">Strategies </span>button allows you to view your strategies.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Account Settings</span><br />
The account settings page is where you will manage your broker settings and other account related settings.<br />
Details about setting up your broker are in the <a href="https://aleratrading.com/forum/showthread.php?tid=1&amp;pid=1#pid1" target="_blank" rel="noopener" class="mycode_url">startup</a> guide.<br />
<br />
<img src="http://aleratrading.com/forum/images/documentation/apm_fullaccountsettings.png" loading="lazy"  width="600" height="381" alt="[Image: apm_fullaccountsettings.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Licenses</span><br />
Refer to the startup guide for details about licenses. When you obtain a license for a real account, you will have to input your license token into the <span style="font-weight: bold;" class="mycode_b">Token</span> field.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Tickers</span><br />
This section lets you manage the tickers that APM uses at the account level.<br />
<br />
<span style="font-size: large;" class="mycode_size">Ignore Tickers</span><br />
You can use this text box to prevent APM from trading a ticker across <span style="font-weight: bold;" class="mycode_b">all</span> strategies. This will allow you to manually trade the ticker yourself without worrying about it affecting your APM strategies.<br />
<br />
<span style="font-size: large;" class="mycode_size">Orphaned Tickers</span><br />
This text box will tell you if there are non-ignored tickers that you own (or have orders for) in your portfolio that do not belong to a strategy.<br />
If you want to trade these tickers manually yourself, then you should add them to <span style="font-weight: bold;" class="mycode_b">Ignored Tickers</span> because otherwise any manual orders for them will be automatically cancelled by APM.<br />
If you want to assign some of these tickers to a specific strategy, then simply highlight the ones you want with your mouse and use the buttons above the orphaned tickers text box to transfer them.<br />
If you don't care about what happens to these tickers, then you can leave them and a strategy will be able to take the ticker over and place orders for it.<br />
Note that the orphan tickers text box will only have tickers in it once you connect to your broker.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Email</span><br />
You have the option to email yourself account information on a schedule that you input.<br />
We suggest you create a new email account that will be used to send the outgoing mail (preferably Gmail). The password you use will be encrypted and stored locally on your computer. The reason we do not use an Alera email to send your data is because we want to preserve the privacy of your data by keeping it off of our own servers.<br />
Once you input this information and set a schedule (refer to the <a href="https://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">cron</a> guide), you should save the strategy and click the 'play' button beside your schedule to send a test email. If you there is an error with the information you inputted, there will be a message displayed on APM.<br />
<br />
Some email services, like Gmail, will not accept automated email messages by default. APM may not be able to detect this issue on its end, so you will have to make sure you modify the settings on your email service to allow this (if you didn't receive the test email). For Gmail, you can find out how to do this <a href="https://support.google.com/accounts/answer/6010255?hl=en" target="_blank" rel="noopener" class="mycode_url">here</a>.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Start and Strategies</span><br />
The <span style="font-weight: bold;" class="mycode_b">Start </span>button will initiate a connection to your broker. If it is successful, the status bar on the bottom of your screen will turn blue.<br />
The <span style="font-weight: bold;" class="mycode_b">Strategies </span>button allows you to view your strategies.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Strategies]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=4</link>
			<pubDate>Mon, 19 Nov 2018 02:10:51 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=4</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Strategies</span><br />
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.<br />
Your strategies are listed as tabs at the top of the window, and each individual strategy has 3 tabs: settings, logs and portfolio.<br />
This guide will go over the various sections of the settings tab and then explain what the portfolio and log tabs do.<br />
Before you get started, remember that every time you change a setting, you should click <span style="font-weight: bold;" class="mycode_b">Save</span>, otherwise your settings won't be updated.<br />
Also note that most of the information in this guide can be found directly on APM by hovering over the text boxes.<br />
<br />
<img src="http://aleratrading.com/forum/images/documentation/apm_strategysettings3.png" loading="lazy"  width="600" height="381" alt="[Image: apm_strategysettings3.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Strategy</span><br />
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.<br />
There are guides to using the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">individual signals</a> and <a href="http://aleratrading.com/forum/showthread.php?tid=5" target="_blank" rel="noopener" class="mycode_url">screeners</a> that explain the fields in detail.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy Type</span><br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy Priority</span><br />
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 <span style="font-weight: bold;" class="mycode_b">Orphan Ticker Priority</span> 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.<br />
<br />
To add accommodate different use cases for strategy priority, the signal types CLOSE, BTC, STC <span style="font-weight: bold;" class="mycode_b">will not</span> 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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Max Number of Positions</span> - non-screener strategies only<br />
This field determines the max number of positions your strategy can hold. There are three ways to cap your positions.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Hard Cap</span> <br />
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 <span style="font-weight: bold;" class="mycode_b">CANNOT</span> place anymore orders in this strategy (unless they are for those 5 tickers)<br />
<br />
<span style="font-size: medium;" class="mycode_size">Hard Cap+</span><br />
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 <span style="font-weight: bold;" class="mycode_b">cancelling</span> a CLOSING market orders, the number of positions may go over the cap. In this case, APM will automatically cancel any remaining limit orders.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Hard Cap++</span><br />
This is the same as Hard Cap+, but we don't count <span style="font-weight: bold;" class="mycode_b">any</span> 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.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Soft Cap</span><br />
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, <span style="font-weight: bold;" class="mycode_b">and a close MKT order for AAPL</span>. Then you are considered to currently have 3 positions in your cap: IBM, SPY, and TLT. We <span style="font-weight: bold;" class="mycode_b">do not</span> 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.<ul class="mycode_list"><li>If you want to replace existing positions by placing CLOSE market orders for those positions and placing some LMT orders to open new positions, you will have to place the market orders FIRST before you place your new orders in order (otherwise APM won’t think there are free positions available)<br />
</li>
<li>Limit Auction (LOO/LOC) orders are counted towards the cap since they cannot be cancelled at certain times of day (e.g. near market close or open). However, using a CLOSE LOO/LOC order will not free up a position like a market (MKT/MOC/MOO) order since these limit auction orders are not guaranteed to execute.<br />
</li>
</ul>
<br />
<span style="font-size: medium;" class="mycode_size">Soft Cap++</span><br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Number of Positions</span> - screener strategies only<br />
This is the number of positions from your screener that APM will hold.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">External Program</span><br />
The purpose of using external programs is to have the ability to run other software to create signals for APM to process.<br />
The guide <a href="https://aleratrading.com/forum/showthread.php?tid=7" target="_blank" rel="noopener" class="mycode_url">here</a> goes in detail over how to do this.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Scheduler</span><br />
The scheduler section allows you to schedule your strategy. Refer to the <a href="http://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">cron guide</a> to learn how to fill in schedule fields.<br />
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.<br />
You also have the option to disable the scheduler for the strategy by unchecking the checkbox beside <span style="font-weight: bold;" class="mycode_b">Enable Scheduler</span>. Everything else will remain the same, except that the strategy won't run.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Position Sizing</span><br />
This section allows you to allocate how much money you would like to allocate to each strategy and each trade. Refer to the <a href="http://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">signals</a> guide for details on <span style="font-weight: bold;" class="mycode_b">Unit</span> types.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy Allocation</span><ul class="mycode_list"><li>Choose how much to money to allocate to this strategy, either as total dollar value or a percent of your portfolio<br />
</li>
<li>If you are connected to your broker, then the dollar value associated with your strategy will appear to the left of the text box<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Position Sizing Type</span><br />
There are three types of position sizing types that determine how large position will be<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">None</span><ul class="mycode_list"><li>Use the position size provided by the signal provider if it is provided. Otherwise use the <span style="font-weight: bold;" class="mycode_b">Custom Lot Size</span><br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Custom</span><ul class="mycode_list"><li>Override the position provided by the signal provider and use the <span style="font-weight: bold;" class="mycode_b">Custom Lot Size</span> instead<br />
</li>
<li>We <span style="font-weight: bold;" class="mycode_b">only </span>override if the <span style="font-weight: bold;" class="mycode_b">Unit</span> type is DOLLARS or SHARES because the other types do not need to be overridden<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Scaling</span><ul class="mycode_list"><li>Scale the position size from the signal provider by a given factor that you specify in the <span style="font-weight: bold;" class="mycode_b">Scaling Factor</span> field.<br />
</li>
<li>We <span style="font-weight: bold;" class="mycode_b">only </span>scale if the <span style="font-weight: bold;" class="mycode_b">Unit</span> type is DOLLARS or SHARES<br />
</li>
</ul>
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Custom Lot Size</span><br />
Allows you to specify the position you want to take if it is not specified by the signal provider or you choose the <span style="font-weight: bold;" class="mycode_b">Custom</span> position sizing type.<br />
The value you specify will be treated as percent of your <span style="font-weight: bold;" class="mycode_b">Strategy Allocation</span> 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.<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="font-size: medium;" class="mycode_size">Very Important!!</span></span><br />
Your <span style="font-weight: bold;" class="mycode_b">Strategy Allocation </span>value does <span style="font-weight: bold;" class="mycode_b">not </span>prevent orders from being placed if they will make the strategy exceed its allocation.<br />
This means if you allocate &#36;100,000 to your strategy, and set the <span style="font-weight: bold;" class="mycode_b">Custom Lot Size</span> to 10% (which is &#36;10,000), and the signal provider gives 20 signals, then the strategy will have a total dollar value of &#36;200,000. You should choose your <span style="font-weight: bold;" class="mycode_b">Custom Lot Size </span>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 <span style="font-weight: bold;" class="mycode_b">Max Number of Positions </span>field under the <span style="font-weight: bold;" class="mycode_b">Strategy</span> section (where your signal provider settings are). This way if your <span style="font-weight: bold;" class="mycode_b">Custom Lot Size </span>is 10%, you can set the <span style="font-weight: bold;" class="mycode_b">Max Number of Positions </span>to 10 and put a hard limit on the number of positions you take.<br />
<br />
<span style="font-size: large;" class="mycode_size">Allow Odd Lots</span><br />
Check this if you want to allow orders/positions of any size to be placed/held.<br />
Otherwise, all orders will be rounded such that the final position held will be a multiple of 100 shares.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Order Types</span><br />
This section is used to specify the kind of orders you want placed in the market. Refer to the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">signals</a> guide for details on Order Types.<br />
<br />
<span style="font-size: large;" class="mycode_size">Default Market Order Type</span><br />
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.<br />
This also applies to screeners as well since they use market orders.<br />
<br />
<span style="font-size: large;" class="mycode_size">Override Market Order Type</span><br />
This option allows you to override the market order type specified by the signal provider with the <span style="font-weight: bold;" class="mycode_b">Default Market Order Type</span>. This will <span style="font-weight: bold;" class="mycode_b">only</span> override MKT and MOC orders, <span style="font-weight: bold;" class="mycode_b">not</span> LMT or LOC.<br />
<br />
<span style="font-size: large;" class="mycode_size">Protect Market Orders</span><br />
This allows the user to 'protect' their market orders by converting them to limit orders as follows:<ul class="mycode_list"><li>Buy orders will have a limit price equal to the current bid price PLUS the <span style="font-weight: bold;" class="mycode_b">Protection Offset</span> (as a percent)<br />
</li>
<li>Sell orders will have a limit price equal to the current ask price MINUS the <span style="font-weight: bold;" class="mycode_b">Protection Offset</span> (as a percent)<br />
</li>
</ul>
This prevents buy/sell orders from executing too far away from the current bid/ask price.<br />
This only works for Market orders and <span style="font-weight: bold;" class="mycode_b">not</span> Market on Close orders.<br />
<br />
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<br />
<br />
<span style="font-size: large;" class="mycode_size">Override Limit Order Type</span><br />
This option allows you to override the limit order type specified by the signal provider with your own (keeping the same limit price).<br />
<br />
<span style="font-size: large;" class="mycode_size">Default Time in Force</span><br />
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.<br />
The time in force specified here will be applied to all screeners as well, but we recommend you use DAY orders.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Email</span><br />
Email settings related to your strategy<br />
<br />
<span style="font-size: large;" class="mycode_size">Send Email After Strategy Runs</span><br />
Check this to send an email after you strategy runs. It will contain data relevant to this specific strategy.<br />
If this check box is disabled, then either your email has not been set up or is disabled in your Account Settings.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Position Management</span><br />
This section allows you do automatically manage stop loss and target orders for your current positions.<br />
<br />
<span style="font-size: large;" class="mycode_size">Stop Loss Order Type</span><br />
Allows you to place stop loss orders with the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent</span><br />
<br />
Trailing<ul class="mycode_list"><li>A trailing stop loss order will trail by the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent</span><br />
</li>
<li>An update of the percentage amount will trigger an order update as soon as you save the strategy<br />
</li>
</ul>
Stop<ul class="mycode_list"><li>A regular stop loss order will be placed away from the current price by the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent</span><br />
</li>
<li>An update of the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent </span>will <span style="font-weight: bold;" class="mycode_b">not </span>trigger any update on existing orders. It will be used only for all newly placed orders.<br />
</li>
</ul>
A change from regular stop to trailing (or from trailing to stop) will cancel all existing stop loss orders and generate new ones based on the current price.<br />
<br />
<span style="font-size: large;" class="mycode_size">Generate Target Orders</span><br />
Allows you to place target profit orders with the <span style="font-weight: bold;" class="mycode_b">Target Profit Percentage</span>.<br />
Note that updating the <span style="font-weight: bold;" class="mycode_b">Target Profit Percentage </span>will not update any existing orders, similar to the stop loss orders.<br />
<br />
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<span style="font-weight: bold;" class="mycode_b"> </span>orders that shrink that position were to be executed at once.<br />
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.<br />
  <br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Order Limits</span><br />
This section allows you put limits on the number of shares, stock price, or total dollar value (shares x price) of an order.<br />
<br />
<span style="font-size: large;" class="mycode_size">Minimums</span><br />
The Min fields specify that an order that <span style="font-weight: bold;" class="mycode_b">does not</span> <span style="font-weight: bold;" class="mycode_b">CLOSE </span>positions will be ignored if it does not meet the min criteria (the exception to this is <span style="font-weight: bold;" class="mycode_b">Min Price</span>, which only applies to non-shrinking orders)<br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Maximums</span><br />
The Max fields specify that an order that <span style="font-weight: bold;" class="mycode_b">does not SHRINK </span>positions will be ignored if it does not meet the criteria.<br />
This is slightly different than Min because we don't apply the limits to close orders <span style="font-weight: bold;" class="mycode_b">and </span>orders that shrink positions.<br />
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).<br />
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 <span style="font-weight: bold;" class="mycode_b">Min Shares</span> to maybe 10. This feature is not useful for <span style="font-weight: bold;" class="mycode_b">Min Price</span>, so it behaves the same way as the Max fields.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Order Preview and Skip Orders</span><br />
APM allows you preview the orders that would be placed in the market by clicking the <span style="font-weight: bold;" class="mycode_b">Order Preview</span> button on the bottom left of the settings page.<br />
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.<br />
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 <span style="font-weight: bold;" class="mycode_b">Update Skip Orders List</span> at the bottom of the order preview window, the tickers associated with the orders you selected will be stored in the <span style="font-weight: bold;" class="mycode_b">Skip Orders </span>text box on the bottom right of the strategy page.<br />
Now whenever your strategy runs (for real), it will skip the orders for the tickers in <span style="font-weight: bold;" class="mycode_b">Skip Orders</span>. You can also manually edit skip orders when the strategy is not running.<br />
<br />
<img src="http://aleratrading.com/forum/images/documentation/apm_orderpreview.png" loading="lazy"  width="600" height="266" alt="[Image: apm_orderpreview.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Log</span><br />
The log tab mainly logs signals as they are being processed and serves as a way to check that your strategy is running correctly.<br />
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.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Portfolio</span><br />
The portfolio tab stores a table of the positions you own and any active orders for the strategy. <br />
You can sort by a specific column by clicking on the column's header. <br />
You can remove a ticker from the strategy by clicking the <span style="font-weight: bold;" class="mycode_b">Remove </span>button on the right. This will <span style="font-weight: bold;" class="mycode_b">not </span>sell the position, it will simply remove it from the strategy so that another strategy can take it.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Trades</span><br />
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) <br />
The partial trades that belong to the same order are aggregated in one entry. <br />
The tickers removed from the strategy (either manually or automatically) will not show in the trades tab.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Order Ref Field (Interactive Brokers)</span><br />
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: <a href="https://aleratrading.com/forum/showthread.php?tid=125&amp;pid=601#pid601" target="_blank" rel="noopener" class="mycode_url">https://aleratrading.com/forum/showthrea...601#pid601</a><br />
<img src="http://aleratrading.com/forum/images/documentation/ib_orderref.png" loading="lazy"  width="900" height="400" alt="[Image: ib_orderref.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Signal Processing</span><br />
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.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Strategies</span><br />
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.<br />
Your strategies are listed as tabs at the top of the window, and each individual strategy has 3 tabs: settings, logs and portfolio.<br />
This guide will go over the various sections of the settings tab and then explain what the portfolio and log tabs do.<br />
Before you get started, remember that every time you change a setting, you should click <span style="font-weight: bold;" class="mycode_b">Save</span>, otherwise your settings won't be updated.<br />
Also note that most of the information in this guide can be found directly on APM by hovering over the text boxes.<br />
<br />
<img src="http://aleratrading.com/forum/images/documentation/apm_strategysettings3.png" loading="lazy"  width="600" height="381" alt="[Image: apm_strategysettings3.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Strategy</span><br />
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.<br />
There are guides to using the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">individual signals</a> and <a href="http://aleratrading.com/forum/showthread.php?tid=5" target="_blank" rel="noopener" class="mycode_url">screeners</a> that explain the fields in detail.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy Type</span><br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy Priority</span><br />
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 <span style="font-weight: bold;" class="mycode_b">Orphan Ticker Priority</span> 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.<br />
<br />
To add accommodate different use cases for strategy priority, the signal types CLOSE, BTC, STC <span style="font-weight: bold;" class="mycode_b">will not</span> 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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Max Number of Positions</span> - non-screener strategies only<br />
This field determines the max number of positions your strategy can hold. There are three ways to cap your positions.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Hard Cap</span> <br />
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 <span style="font-weight: bold;" class="mycode_b">CANNOT</span> place anymore orders in this strategy (unless they are for those 5 tickers)<br />
<br />
<span style="font-size: medium;" class="mycode_size">Hard Cap+</span><br />
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 <span style="font-weight: bold;" class="mycode_b">cancelling</span> a CLOSING market orders, the number of positions may go over the cap. In this case, APM will automatically cancel any remaining limit orders.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Hard Cap++</span><br />
This is the same as Hard Cap+, but we don't count <span style="font-weight: bold;" class="mycode_b">any</span> 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.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Soft Cap</span><br />
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, <span style="font-weight: bold;" class="mycode_b">and a close MKT order for AAPL</span>. Then you are considered to currently have 3 positions in your cap: IBM, SPY, and TLT. We <span style="font-weight: bold;" class="mycode_b">do not</span> 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.<ul class="mycode_list"><li>If you want to replace existing positions by placing CLOSE market orders for those positions and placing some LMT orders to open new positions, you will have to place the market orders FIRST before you place your new orders in order (otherwise APM won’t think there are free positions available)<br />
</li>
<li>Limit Auction (LOO/LOC) orders are counted towards the cap since they cannot be cancelled at certain times of day (e.g. near market close or open). However, using a CLOSE LOO/LOC order will not free up a position like a market (MKT/MOC/MOO) order since these limit auction orders are not guaranteed to execute.<br />
</li>
</ul>
<br />
<span style="font-size: medium;" class="mycode_size">Soft Cap++</span><br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Number of Positions</span> - screener strategies only<br />
This is the number of positions from your screener that APM will hold.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">External Program</span><br />
The purpose of using external programs is to have the ability to run other software to create signals for APM to process.<br />
The guide <a href="https://aleratrading.com/forum/showthread.php?tid=7" target="_blank" rel="noopener" class="mycode_url">here</a> goes in detail over how to do this.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Scheduler</span><br />
The scheduler section allows you to schedule your strategy. Refer to the <a href="http://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">cron guide</a> to learn how to fill in schedule fields.<br />
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.<br />
You also have the option to disable the scheduler for the strategy by unchecking the checkbox beside <span style="font-weight: bold;" class="mycode_b">Enable Scheduler</span>. Everything else will remain the same, except that the strategy won't run.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Position Sizing</span><br />
This section allows you to allocate how much money you would like to allocate to each strategy and each trade. Refer to the <a href="http://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">signals</a> guide for details on <span style="font-weight: bold;" class="mycode_b">Unit</span> types.<br />
<br />
<span style="font-size: large;" class="mycode_size">Strategy Allocation</span><ul class="mycode_list"><li>Choose how much to money to allocate to this strategy, either as total dollar value or a percent of your portfolio<br />
</li>
<li>If you are connected to your broker, then the dollar value associated with your strategy will appear to the left of the text box<br />
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Position Sizing Type</span><br />
There are three types of position sizing types that determine how large position will be<ul class="mycode_list"><li><span style="font-weight: bold;" class="mycode_b">None</span><ul class="mycode_list"><li>Use the position size provided by the signal provider if it is provided. Otherwise use the <span style="font-weight: bold;" class="mycode_b">Custom Lot Size</span><br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Custom</span><ul class="mycode_list"><li>Override the position provided by the signal provider and use the <span style="font-weight: bold;" class="mycode_b">Custom Lot Size</span> instead<br />
</li>
<li>We <span style="font-weight: bold;" class="mycode_b">only </span>override if the <span style="font-weight: bold;" class="mycode_b">Unit</span> type is DOLLARS or SHARES because the other types do not need to be overridden<br />
</li>
</ul>
</li>
<li><span style="font-weight: bold;" class="mycode_b">Scaling</span><ul class="mycode_list"><li>Scale the position size from the signal provider by a given factor that you specify in the <span style="font-weight: bold;" class="mycode_b">Scaling Factor</span> field.<br />
</li>
<li>We <span style="font-weight: bold;" class="mycode_b">only </span>scale if the <span style="font-weight: bold;" class="mycode_b">Unit</span> type is DOLLARS or SHARES<br />
</li>
</ul>
</li>
</ul>
<span style="font-size: large;" class="mycode_size">Custom Lot Size</span><br />
Allows you to specify the position you want to take if it is not specified by the signal provider or you choose the <span style="font-weight: bold;" class="mycode_b">Custom</span> position sizing type.<br />
The value you specify will be treated as percent of your <span style="font-weight: bold;" class="mycode_b">Strategy Allocation</span> 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.<br />
<br />
<span style="font-weight: bold;" class="mycode_b"><span style="font-size: medium;" class="mycode_size">Very Important!!</span></span><br />
Your <span style="font-weight: bold;" class="mycode_b">Strategy Allocation </span>value does <span style="font-weight: bold;" class="mycode_b">not </span>prevent orders from being placed if they will make the strategy exceed its allocation.<br />
This means if you allocate &#36;100,000 to your strategy, and set the <span style="font-weight: bold;" class="mycode_b">Custom Lot Size</span> to 10% (which is &#36;10,000), and the signal provider gives 20 signals, then the strategy will have a total dollar value of &#36;200,000. You should choose your <span style="font-weight: bold;" class="mycode_b">Custom Lot Size </span>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 <span style="font-weight: bold;" class="mycode_b">Max Number of Positions </span>field under the <span style="font-weight: bold;" class="mycode_b">Strategy</span> section (where your signal provider settings are). This way if your <span style="font-weight: bold;" class="mycode_b">Custom Lot Size </span>is 10%, you can set the <span style="font-weight: bold;" class="mycode_b">Max Number of Positions </span>to 10 and put a hard limit on the number of positions you take.<br />
<br />
<span style="font-size: large;" class="mycode_size">Allow Odd Lots</span><br />
Check this if you want to allow orders/positions of any size to be placed/held.<br />
Otherwise, all orders will be rounded such that the final position held will be a multiple of 100 shares.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Order Types</span><br />
This section is used to specify the kind of orders you want placed in the market. Refer to the <a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">signals</a> guide for details on Order Types.<br />
<br />
<span style="font-size: large;" class="mycode_size">Default Market Order Type</span><br />
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.<br />
This also applies to screeners as well since they use market orders.<br />
<br />
<span style="font-size: large;" class="mycode_size">Override Market Order Type</span><br />
This option allows you to override the market order type specified by the signal provider with the <span style="font-weight: bold;" class="mycode_b">Default Market Order Type</span>. This will <span style="font-weight: bold;" class="mycode_b">only</span> override MKT and MOC orders, <span style="font-weight: bold;" class="mycode_b">not</span> LMT or LOC.<br />
<br />
<span style="font-size: large;" class="mycode_size">Protect Market Orders</span><br />
This allows the user to 'protect' their market orders by converting them to limit orders as follows:<ul class="mycode_list"><li>Buy orders will have a limit price equal to the current bid price PLUS the <span style="font-weight: bold;" class="mycode_b">Protection Offset</span> (as a percent)<br />
</li>
<li>Sell orders will have a limit price equal to the current ask price MINUS the <span style="font-weight: bold;" class="mycode_b">Protection Offset</span> (as a percent)<br />
</li>
</ul>
This prevents buy/sell orders from executing too far away from the current bid/ask price.<br />
This only works for Market orders and <span style="font-weight: bold;" class="mycode_b">not</span> Market on Close orders.<br />
<br />
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<br />
<br />
<span style="font-size: large;" class="mycode_size">Override Limit Order Type</span><br />
This option allows you to override the limit order type specified by the signal provider with your own (keeping the same limit price).<br />
<br />
<span style="font-size: large;" class="mycode_size">Default Time in Force</span><br />
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.<br />
The time in force specified here will be applied to all screeners as well, but we recommend you use DAY orders.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Email</span><br />
Email settings related to your strategy<br />
<br />
<span style="font-size: large;" class="mycode_size">Send Email After Strategy Runs</span><br />
Check this to send an email after you strategy runs. It will contain data relevant to this specific strategy.<br />
If this check box is disabled, then either your email has not been set up or is disabled in your Account Settings.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Position Management</span><br />
This section allows you do automatically manage stop loss and target orders for your current positions.<br />
<br />
<span style="font-size: large;" class="mycode_size">Stop Loss Order Type</span><br />
Allows you to place stop loss orders with the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent</span><br />
<br />
Trailing<ul class="mycode_list"><li>A trailing stop loss order will trail by the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent</span><br />
</li>
<li>An update of the percentage amount will trigger an order update as soon as you save the strategy<br />
</li>
</ul>
Stop<ul class="mycode_list"><li>A regular stop loss order will be placed away from the current price by the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent</span><br />
</li>
<li>An update of the <span style="font-weight: bold;" class="mycode_b">Stop Loss Percent </span>will <span style="font-weight: bold;" class="mycode_b">not </span>trigger any update on existing orders. It will be used only for all newly placed orders.<br />
</li>
</ul>
A change from regular stop to trailing (or from trailing to stop) will cancel all existing stop loss orders and generate new ones based on the current price.<br />
<br />
<span style="font-size: large;" class="mycode_size">Generate Target Orders</span><br />
Allows you to place target profit orders with the <span style="font-weight: bold;" class="mycode_b">Target Profit Percentage</span>.<br />
Note that updating the <span style="font-weight: bold;" class="mycode_b">Target Profit Percentage </span>will not update any existing orders, similar to the stop loss orders.<br />
<br />
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<span style="font-weight: bold;" class="mycode_b"> </span>orders that shrink that position were to be executed at once.<br />
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.<br />
  <br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Order Limits</span><br />
This section allows you put limits on the number of shares, stock price, or total dollar value (shares x price) of an order.<br />
<br />
<span style="font-size: large;" class="mycode_size">Minimums</span><br />
The Min fields specify that an order that <span style="font-weight: bold;" class="mycode_b">does not</span> <span style="font-weight: bold;" class="mycode_b">CLOSE </span>positions will be ignored if it does not meet the min criteria (the exception to this is <span style="font-weight: bold;" class="mycode_b">Min Price</span>, which only applies to non-shrinking orders)<br />
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.<br />
<br />
<span style="font-size: large;" class="mycode_size">Maximums</span><br />
The Max fields specify that an order that <span style="font-weight: bold;" class="mycode_b">does not SHRINK </span>positions will be ignored if it does not meet the criteria.<br />
This is slightly different than Min because we don't apply the limits to close orders <span style="font-weight: bold;" class="mycode_b">and </span>orders that shrink positions.<br />
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).<br />
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 <span style="font-weight: bold;" class="mycode_b">Min Shares</span> to maybe 10. This feature is not useful for <span style="font-weight: bold;" class="mycode_b">Min Price</span>, so it behaves the same way as the Max fields.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Order Preview and Skip Orders</span><br />
APM allows you preview the orders that would be placed in the market by clicking the <span style="font-weight: bold;" class="mycode_b">Order Preview</span> button on the bottom left of the settings page.<br />
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.<br />
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 <span style="font-weight: bold;" class="mycode_b">Update Skip Orders List</span> at the bottom of the order preview window, the tickers associated with the orders you selected will be stored in the <span style="font-weight: bold;" class="mycode_b">Skip Orders </span>text box on the bottom right of the strategy page.<br />
Now whenever your strategy runs (for real), it will skip the orders for the tickers in <span style="font-weight: bold;" class="mycode_b">Skip Orders</span>. You can also manually edit skip orders when the strategy is not running.<br />
<br />
<img src="http://aleratrading.com/forum/images/documentation/apm_orderpreview.png" loading="lazy"  width="600" height="266" alt="[Image: apm_orderpreview.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Log</span><br />
The log tab mainly logs signals as they are being processed and serves as a way to check that your strategy is running correctly.<br />
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.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Portfolio</span><br />
The portfolio tab stores a table of the positions you own and any active orders for the strategy. <br />
You can sort by a specific column by clicking on the column's header. <br />
You can remove a ticker from the strategy by clicking the <span style="font-weight: bold;" class="mycode_b">Remove </span>button on the right. This will <span style="font-weight: bold;" class="mycode_b">not </span>sell the position, it will simply remove it from the strategy so that another strategy can take it.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Trades</span><br />
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) <br />
The partial trades that belong to the same order are aggregated in one entry. <br />
The tickers removed from the strategy (either manually or automatically) will not show in the trades tab.<br />
<br />
<span style="font-size: medium;" class="mycode_size">Order Ref Field (Interactive Brokers)</span><br />
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: <a href="https://aleratrading.com/forum/showthread.php?tid=125&amp;pid=601#pid601" target="_blank" rel="noopener" class="mycode_url">https://aleratrading.com/forum/showthrea...601#pid601</a><br />
<img src="http://aleratrading.com/forum/images/documentation/ib_orderref.png" loading="lazy"  width="900" height="400" alt="[Image: ib_orderref.png]" class="mycode_img" /><br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Signal Processing</span><br />
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.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Automating your Self-Contained System]]></title>
			<link>https://aleratrading.com/forum/showthread.php?tid=7</link>
			<pubDate>Sun, 18 Nov 2018 16:41:45 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://aleratrading.com/forum/member.php?action=profile&uid=1">admin</a>]]></dc:creator>
			<guid isPermaLink="false">https://aleratrading.com/forum/showthread.php?tid=7</guid>
			<description><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Automating your Self-Contained System</span><br />
This guide explains the steps to completely automate data download, signal creation, and signal processing.<br />
<br />
The following guides may be helpful:<ul class="mycode_list"><li><a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a><br />
</li>
<li><a href="https://aleratrading.com/forum/showthread.php?tid=5" target="_blank" rel="noopener" class="mycode_url">Stock Screeners</a><br />
</li>
<li><a href="https://aleratrading.com/forum/showthread.php?tid=4" target="_blank" rel="noopener" class="mycode_url">Strategies</a><br />
</li>
<li><a href="https://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">Cron Scheduling</a><br />
</li>
</ul>
Requirements:<ul class="mycode_list"><li>You have software that can create signals (and download the necessary data) at your disposal<br />
</li>
<li>Enough computer/programming skills to tell your software how to format the signals and where to place them on your computer<br />
</li>
</ul>
<span style="font-size: xx-large;" class="mycode_size">Setting up your Program(s)</span><br />
Make sure you can run any necessary signal generating and data downloading programs as command line executables (that will terminate).<br />
It is not necessary that your software is a command line exe, but it makes it easier to work with in general.<br />
The next thing you want to do is make sure your software can write signals (or a screener) to a file in the format specified in the guides.<br />
The directory that your strategy will read signal files from is located on the bottom right of your screen. Go ahead and modify your software so that it will write files to that directory.<br />
<br />
Note that APM can run other programs with command line arguments, meaning that you can take in the file directory as an argument rather than hard-coding it.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Setting up your APM Strategy</span><br />
We will be using the <span style="font-weight: bold;" class="mycode_b">External Program </span>section of the strategy settings to run your programs. First enable <span style="font-weight: bold;" class="mycode_b">Use External Program</span>.<br />
<br />
The<span style="font-weight: bold;" class="mycode_b"> File </span>and<span style="font-weight: bold;" class="mycode_b"> Arguments </span>fields are used to specify the program you would like to run.<br />
To schedule your program, put a cron string in the <span style="font-weight: bold;" class="mycode_b">Run External Program</span> field (refer to the <a href="https://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">cron</a> guide).<br />
<br />
If there is more than one program you need to run (i.e. one program to download data and one to generate the signals), then you have two options:<br />
<ol type="1" class="mycode_list"><li>Create a 'dummy' strategy that does nothing except run your second program on a schedule.<br />
</li>
<li>Create a batch file that will run all your programs. This is the more advanced option, so beware of problems such as not waiting for other processes to finish.<br />
</li>
</ol>
For reference, a simple batch file may look like:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>"C:/Users/DownloadData.exe"<br />
"C:/Users/GenerateSignals.exe"</code></div>
</div>
<br />
Note that if DownloadData.exe is not a command line executable, then the system may not wait for DownloadData.exe to finish before generating signals.<br />
In that case, you will want to try something like:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>powershell -Command "Start-Process 'C:/Users/DownloadData.exe' -Wait;Start-Process 'C:/Users/GenerateSignals.exe';"</code></div>
</div>
<br />
It is highly recommended that you test that your external program work as expected by manually running them (press the button beside <span style="font-weight: bold;" class="mycode_b">Run External Program</span>) and checking that your signals were generated in the correct folder.<br />
Once you have set up your external program to run, you can set up the other fields in the strategy settings as usual (make sure to use <span style="font-weight: bold;" class="mycode_b">Local File</span> or <span style="font-weight: bold;" class="mycode_b">File Screener </span>as your signal provider).<br />
Then you should check that the signals are correctly processed by pressing <span style="font-weight: bold;" class="mycode_b">Order Preview</span>.]]></description>
			<content:encoded><![CDATA[<span style="font-size: xx-large;" class="mycode_size">Automating your Self-Contained System</span><br />
This guide explains the steps to completely automate data download, signal creation, and signal processing.<br />
<br />
The following guides may be helpful:<ul class="mycode_list"><li><a href="https://aleratrading.com/forum/showthread.php?tid=2" target="_blank" rel="noopener" class="mycode_url">Stock Signals</a><br />
</li>
<li><a href="https://aleratrading.com/forum/showthread.php?tid=5" target="_blank" rel="noopener" class="mycode_url">Stock Screeners</a><br />
</li>
<li><a href="https://aleratrading.com/forum/showthread.php?tid=4" target="_blank" rel="noopener" class="mycode_url">Strategies</a><br />
</li>
<li><a href="https://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">Cron Scheduling</a><br />
</li>
</ul>
Requirements:<ul class="mycode_list"><li>You have software that can create signals (and download the necessary data) at your disposal<br />
</li>
<li>Enough computer/programming skills to tell your software how to format the signals and where to place them on your computer<br />
</li>
</ul>
<span style="font-size: xx-large;" class="mycode_size">Setting up your Program(s)</span><br />
Make sure you can run any necessary signal generating and data downloading programs as command line executables (that will terminate).<br />
It is not necessary that your software is a command line exe, but it makes it easier to work with in general.<br />
The next thing you want to do is make sure your software can write signals (or a screener) to a file in the format specified in the guides.<br />
The directory that your strategy will read signal files from is located on the bottom right of your screen. Go ahead and modify your software so that it will write files to that directory.<br />
<br />
Note that APM can run other programs with command line arguments, meaning that you can take in the file directory as an argument rather than hard-coding it.<br />
<br />
<span style="font-size: xx-large;" class="mycode_size">Setting up your APM Strategy</span><br />
We will be using the <span style="font-weight: bold;" class="mycode_b">External Program </span>section of the strategy settings to run your programs. First enable <span style="font-weight: bold;" class="mycode_b">Use External Program</span>.<br />
<br />
The<span style="font-weight: bold;" class="mycode_b"> File </span>and<span style="font-weight: bold;" class="mycode_b"> Arguments </span>fields are used to specify the program you would like to run.<br />
To schedule your program, put a cron string in the <span style="font-weight: bold;" class="mycode_b">Run External Program</span> field (refer to the <a href="https://aleratrading.com/forum/showthread.php?tid=8" target="_blank" rel="noopener" class="mycode_url">cron</a> guide).<br />
<br />
If there is more than one program you need to run (i.e. one program to download data and one to generate the signals), then you have two options:<br />
<ol type="1" class="mycode_list"><li>Create a 'dummy' strategy that does nothing except run your second program on a schedule.<br />
</li>
<li>Create a batch file that will run all your programs. This is the more advanced option, so beware of problems such as not waiting for other processes to finish.<br />
</li>
</ol>
For reference, a simple batch file may look like:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>"C:/Users/DownloadData.exe"<br />
"C:/Users/GenerateSignals.exe"</code></div>
</div>
<br />
Note that if DownloadData.exe is not a command line executable, then the system may not wait for DownloadData.exe to finish before generating signals.<br />
In that case, you will want to try something like:<br />
<br />
<div class="codeblock">
<div class="body" dir="ltr"><code>powershell -Command "Start-Process 'C:/Users/DownloadData.exe' -Wait;Start-Process 'C:/Users/GenerateSignals.exe';"</code></div>
</div>
<br />
It is highly recommended that you test that your external program work as expected by manually running them (press the button beside <span style="font-weight: bold;" class="mycode_b">Run External Program</span>) and checking that your signals were generated in the correct folder.<br />
Once you have set up your external program to run, you can set up the other fields in the strategy settings as usual (make sure to use <span style="font-weight: bold;" class="mycode_b">Local File</span> or <span style="font-weight: bold;" class="mycode_b">File Screener </span>as your signal provider).<br />
Then you should check that the signals are correctly processed by pressing <span style="font-weight: bold;" class="mycode_b">Order Preview</span>.]]></content:encoded>
		</item>
	</channel>
</rss>