Home › Forums › Trading System Mentor Course Community › Running Your Trading Business › Batchtrader ‘Unack’ trade order
- This topic is empty.
-
AuthorPosts
-
August 6, 2016 at 1:06 am #105006AnonymousInactiveJulian Cohen wrote::ohmy:
I might have to report you to the moderator for swearing in code😆 its all fun and games until someone misses a winning trade! at that point the coded swearing ramps up… 👿
August 7, 2016 at 5:40 pm #105004SaidBitarMemberDarryl Vink wrote:wait and see sounds good… if IB has a consistent way of reformatting symbols that replace a “.” with a space ” “, then we could potentially use another watchlist and some funky string replacements like:Code:If(inwatchlistname(“IB_SHITE”) {
symbolName = Name();
ibName = StrReplace(symbolName,”.”,” “);
AddTextColumn(WriteIf(BO1,”” + ibName,””),”Symbol”,1.3,29,55,90);
AddTextColumn(WriteIf(BO1,”STK”,””),”Type”,1.3,29,55,80);
AddTextColumn(WriteIf(BO1,””,””),”Expiry”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Strike”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”P/C”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Multiplier”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Trading Class”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,WriteIf(inwatchlistname(“ISLAND”),”ISLAND”,”SMART”),””),”Exchange”,1.3,29,55,80);
}else if(inwatchlistname(“ISLAND”) {
AddTextColumn(WriteIf(BO1,”” + Name(),””),”Symbol”,1.3,29,55,90);
AddTextColumn(WriteIf(BO1,”STK”,””),”Type”,1.3,29,55,80);
AddTextColumn(WriteIf(BO1,””,””),”Expiry”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Strike”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”P/C”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Multiplier”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Trading Class”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,WriteIf(inwatchlistname(“ISLAND”),”ISLAND”,”SMART”),””),”Exchange”,1.3,29,55,80);
}else {
AddTextColumn(WriteIf(BO1,”” + Name(),””),”Symbol”,1.3,29,55,90);
AddTextColumn(WriteIf(BO1,”STK”,””),”Type”,1.3,29,55,80);
AddTextColumn(WriteIf(BO1,””,””),”Expiry”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Strike”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”P/C”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Multiplier”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Trading Class”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,WriteIf(inwatchlistname(“ISLAND”),”ISLAND”,”SMART”),””),”Exchange”,1.3,29,55,80);
}AddTextColumn(WriteIf(BO1,””,””),”Primary Exchange”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,”USD”,””),”Currency”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Comb Legs”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Leave This Empty”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,”Buy”,””),”Action”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””+STB1,””),”Quantity”,1.0,29,55,Width);
AddTextColumn(WriteIf(BO1,”LMT”,””),”Order Type”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,”” + buyLimit,””),”Lmt Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Aux Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Ctrl”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Status”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Filled”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Remaining”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Ave Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Last Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Parent Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,”DAY”,””),”Time in Force”,1.3,29,55,Width1);nice Solution Darryl
i just made it smaller by removing redundant lines
Code:If(inwatchlistname(“IB_SHITE”) )
{
AddTextColumn(WriteIf(BO1,”” + StrReplace(Name(),”.”,” “),””),”Symbol”,1.3,29,55,90);
}
else
{
AddTextColumn(WriteIf(BO1,”” + Name(),””),”Symbol”,1.3,29,55,90);
}AddTextColumn(WriteIf(BO1,”STK”,””),”Type”,1.3,29,55,80);
AddTextColumn(WriteIf(BO1,””,””),”Expiry”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Strike”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”P/C”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Multiplier”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Trading Class”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,WriteIf(inwatchlistname(“ISLAND”),”ISLAND”,”SMART”),””),”Exchange”,1.3,29,55,80);
AddTextColumn(WriteIf(BO1,””,””),”Primary Exchange”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,”USD”,””),”Currency”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Comb Legs”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Leave This Empty”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,”Buy”,””),”Action”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””+STB1,””),”Quantity”,1.0,29,55,Width);
AddTextColumn(WriteIf(BO1,”LMT”,””),”Order Type”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,”” + buyLimit,””),”Lmt Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Aux Price”,1.3,29,55,Width);
AddTextColumn(WriteIf(BO1,””,””),”Ctrl”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Status”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Filled”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Remaining”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Ave Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Last Fill Price”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,””,””),”Parent Id”,1.3,29,55,Width1);
AddTextColumn(WriteIf(BO1,”DAY”,””),”Time in Force”,1.3,29,55,Width1);August 8, 2016 at 6:20 am #105011AnonymousInactiveSaid Bitar wrote:nice Solution Darryl
i just made it smaller by removing redundant lineseven better said
August 8, 2016 at 7:42 am #105012JulianCohenParticipantDarryl have you tested this to see if it works correctly with Batch Trader?
August 8, 2016 at 8:08 am #105013AnonymousInactiveJulian Cohen wrote:Darryl have you tested this to see if it works correctly with Batch Trader?i havn’t upgraded to the watchlist using “IB_SHITE” code yet julian but did run using the “ISLAND” watchlist… im still to get a signal from there though so not sure if using ISLAND in the routing of batchtrader works.
August 8, 2016 at 9:11 am #105014JulianCohenParticipantYes me too. I can’t run live and paper trading together as they have the same log ins otherwise I would just use some orders from mid last week and run it on the paper trading. I might still do that anyway and skip a day’s trades just to be sure all is OK
August 8, 2016 at 9:23 am #104829Nick RadgeKeymasterWhy would AB code effect BatchTrader?
August 8, 2016 at 9:35 am #105016JulianCohenParticipantI had problems with the MOC version whenI had an unexpected blank space in the CSV file. This resulted in the MOC Batch Trader not issuing the MOC orders, so as I am naturally suspicious of any untested aspect of software due to my innate ability to break it, I will always test anything that I haven’t done before.
Although Levente then corrected the software to allow for any unexpected spaces, there could always be something else. Better to check it to be sure.
I’ll do a test tonight with some old data that has MSFT, BRK.B, in it to be sure it will work with the MOC Batch Trader.
August 8, 2016 at 12:46 pm #105015AnonymousInactiveJulian Cohen wrote:… I can’t run live and paper trading together as they have the same log ins…julian do you not have a seperate paper trading username you can use? shown from IB Account Management website at:
Manage Account -> Settings -> Paper TradingAugust 8, 2016 at 1:26 pm #105017JulianCohenParticipantDoesn’t matter. I’m running a test tonight. I’ll let you know how it goes. Market opens in 3 mins
August 8, 2016 at 1:35 pm #105018JulianCohenParticipantJust as well I tested it. It didn’t work and immediately sold the position! Because I just remembered I should have added Island to the dialog box that sets the time for executing the MOC:
SMART=05:40,ISLAND=05:40,ASX=15:45
So it filled the order as a market order. I’ll test it again tomorrow alongside the live trading which Daryl has helpfully shown me how to use properly.
Next 10,000 trades!
August 8, 2016 at 3:38 pm #105019JulianCohenParticipantI tested it again and I have found a genuine bug. IB filled an MOC order immediately instead of on the close. Levent has given me a list of questions to send to IB as to why this behaviour has happened. In the mean time, don’t try the ISLAND code we have written if you are using MOC orders.
August 8, 2016 at 3:56 pm #105021SaidBitarMemberso if you use ISLAND then it is filled as market order instead of MOC?
August 8, 2016 at 11:16 pm #105022JulianCohenParticipantYes, however I am testing it in the Paper Trading not live. IB just replied with a long explanation of why Paper Trading is unlike real trading…I have placed it here in case others would like to read it.
I replied telling them this was a little different as an order type was ignored and explained what I was trying to test so I’m waiting on the reply.
Apparently I have also changed sex :woohoo:Dear Ms. Cohen,
A real MOC, MOO, LOC and LOO order is given to the primary exchange’s specialist to be included in the opening or closing cross. An IB Paper Trader exists on an IB server and orders are not sent to an exchange or a Specialist. Therefore the Opening and Closing order type can not be accurately simulated.
The free simulation account is available to help learn to use the platform. If you want real world results then you have to use your real account. The Paper Trader simulates market data and bid/ask size as it does not read the total depth of all resting orders at a real exchange.
Why does the Paper Trader simulated execution not match the real market time and sales ?
LINK../252
Here is the information regarding the Paper Trader that is available on the IB web site. As you will see below there is no guarantee to the Paper Trader being as accurate as a real account. Also, there are no time or price comparisons to executions from a real account.Limitations of the PaperTrader:
Although the paper trading account simulates most aspects of a production TWS account, you may encounter some differences due to its construction as a simulator with no execution or clearing abilities. These differences include but are not limited to:
–No support for some order types including: VWAP, Auction, RFQ, and Pegged to Market.
–Fills are simulated from the top of the book; no deep book access.
–Limited combo and EFP trading.
–Stops and other complex order types are always simulated in paper trading; this may result in slightly different behavior from a TWS production account.
–Penny trading for US Options is not supported. You will be able to submit the order but it will not receive a penny fill.
–The trade simulator will reject the remainder of any exchange-direct ed market order that partially executes. This may or may not match behavior of a real-world exchange. Market orders received while there is no quote on the opposite side will be held until the market data arrives (i.e. until the first partial fill).
–Mutual Fund trading is not supported via IB PaperTrader.How It Works:
–The TWS PaperTrader works just like your production account. You can use most IB order types, trade all contracts available through the TWS, and experiment with almost every aspect of the TWS platform.
–The PaperTrader interface clearly indicates that you are working in a simulated account. If you do not see this, you are trading in your production account and will be liable for all trades that fill.
–Trades entered into this paper trading account will not actually execute on any exchange or settle at a clearing house. However, the price of your executions will be determined by real market prices and sizes.
–Trading permissions, market data subscriptions, base currency, and other account configurations are the same as specified for your regular account.
–A paper trading account statement will be provided each day and is available by logging into Account Management with your PaperTrader login and accessing the Reports menu.
–All customers will start with USD 1,000,000 of paper trading Equity with Loan Value, and this equity will fluctuate as if the trades had executed in the real market.
–You may reset your cash equity at any time by accessing Account Management for your paper trading account and selecting Paper Trading Account Reset (in the Trading Access menu in Legacy Account Management, and in the Trade menu in Account Management V2.0). Your account will be reset to the greater of either USD 100,000 or two times the total equity of the user’s production account. Note that reset requests should be entered before 16:00 ET in order to take effect for the next business day.August 9, 2016 at 1:59 pm #105023JulianCohenParticipantThe continuation:
Hi Jim,
I understand that the Paper Trading account cannot always simulate real time trading however in this case it closed an MOC order as if it were a Market order. It was not a one off instance as I placed a couple of these orders and the same thing happened, I just sent you full details of one.
This occurred alongside a number of other orders that were also placed as MOC and these were not closed. The only difference between the MOC order that was closed incorrectly and the one that was not was the MOC order that closed incorrectly was marked as ISLAND and the ones that worked were marked as SMART.
I am testing a way to avoid the problem that happens when the Ticker symbol that is used by the data provider is different from the ticker symbol in the various exchanges. In this instance if I place an order for CSCO (Cisco) in SMART it will be rejected but if I place it in ISLAND it is accepted. This appears to be a known problem and I am testing a work around.
With this knowledge does your answer still stand?
Julian Cohen
2016/08/08
19:12:55 cohen888 Ticket reopened on Customer Request
2016/08/09
09:48:36 IBCS Dear Ms. Cohen,The answer remains the same.
JIm
2016/08/09
09:57:12 cohen888Well that sucks big hairy ones!
And I am not female.
-
AuthorPosts
- You must be logged in to reply to this topic.