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


FXCorrelator
Updated: Views / Replies:3,884 / 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

  #11 (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

@fctrader

Sir thank you most kindly. It's a start. I would not have been able to do this myself in a million years
I have loaded it onto NT and currently monitoring it. Will report back. Much obliged.

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

Danjuma,
Your welcome. A few important things to note.

My version is based on percent difference from the prior day SMA. I think that his was based on absolute difference in the pairs other than JPY. To be truthful, I didn't reverse engineer his code entirely, since I'm not really a programmer. I just wrote the concept of it as I saw it into this code, so I hope that it is still useful to you. If you want to remove that difference, you can get rid of the "/SMA(Closes[1],MovAvgLength)[0];" from each of the deltaPair lines. I found it more useful as relative percentage changes though.

You can easily change the colors of the various pairs to your liking when you are using the indicator by double clicking any line on it, and adjusting the indicator details on the right. For my eye, I also found it useful to change the size of a pair of lines vs the rest. They are all defaulted to line size 1, but making the pairs you're focused on size 4 is helpful.

Cheers,

FCtrader

Reply With Quote
 
  #13 (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


@fctrader

A bit of feedback. Firstly, thank you so much for coding this. I monitored it today against the original MT4 version. Set them up as as per the original author's method (two charts, one on 80 SMA and one on 20 SMA), using 15min bars. They do look similar, but with some small differences. I have attached a couple of images. below (the MT4 version on the left, and your version on the right). In the first image, the two main currencies that has to be monitored for the purpose of the method (the USD in green, and YEN in yellow) are both below zero on the 80 sma and 20 sma on the MT4 version. However, on your version the YEN is still above zero. though approaching/touching it. So, like I mentioned before, yours is quite close to the MT4 version, just some small differences like may be when some currencies are well below zero on the MT4 version, they might just be touching or still slightly above zero on yours. Or they might be say below zero in both versions, but starting to point upwards towards the zero direction on the MT4 version, while still pointing downwards on yours, if you know what I mean.

Not withstanding, many thanks for doing this anyway, and if you do decide to tweak it more, then I would be most grateful In the meantime, I will keep monitoring it, along with the MT4 version, and hope eventually Sir FT might be able to find the time to come up with his version.

Attached Thumbnails
FXCorrelator-fxc.jpg   FXCorrelator-fxc2.jpg  
Reply With Quote
 
  #14 (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 didn't get a chance to see your reply until today, as I don't get on the forum here everyday. Thank you for posting the two indicators side by side. As I hopefully made clear above, they do not do the same thing. Mine was based on percent change, while the original was based on absolute change in currency values.

My primary goal was to give you a starting point for coding a multi-symbol indicator. When I wrote it closer to the original, I saw some inconsistency in the data that indicated that a pair was diverging when the naked eye showed it to be converging. This may have been my flaw in transposing, or a flaw in the design; probably the former.

I would encourage you to tinker with the math formulas to get the result that you want. I tried to make the labels easy to read by removing "A", "B", etc and adding pair names to the formula to make it easy to edit it.

Good luck with it. Any questions posed about specific formula changes will likely get answered here by someone with better market/math/programming skills than me, but I'll try if I can!

FC

Reply With Quote
The following user says Thank You to fctrader for this post:
 
  #15 (permalink)
Elite Member
Fort Collins, Colorado
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: ES
 
Posts: 57 since Feb 2011
Thanks: 48 given, 43 received

@danjuma

I looked at it again and modified the necessary parts. Try this side by side, and see if it is closer to what you are expecting. The relevant parts have been commented out and rewritten below.

 
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 = 20; // 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];
			
			deltaEURUSD = (WMA(Closes[1],MovAvgLength)[0]-WMA(Closes[1],MovAvgLength)[1]);
			deltaGBPUSD = (WMA(Closes[2],MovAvgLength)[0]-WMA(Closes[2],MovAvgLength)[1]);
			deltaAUDUSD = (WMA(Closes[3],MovAvgLength)[0]-WMA(Closes[3],MovAvgLength)[1]);
			deltaUSDCHF = (-(WMA(Closes[4],MovAvgLength)[0]-WMA(Closes[4],MovAvgLength)[1]));
			deltaUSDJPY = (-(WMA(Closes[5],MovAvgLength)[0]-WMA(Closes[5],MovAvgLength)[1]))/100;
			deltaNZDUSD = (WMA(Closes[6],MovAvgLength)[0]-WMA(Closes[6],MovAvgLength)[1]);
			deltaUSDCAD = (-(WMA(Closes[7],MovAvgLength)[0]-WMA(Closes[7],MovAvgLength)[1]));
			
			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_strength = deltaEURUSD;
			
            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);
        }
Let me know how it works out.

FC

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

If you don't want to recopy it all, the relevant part is this.

 
Code
deltaEURUSD = (WMA(Closes[1],MovAvgLength)[0]-WMA(Closes[1],MovAvgLength)[1]);
			deltaGBPUSD = (WMA(Closes[2],MovAvgLength)[0]-WMA(Closes[2],MovAvgLength)[1]);
			deltaAUDUSD = (WMA(Closes[3],MovAvgLength)[0]-WMA(Closes[3],MovAvgLength)[1]);
			deltaUSDCHF = (-(WMA(Closes[4],MovAvgLength)[0]-WMA(Closes[4],MovAvgLength)[1]));
			deltaUSDJPY = (-(WMA(Closes[5],MovAvgLength)[0]-WMA(Closes[5],MovAvgLength)[1]))/100;
			deltaNZDUSD = (WMA(Closes[6],MovAvgLength)[0]-WMA(Closes[6],MovAvgLength)[1]);
			deltaUSDCAD = (-(WMA(Closes[7],MovAvgLength)[0]-WMA(Closes[7],MovAvgLength)[1]));
just comment out the original "deltaPAIR" section, and add in the code above. Should work closer to your expectations. (I think )

Reply With Quote
 
  #17 (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

@fctrader

Many thanks for doing this. Will try it out tomorrow and feed back. Most grateful.

Dan

Reply With Quote
 
  #18 (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

Hello fctrader,

Just tried the new code on a 5min chart this morning. It's better and near identical to the MT4 version. I have attached a couple of images. A hundred thanks to you for doing this, much appreciated.

Attached Thumbnails
FXCorrelator-fxcor.jpg   FXCorrelator-fxcor2.jpg  
Reply With Quote
 
  #19 (permalink)
Elite Member
Fort Collins, Colorado
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: ES
 
Posts: 57 since Feb 2011
Thanks: 48 given, 43 received

Thanks for posting the pictures.

The differences are interesting. I wonder if it has to do with the way the WMA is calculated between NinjaTrader and MetaTrader. In his code he used "MODE_LWMA" for Linear Weighted Moving Average, whereas I used NinjaTrader's "WMA" for Weighted Moving Average. As far as I know, they should be calculated the same, but I don't have the formulas that they used in front of me.

It could also be the data is slightly different. Are you using the same data-feed for both indicators? Or is one from your brokerage, and the other from a feed? The inter-bank market has no centralized exchange, and different providers frequently quote different numbers. If that is the case, it could easily explain the discrepancy.

Anyway, it's pretty close, and I'm glad it seems to work for you. Hopefully you can make it into a profitable system ;-)

FC

Reply With Quote
 
  #20 (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


Hello fctrader, and thanks for your reply.

"Are you using the same data-feed for both indicators? Or is one from your brokerage, and the other from a feed?"

No, I am using different data-feed. The one for the MT4 is from a demo account with Alpari UK, and the one for NT is from IB.

"Anyway, it's pretty close, and I'm glad it seems to work for you. Hopefully you can make it into a profitable system"

Yes, it is very very close, and thanks for your hard work. I also hope I am able to make it into a profitable system indeed.

Reply With Quote

Reply



futures io > > > > FXCorrelator

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     


All times are GMT -4. The time now is 03: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-13 in 0.14 seconds with 19 queries on phoenix via your IP 54.226.132.197