Pairs trading - EasyLanguage Programming | futures io social day trading
futures io futures trading


Pairs trading
Updated: Views / Replies:139 / 7
Created: by asieretxebe Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Pairs trading

  #1 (permalink)
Trading Apprentice
Bilbao , Spain
 
Trading Experience: Beginner
Platform: Ninjatrader , Metatrader
Favorite Futures: FDAX, Emini ES, EURUSD
 
Posts: 4 since Mar 2017
Thanks: 2 given, 1 received

Pairs trading

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:

inputs: variable1 (100000) , variable2 (-1) , variable3 (0);

Value1 = ((open-CloseD(1))/CloseD(1)) ;
Value2 = ((open data2-(CloseD(1) data2))/CloseD(1) data2) ;
value3 = ((value1 +value2)*100);
value4 = (Round(((variable1)/closeD(1)),0));

Condition1 = marketposition = 0 and Value3<variable2 ;
Condition2 = MarketPosition = 1 and value3>variable3 or ( Time >2150);

If condition1 then buy (value4) shares next bar at market;
If condition2 then sell all shares next bar at market;

Sorry for the long post, and thank you so much in advance for any help or ideas!!!
[][]

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Houston, TX
 
Trading Experience: Advanced
Platform: XTrader
Broker/Data: Advantage Futures
Favorite Futures: Energy
 
Posts: 2,674 since Dec 2013
Thanks: 2,146 given, 4,654 received
Forum Reputation: Legendary


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.

Reply With Quote
The following user says Thank You to SMCJB for this post:
 
  #4 (permalink)
Trading Apprentice
Virginia
 
Trading Experience: Intermediate
Platform: TradingView, Seasonalgo
Favorite Futures: CL,ES,GC,Spreads
 
Posts: 43 since Oct 2010
Thanks: 128 given, 36 received

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.

Reply With Quote
The following user says Thank You to drm7 for this post:
 
  #5 (permalink)
Market Wizard
Houston, TX
 
Trading Experience: Advanced
Platform: XTrader
Broker/Data: Advantage Futures
Favorite Futures: Energy
 
Posts: 2,674 since Dec 2013
Thanks: 2,146 given, 4,654 received
Forum Reputation: Legendary


drm7 View Post
I am not familiar with the Tradestation platform, but can you create a synthetic security

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.

Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Bilbao , Spain
 
Trading Experience: Beginner
Platform: Ninjatrader , Metatrader
Favorite Futures: FDAX, Emini ES, EURUSD
 
Posts: 4 since Mar 2017
Thanks: 2 given, 1 received


SMCJB View Post
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.

Good idea that could solve the problem. Thanks! I will test it on monday and update

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Bilbao , Spain
 
Trading Experience: Beginner
Platform: Ninjatrader , Metatrader
Favorite Futures: FDAX, Emini ES, EURUSD
 
Posts: 4 since Mar 2017
Thanks: 2 given, 1 received


SMCJB View Post
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.


drm7 View 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.

Yes I could build sinthetic data but I keep having the same. Problem. When comparing ticker A to sinthetic data X and ticker B to sinthetic data X

Reply With Quote
 
  #8 (permalink)
Trading Apprentice
Bilbao , Spain
 
Trading Experience: Beginner
Platform: Ninjatrader , Metatrader
Favorite Futures: FDAX, Emini ES, EURUSD
 
Posts: 4 since Mar 2017
Thanks: 2 given, 1 received


SMCJB View Post
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.

I tried adding the 3 datas and it works even for portfolio maestro. Thank you so much !!

Reply With Quote
The following user says Thank You to asieretxebe for this post:

Reply



futures io > > > > > Pairs trading




Upcoming Webinars and Events (4:30PM ET unless noted)
 

Journal Challenge $1600 in Prizes & Free Journalytix for all participants!

February
 

Trading Resolutions for 2019 - Avoiding Mistakes w/GFF Brokers

Feb 19
 

3 Excellent Entries, and How To Automate Them w/Kevin Davey

Feb 21
 

The Driving Force Behind the Market w/Earn2Trade

Mar 5
 

TBA w/Stage5 & iSystems

Mar 12
 

TBA w/John Grady @ No BS Day Trading

Mar 19
 

Day Trading Oil Futures: Reducing Risk & Increasing Profits w/DTN IQFeed

Mar 26
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Will trading multiple pairs make my trading results inconsistent ?? sharpshoota Currency Futures 10 August 11th, 2015 10:54 AM
Pairs Trading Strategy - Quantitative Trading mandreot Elite Automated NinjaTrader Trading 1 July 1st, 2015 06:47 PM
Algorithmic pairs trading sysot1t Elite Automated Trading 64 April 8th, 2015 07:52 PM
Spread / Pairs trading indicators Mehul Stocks and ETFs Trading 3 November 13th, 2011 04:54 PM
Currency Pairs with the Widest Trading Ranges shodson Traders Hideout 1 January 5th, 2010 05:51 PM


Tags
2 data, 2 symbol, 2data, 2symbols, arbitrage, automated trading, backtest, backtesting, buy, code, data, easy language, easy language programming, easylanguage, es, how to, indicator, indicators, live trading, marketposition, multicharts, multiple data, neoticker, pairs, pairs trading, portfolio, rsi, signal, stochastics, strategies, strategy, tradestation, trading, update, variable, volatility, workspace

All times are GMT -4. The time now is 11:01 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2019-02-17 in 0.19 seconds with 13 queries on phoenix