Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Happy new year to all traders!
I´ve been trading for a while now but I´m quite new still to automated trading and even if I read a hundred posts and manuals I can´t find the solution. A bit of help would be very much appreciated.
Goal: backtest an arbitrage strategy that trades 2 instruments at the exact same time
Strategy core : if %change tickerA +% change ticker B < -1 then buy. exit when >0
Issues:
-even if there are 2 data sources in a chart just data 1 is traded
-If I open 2 charts ( to combine the 2 performance reports manually afterwards) with tickerA as data 1 and tickerB as data2 in one of them, and tickerB as data 1 , tickerA as data2 in the other one , the resulting operations are different. ( if A +B = x; then B+A should be X as well, but it´s not)
-maybe tradestation does not plot prices if there are no trades, and there´s a false signal because ticker A does not have price and B does??(I have no clue)
I have tried using portfolio maestro with all possible combinations (using 2 separate strategies for each data, combining everything…) and same problem, entries and exits don´t match in booth instruments.
Possible solutions that I don´t know how to code:
-Strategy that enters / exits positions in ticker B just when the same happens in ticker A ( For live trading I can use macros , but I have no idea for normal backtest or portfolio maestro)
-Something that gets the exact time of positions in A and then replicates in B...
Code till now:
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,033 since Dec 2013
Thanks Given: 4,359
Thanks Received: 10,172
Try using 2 workspaces each with 3 data sources.
First workspace your data sources are Ticker A, Ticker A (again) and Ticker B.
Second workspace your data sources are Ticker B, Ticker A and Ticker B (again).
Make all your calculations/decisions based upon data feeds 2 and 3, which are the same on both workspaces. So same code for both except when you buy on 1/A you sell on 2/B. This has worked for me in previously.
The following user says Thank You to SMCJB for this post:
I am not familiar with the Tradestation platform, but can you create a synthetic security with the pair, then trade it using a mean-reverting technical indicator to make it more straightforward? (e.g. stochastics, RSI, bollinger bands, etc.)
Security A = Ticker1 - Ticker 2
Buy when RSI(14) of Security A = 25, sell @ 75
You would have to balance the dollar amounts of the securities according to their relative notional value and volatility as well.
The following user says Thank You to drm7 for this post:
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,033 since Dec 2013
Thanks Given: 4,359
Thanks Received: 10,172
You can create an indicator that would display your synthetic security but can't trade it. In tradestation a workspace will only trade the instrument displayed in data1 and it has to be a single real security.