FXCorrelator - NinjaTrader | futures io social day trading
futures io futures trading


FXCorrelator
Updated: Views / Replies:3,889 / 20
Created: by danjuma Attachments:5

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 90,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
 5  
 
Thread Tools Search this Thread
 

FXCorrelator

  #1 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker/Data: IB, Kinetic
Favorite Futures: Stocks, Forex
 
Posts: 97 since Nov 2011
Thanks: 47 given, 16 received

FXCorrelator

Hello,

There is a forex indicator for Metatrader called 'FXCorrelator' from a popular member on T2W called NVP. Just wondered if anybody knows whether somebody has managed to code this in Ninja Trader? I am interested in the indicator, but I use IB for my data feed and Metatrader don't work with IB. Further info about the indicator can be got from the links below:

The FXCorrelator |FXCORRELATOR
Best Thread: Correlation Trading - Basic Ideas and Strategies
FXCorrelator - Scalping system @ Forex Factory


Many thanks.
Dan

Reply With Quote
 
  #2 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker/Data: IB, Kinetic
Favorite Futures: Stocks, Forex
 
Posts: 97 since Nov 2011
Thanks: 47 given, 16 received

File attached. Hoping some NT Script expert with some free time to spare can assist in converting this to work on NT. A hundred thanks in advance.

Attached Files
Register to download File Type: mq4 FXCORRELATOR_BASIC_FREE_VERSION.mq4 (6.6 KB, 27 views)

Last edited by danjuma; February 27th, 2012 at 11:56 AM.
Reply With Quote
 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


The indicator is relatively easy to code. It just looks at a slow linear weighted moving average of the major currency pairs now and 1 period ago. Then the results are added up for each currency pair to calculate an index representing the strength of that currency.


The indicator has two conceptual weaknesses:

(1) When evaluating the strength of the USD, its relative position against the NZ dollar is considered as important as its relative position against the EUR. I do not believe that this makes sense, but that the different currency pairs need to weighted according to their liquidity.

(2) The different positions are weighted by using an arithmetical mean. An arithmetical mean is quite sensitive to outliers, a geometrical mean would have been the better choice.

An example, how to define a currency index is the US dollar index. It does not take into account the NZD, but takes the EUR, JPY, GBP, CAD, SEK and CHF. The Euro accounts for over 50%.

A more complex example is the Broad Index, which is published by the FED. It has a higher weighting of the Japanese Yen, as the Chinese currency is not yet freely convertible.


It is relatively easy to convert the indicator to NinjaTrader and improve it at the same time.

Reply With Quote
The following 4 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker/Data: IB, Kinetic
Favorite Futures: Stocks, Forex
 
Posts: 97 since Nov 2011
Thanks: 47 given, 16 received


Fat Tails View Post
It is relatively easy to convert the indicator to NinjaTrader and improve it at the same time.

Would you be willing to spare some of your precious time and do this my dear sir?

Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


danjuma View Post
Would you be willing to spare some of your precious time and do this my dear sir?

I am certainly willing, but will not find the time during the next weeks.

Reply With Quote
 
  #6 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker/Data: IB, Kinetic
Favorite Futures: Stocks, Forex
 
Posts: 97 since Nov 2011
Thanks: 47 given, 16 received


Fat Tails View Post
I am certainly willing, but will not find the time during the next weeks.

No problem sir, when never you find the time. Be warned though, I will be on your back until you do

Reply With Quote
 
  #7 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


danjuma View Post
No problem sir, when never you find the time. Be warned though, I will be on your back until you do

Why don't you code it yourself. It would be a rewarding exercise to start with.

Reply With Quote
 
  #8 (permalink)
Elite Member
London, UK
 
Futures Experience: Beginner
Platform: NinjaTrader, IB TWS
Broker/Data: IB, Kinetic
Favorite Futures: Stocks, Forex
 
Posts: 97 since Nov 2011
Thanks: 47 given, 16 received


Fat Tails View Post
Why don't you code it yourself. It would be a rewarding exercise to start with.

Ok, currently learning the basics of NTScripts. Might give it a try if you could give me some pointers to start with

Many thanks.

Reply With Quote
 
  #9 (permalink)
Elite Member
Fort Collins, Colorado
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: ES
 
Posts: 57 since Feb 2011
Thanks: 48 given, 43 received

Hi Danjuma, I am not a coding wizard like some of on the site, but it looked like an interesting project, so I coded my own version. I used an SMA instead of a Weighted average, and I found it to be more useful if you change the smoothing out to say, a 50 period SMA, but you can change it to whatever you want.

Something to note, my coding is not clean, in the sense that it is ugly from a programmer's perspective, but it seems to do what your model does, and I didn't want to use his code, since obviously, if this violates someones proprietary code, it has to come down. Also, I didn't compile and export, so if you want to use it, you'll have to copy and paste it into your own ninjascript. (It looks better on a dark chart)

Hope it gives you some ideas for making your own.

Cheers,
FCtrader

 
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Replicates the FX Correlator from FXCorrelator.com
    /// </summary>
    [Description("Replicates the FX Correlator from FXCorrelator.com")]
    public class FXcorrelator : Indicator
    {
        #region Variables
        // Wizard generated variables
            private int movAvgLength = 50; // Default setting for MovAvgLength
			private double deltaEURUSD;
			private double deltaGBPUSD;
			private double deltaAUDUSD;
			private double deltaUSDCHF;
			private double deltaUSDJPY;
			private double deltaNZDUSD;
			private double deltaUSDCAD;
			private double USD_strength;
			private double EUR_strength;
			private double GBP_strength;
			private double AUD_strength;
			private double CHF_strength;
			private double JPY_strength;
			private double NZD_strength;
			private double CAD_strength;
		
        // User defined variables (add any user defined variables below)
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Add("$EURUSD",BarsPeriod.Id,BarsPeriod.Value);
			Add("$GBPUSD",BarsPeriod.Id,BarsPeriod.Value);
			Add("$AUDUSD",BarsPeriod.Id,BarsPeriod.Value);
			Add("$USDCHF",BarsPeriod.Id,BarsPeriod.Value);
			Add("$USDJPY",BarsPeriod.Id,BarsPeriod.Value);
			Add("$NZDUSD",BarsPeriod.Id,BarsPeriod.Value);
			Add("$USDCAD",BarsPeriod.Id,BarsPeriod.Value);
			Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "USD"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "EUR"));
            Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "GBP"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Cyan), PlotStyle.Line, "CAD"));
			Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "CHF"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "JPY"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Pink), PlotStyle.Line, "NZD"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.Line, "AUD"));
			
            Add(new Line(Color.FromKnownColor(KnownColor.Black), 0, "ZeroLine"));
            Overlay				= false;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            
			if(CurrentBar==0){return;}
			deltaEURUSD = 100*(SMA(Closes[1],MovAvgLength)[0]-SMA(Closes[1],MovAvgLength)[1])/SMA(Closes[1],MovAvgLength)[0];
			deltaGBPUSD = 100*(SMA(Closes[2],MovAvgLength)[0]-SMA(Closes[2],MovAvgLength)[1])/SMA(Closes[2],MovAvgLength)[0];
			deltaAUDUSD = 100*(SMA(Closes[3],MovAvgLength)[0]-SMA(Closes[3],MovAvgLength)[1])/SMA(Closes[3],MovAvgLength)[0];
			deltaUSDCHF = 100*(-(SMA(Closes[4],MovAvgLength)[0]-SMA(Closes[4],MovAvgLength)[1]))/SMA(Closes[4],MovAvgLength)[0];
			deltaUSDJPY = 100*(-(SMA(Closes[5],MovAvgLength)[0]-SMA(Closes[5],MovAvgLength)[1]))/SMA(Closes[5],MovAvgLength)[0];
			deltaNZDUSD = 100*(SMA(Closes[6],MovAvgLength)[0]-SMA(Closes[6],MovAvgLength)[1])/SMA(Closes[6],MovAvgLength)[0];
			deltaUSDCAD = 100*(-(SMA(Closes[7],MovAvgLength)[0]-SMA(Closes[7],MovAvgLength)[1]))/SMA(Closes[7],MovAvgLength)[0];
			
			USD_strength = -(deltaEURUSD+deltaGBPUSD+deltaAUDUSD+deltaNZDUSD+deltaUSDCAD+deltaUSDJPY+deltaUSDCHF)/7;
			EUR_strength = deltaEURUSD-(deltaGBPUSD+deltaAUDUSD+deltaNZDUSD+deltaUSDCAD+deltaUSDJPY+deltaUSDCHF)/6;
			GBP_strength = deltaGBPUSD-(deltaEURUSD+deltaAUDUSD+deltaNZDUSD+deltaUSDCAD+deltaUSDJPY+deltaUSDCHF)/6;
			AUD_strength = deltaAUDUSD-(deltaEURUSD+deltaGBPUSD+deltaNZDUSD+deltaUSDCAD+deltaUSDJPY+deltaUSDCHF)/6;
			CHF_strength = deltaUSDCHF-(deltaEURUSD+deltaAUDUSD+deltaNZDUSD+deltaUSDCAD+deltaUSDJPY+deltaGBPUSD)/6;
			JPY_strength = deltaUSDJPY-(deltaEURUSD+deltaAUDUSD+deltaNZDUSD+deltaUSDCAD+deltaGBPUSD+deltaUSDCHF)/6;
			NZD_strength = deltaNZDUSD-(deltaEURUSD+deltaAUDUSD+deltaGBPUSD+deltaUSDCAD+deltaUSDJPY+deltaUSDCHF)/6;
			CAD_strength = deltaUSDCAD-(deltaEURUSD+deltaAUDUSD+deltaNZDUSD+deltaGBPUSD+deltaUSDJPY+deltaUSDCHF)/6;
			
			
            USD.Set(USD_strength);
            EUR.Set(EUR_strength);
            GBP.Set(GBP_strength);
            CAD.Set(CAD_strength);
			CHF.Set(CHF_strength);
            JPY.Set(JPY_strength);
            NZD.Set(NZD_strength);
            AUD.Set(AUD_strength);
        }

        #region Properties
        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries USD
        {
            get { return Values[0]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries EUR
        {
            get { return Values[1]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries GBP
        {
            get { return Values[2]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries CAD
        {
            get { return Values[3]; }
        }
		[Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries CHF
        {
            get { return Values[4]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries JPY
        {
            get { return Values[5]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries NZD
        {
            get { return Values[6]; }
        }

        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries AUD
        {
            get { return Values[7]; }
        }

        [Description("Defines Smoothing length")]
        [GridCategory("Parameters")]
        public int MovAvgLength
        {
            get { return movAvgLength; }
            set { movAvgLength = Math.Max(1, value); }
        }
        #endregion
    }
}


Last edited by fctrader; February 28th, 2012 at 07:39 PM. Reason: Put code in code window
Reply With Quote
The following 2 users say Thank You to fctrader for this post:
 
  #10 (permalink)
Elite Member
Fort Collins, Colorado
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: ES
 
Posts: 57 since Feb 2011
Thanks: 48 given, 43 received


After playing with it for a few minutes on a daily chart from the last 3000 days or so, the most interesting aspect seems to be the tendency for these relatively stable currencies to return to parity after they diverge. A contrarian approach might suit it well.

Of course, there is the distinct possibility that I missed the point of the indicator, followed by the equally distinct possibility that I misswrote it when i coded it!

...And then there is what FatTails wrote above. It seems to have some fundamental flaws in it's currency valuations. (again, could be my version, but in my experience, FT is usually pretty good at spotting these things) On the brights side, it makes very pretty multicolored squiggly lines, and that is probably the most important hallmark of a good indicator (again)

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

Reply



futures io > > > > FXCorrelator

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     


All times are GMT -4. The time now is 10:29 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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 2017-12-15 in 0.13 seconds with 19 queries on phoenix via your IP 54.221.76.68