Home › Forums › Trading System Mentor Course Community › Running Your Trading Business › Full Automation of Amibroker > TWS
- This topic is empty.
-
AuthorPosts
-
November 20, 2019 at 5:37 am #101971Nick RadgeKeymaster
We were approached several months ago from a group out of Canada that have software that enables full automation between Norgate > Amibroker > TWS
There is a course that teaches you how to do it HERE
In the course they refer to software called Alera which pulls it altogether.
Bottom line is that you can fully automate data download, order generation, order placement and then order management for a full week without any human intervention.
Alera is a subscription service. Pricing Page
Review by JB Marwood HERE
November 20, 2019 at 6:11 am #110594JulianCohenParticipantDo you happen to know if it can auto-update your account balance each day?
November 20, 2019 at 6:46 am #110597AnonymousInactiveNick, when you say you were approached, did you end up helping out with the project? Or did they work with someone else?
November 20, 2019 at 8:31 am #110598Nick RadgeKeymasterJulian,
I get the impression it can – but not 100% certain. It does require you to nominate size of funds and number of strategies, so it may be referencing that.Matt,
No, they approached me because of my systems experience with Amibroker. Obviously looking for distribution. Interestingly it wasn’t the software company (Alera), it was the guys who wrote the course that shows you how to integrate it all. They must be affiliates.In my view it’s quite an expense. We get most of the job done with minimal daily input using the API. I’ve never felt pressured or needed it to be 100% automated.
Nick
November 20, 2019 at 8:45 pm #110599JulianCohenParticipantI emailed them and got a very detailed answer. In short they said:
if you are trading a portfolio or even just more than one position and set the equal weight position sizing so that the percentage for the position size is fixed (for example “I want to trade 10 positions with 10% each position each day) then the answer is a simple “yes”. This is by default how Alera Portfolio Manager works and how I use it. So if you account value changes, it will re-adjust new positions based on your current account size and your 10% in this example would represent 10% of the available cash allocated that specific day (at the time of placing order).
November 20, 2019 at 10:37 pm #110600AnonymousInactiveI wonder how it would roll with managing two separate systems simultaneously with different sizing allocations? That is, system one with 10 positions 10 percent and system two with 20 positions 5 percent. Then the fly in the ointment is probably varying levels of margin as well (say, system one is overnight at 2x and system two is intra-day at 4x).
November 21, 2019 at 12:11 am #110601JulianCohenParticipantI would suggest it wouldn’t have a problem with that. Everything seems to be set off Amibroker and batch runs through Amibroker.
This is the email they sent me
Thank you for your email. I’ve copied a few colleagues on this email in case they have more insights.
If I am understanding your question correctly, if you are using the built in position sizing in Alera Portfolio Manager (APM) (i.e. choosing to equal weight your position), then this would just naturally be based on the NAV that APM reads in your account at the time of ordering, so that the position size would change each day based on current funds in your account at the time of placing orders. This is more of a portfolio based equal weighting approach.
There is also functionality to use Custom Lot Size. I have not personally implemented this approach but it sounds like it would be a coding issue, and do believe it’s probably possible. You can read more about it here — https://aleratrading.com/forum/showthread.php?tid=4 (you may need to register for free access to the http://www.aleratrading.com forum to read).
If you are just trading a few symbols each day then you can specify allocations, scaling like adding to positions and subtracting from positions and the like. Here’s a bit more information that might be even more helpful http://aleratrading.com/forum/showthread.php?tid=2 You’ll note that you can use things such as the below…
Because I don’t currently do any intraday trading myself, I have not implemented these features but do believe they are possible. If you have a specific use case, feel free to send it along and perhaps we can take a look to see what the implementation might look like or provide more detailed guidelines on how to achieve that implementation. (See below)
Regards,
Dave
Quantity and Units
The quantity is used to specify how much of a stock is bought. When a quantity is specified, the unit must also be specified.Shares (SHARES)
Specifies the number of shares to buy
Dollars ($)
Specifies the total dollar value to be bought
Percent Portfolio (%PORTFOLIO)
Specifies that the total dollar value bought should be a percent of the portfolio/strategy allocation
Percent Position (%POSITION)
Specifies that the total dollar value bought should be a percent of the current position (this means if the current position is neutral, then the signal is ignored)
Percent Cash (%CASH)
Specifies that the total dollar value bought should be a percent of the current cash available to the strategy
Available cash is calculated as: strategy allocation – total exposure = portfolio allocation – (long exposure + short exposure)
Note that whatever asset you are purchasing will not be included in the total exposure calculation
For example, if strategy allocation is $10,000 and you are long $1,000 of AAPL, short $500 of IBM, and long $500 of SPY, then the signal
LONG SPY 50 %CASH
would see that total exposure is $1,500 (AAPL and IBM), so available cash if $10,000-$1,500 = $8,500, so we want $4,250 of SPY, which means we need to BUY $3750 of SPY (since we already have $500)
This unit type may be confusing to understand at first, but it will make more sense as you read the rest of the documentation.
Custom Lots (LOTS)
Specifies that the unit to be used is whatever the user specified in the Custom Lot Size field in the strategy window.
Note that the Custom Lot Size field is limited to the Shares and Dollars as units.At a complete guess I would suggest that Alera would run one system after the other through Amibroker applying the operational code for each system. In theory it should also be keeping a running total of each systems account allocation, although that part I’m not 1200% sure of. I will email them to answer that specific question and let you know.
November 21, 2019 at 5:25 am #110602AnonymousInactiveI wonder if it can ‘clean up’ certain issues I know I have to do manually, daily.
Limit order entry price: Even with the tick code in place I find every now and then a symbol at 83.45999 still gets through so I have to manually adjust it to 83.46 before saving the spreadsheet.
Symbol codes from Norgate: sometimes I’ll get a BRK.B or similar but TWS doesn’t know this, so I manually have to change to BRK B (a space, not a dot). I don’t trade AU markets, so I am guessing all the XXX.au symbols from Norgate wouldn’t play well with IB either.
I don’t mind doing these small things daily either. It helps me stay connected to it and ensure I give everything a quick check before hitting the send orders button.
November 21, 2019 at 9:35 pm #110603Stephen JamesMemberMatt
Just put the symbols like BRK.B into a watchlist and exclude them from trading.You can exclude the watchlist in the analyser filter or by code:-
WatchList = InWatchListName(“US Exclude”);
Then add an entry condition such as:
AND NOT Watchlist.
Note, the Name of the watchlist must match exactly – case, space etc.November 21, 2019 at 10:52 pm #110604JulianCohenParticipantMatthew O’Keefe wrote:Limit order entry price: Even with the tick code in place I find every now and then a symbol at 83.45999 still gets through so I have to manually adjust it to 83.46 before saving the spreadsheet.I get this too. Craig any ideas on that?
November 21, 2019 at 10:54 pm #110595JulianCohenParticipantFollow up from Alera:
Dave mentioned that you’re interested in automating your strategies using AmiBroker and Alera. He cc-ed me on the last few emails in case you have more technical questions related to Alera. I currently run quite a few strategies in fully automated mode using Alera and I might be able to answer some of your questions:
With Alera you can allocate a fixed amount per strategy exactly they way you described it and then allocate a percentage of that for each position taken. Alternatively you can allocate a percentage of the whole account to a specific strategy and then allocate a percentage of that to each position. You have fairly good flexibility that way.
You’ve also mentioned that you would like to send limit orders and then close the positions at the end of day. In order to achieve that you would place the limit orders in the morning (or anytime during the day) using a BTO LMT order and you would send a STC MOC order let’s say at 3:45PM for ALL limit orders sent during the day.
The STC MOC ( SellToClose MarketOnClose) order will do 2 things:
1. Will create a Sell order if a position is open for that specific symbol
AND
2. Will cancel the LMT orders for the orders that have not been filled
Note: it will do both 1. And 2. For orders that have been only partially filled.I assume that’s the exact behaviour you’re expecting.
Due to its flexibility in creating orders and managing positions the are a few nuances that have to be taken in consideration so the best way to attack it would probably be to go first over Dave’s integration course and then download Alera and use it on a paper trading account using the 3 month free license.
I’m in two minds. I like the idea of setting it all up on Sunday and then leaving it until the following Saturday. But I also like to double check the trades each day against the backtest, and scan the entries for the next day, plus correct the odd tic issue.
November 21, 2019 at 11:12 pm #110605AnonymousInactiveHi Craig.
Yes I already run an exclude list. On some of these symbols that have a dot or a space for a secondary symbol for a class of stock I do still like to leave the primary symbol available for trading.
FWONA or FWONK is fine as it is only a lettered difference. Just pop the one I don’t want to trade into the exclude list. LGF.A or LGF.B is where the issue lays. I keep LGF.B in my exclude list but still keep LGF.A available to trade. In this case whenever LGF.A pops up in the exploration I simply have to delete the dot and replace with a space manually in the trade sheet before saving and sending the orders from API to TWS.
Sure, simple solution is to put any symbol with these dots instead of spaces into the exclude list but as I say, if they otherwise fit my criteria to trade them, then why not. My question was more along the lines of whenever there are differences like these between the Norgate nomenclature and the Interactive Brokers nomenclature, if this Alera solution would be able to tidy up these discrepancies e.g. replacing dots with spaces to ensure everything lines up. Not a gigantic problem in the grand scheme of things though.
November 22, 2019 at 1:42 am #110606ScottMcNabParticipantJulian Cohen wrote:Follow up from Alera:I’m in two minds. I like the idea of setting it all up on Sunday and then leaving it until the following Saturday. But I also like to double check the trades each day against the backtest, and scan the entries for the next day, plus correct the odd tic issue.
Makes me break out in cold sweat just thinking about how badly I would screw this up
November 22, 2019 at 2:35 am #110596JulianCohenParticipantMatthew I have another watchlist, called “IB_SHITE” This contains tickers such as LGF.B BRK.B and BF.B
Then this code accesses that watchlist and replaces string as needed. You should be able to slot this in to your code where it’s needed.
Code:if (InWatchListName(“IB_SHITE”) )
{
AddTextColumn(WriteIf(LESetup,”” + StrReplace(Name(),”.”,” “),””),”Symbol”,1.3,29,55,90);
}
else
{
AddTextColumn(WriteIf(LESetup,”” + Name(),””),”Symbol”,1.3,29,55,90);
}AddTextColumn(WriteIf(LESetup,”STK”,””),”Type”,1.3,29,55,80);
AddTextColumn(WriteIf(LESetup,””,””),”Expiry”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Strike”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”P/C”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Multiplier”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Trading Class”,1.3,29,55,Width);
/* Corrections for Batch Trader Unack error */
AddTextColumn(WriteIf(LESetup,WriteIf(inwatchlistname(“ISLAND”),”ISLAND”,”SMART”),””),”Exchange”,1.3,29,55,80);
AddTextColumn(WriteIf(LESetup,””,””),”Primary Exchange”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,”USD”,””),”Currency”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Comb Legs”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Leave This Empty”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,”BUY”,””),”Action”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””+NumOfShares,””),”Quantity”,1.0,29,55,Width);
AddTextColumn(WriteIf(LESetup,”LMT”,””),”Order Type”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””+BuyLim,””),”Lmt Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Aux Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(LESetup,””,””),”Ctrl”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Status”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Filled”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Remaining”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Ave Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Last Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,””,””),”Parent Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(LESetup,”DAY”,””),”Time in Force”,1.3,29,55,Width1);}
December 1, 2019 at 2:06 am #110607AnonymousInactiveHey guys,
I noticed this from JB Marwood’s blog. Looks interesting. Am I understanding correctly that this would fully-automate the trade placement process and also eliminate the need to use the API?Regarding the price limit decimal issue that you guys noted, I use the following code to clean that up automatically. It will round to two decimal places:
//Buy Limit Price
function PrecRound( value, decplaces ) {
return Prec( value + 5*10^-(decplaces+1), decplaces );
}BuyLim = C – Stretchlimit;
BuyLimit = PrecRound(BuyLim, 2); -
AuthorPosts
- You must be logged in to reply to this topic.