Got Accord.net coding experience? - NinjaTrader Programming | futures io social day trading
futures io futures trading


Got Accord.net coding experience?
Updated: Views / Replies:1,033 / 22
Created: by ericson Attachments:3

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
 3  
 
Thread Tools Search this Thread
 

Got Accord.net coding experience?

  #1 (permalink)
Winning Is What I do
Sacramento, CA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NA
Favorite Futures: Stocks, Forex
 
Posts: 64 since Nov 2013
Thanks: 14 given, 16 received

Got Accord.net coding experience?

Hey so I got Accord.net up and running on NT8, but the documentation on its code is very limited. I want to work with it more, who has experience coding with it, examples, doesn't necessarily have to be with NT. Simply how to use its functions and what they can do.

Framework modules

Accord.NET Machine Learning Framework

https://github.com/accord-net/framework

Reply With Quote
The following user says Thank You to ericson for this post:
 
  #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)
Winning Is What I do
Sacramento, CA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NA
Favorite Futures: Stocks, Forex
 
Posts: 64 since Nov 2013
Thanks: 14 given, 16 received


Ok Ill get this going so more people can start working and developing with Accord Net. I created two indicators to show how its done., linear and polynomial regression. Please use this to learn how to code for Accord Net for indicators. There is so much more potential with this add on, neural networks, machine learning, regression, complicated mathematics.

If you have trouble adding the dlls to NT, please let me know. Also, these indicators are for NT8 only! Pass on the good will.

Attached Files
Register to download File Type: zip AccordNet.zip (3.9 KB, 13 views)
Reply With Quote
The following user says Thank You to ericson for this post:
 
  #4 (permalink)
Winning Is What I do
Sacramento, CA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NA
Favorite Futures: Stocks, Forex
 
Posts: 64 since Nov 2013
Thanks: 14 given, 16 received

I am currently working on a multi linear regression indicator, but no dice. Anyone can figure it out? I am trying to use past price data, 1, 2 bars ago, as inputs, and 0 bars ago as outputs. NT8 with Accord Net only.

Attached Files
Register to download File Type: zip MultiLinReg.zip (2.1 KB, 11 views)
Reply With Quote
The following user says Thank You to ericson for this post:
 
  #5 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received


ericson View Post
Ok Ill get this going so more people can start working and developing with Accord Net. I created two indicators to show how its done., linear and polynomial regression. Please use this to learn how to code for Accord Net for indicators. There is so much more potential with this add on, neural networks, machine learning, regression, complicated mathematics.

If you have trouble adding the dlls to NT, please let me know. Also, these indicators are for NT8 only! Pass on the good will.

Hi @ericson,

Looks like some great work, I have some older Accord DLLs and need to update before I can try these. I haver 3.0.2 but looks like you are using a few newer classes such as "PolynomialLeastSquares()" which from the manual requires:
Assembly: Accord.Statistics (in Accord.Statistics.dll) Version: 3.4.0

I will update a bit later and try this out. You are right, Accord brings a lot of power to .NET and NinjaTrader.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #6 (permalink)
Winning Is What I do
Sacramento, CA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NA
Favorite Futures: Stocks, Forex
 
Posts: 64 since Nov 2013
Thanks: 14 given, 16 received

The biggest issue is figuring out how to use its functions. It was trial and error to figure the first two out. The poly is not as smooth as i hoped for. Also, copy the dlls to your NT bin program file location. Reference from there.

Reply With Quote
 
  #7 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received


ericson View Post
The biggest issue is figuring out how to use its functions. It was trial and error to figure the first two out. The poly is not as smooth as i hoped for. Also, copy the dlls to your NT bin program file location. Reference from there.

Ya, had to find the ZIP version for 3.4 on Github, got everything setup but broke my older code with 3.0.2, some major changes in this release. I had some matrix math functions that I had to disable, will get back to that later.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #8 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received

Hummm..... One of the reasons I stopped using Accord.NET were a few bugs I found and couldn't get corrected. I am starting to think after a quick review, there may be bugs in the " PolynomialLeastSquares()" class... The Intercept just makes no sense even when I set the input/output data to a straight line (0,0), (1,1), ... (Period-1,Period-1). Also, the sign seems inverted and might be off by one degree of freedom.

I have modified the PolyRegression OnBarUpdate() to include the following, using the Transform() value of the point we wish to predict (-1.0) as you have time running backwards to point 0.0. I first started to work with predicting the next PolyRegressionLine[] point to smooth the line, to no avail. It just doesn't seem to be working right based upon the output of the 3rd degree fit:

 
Code
			ols = new PolynomialLeastSquares();
			ols.Degree = Degree;
			
			for(i = 0; i < Period; i++)
			{
				inputs[i] = Convert.ToDouble(i);//0,1,2,3....
				if (PolyRegressionLine.IsValidDataPoint(i) && false)
					outputs[i] = PolyRegressionLine[i+1];//most recent price [0], then back 1,2,3 bars ago
				else
					outputs[i] = inputs[i];//Input[i];//most recent price [0], then back 1,2,3 bars ago
			}

			// Use OLS to learn the regression
			reg = ols.Learn(inputs, outputs);

			PolyRegressionLine[0] = reg.Transform(-1.0);
			Print(ols.Degree+"  "+reg.ToString()+"  Int "+ reg.Intercept);
The sample output is:

 
Code
3  y(x) = 2.37812678233955E-17x^2 + 1x^1 + 2.77718345656259x^0  Int -2.77718345656258
You can see the Intercept doesn't match, the sign is inverted. Also, it is a 3rd Degree Polynomial so there should be an X^3 term and doesn't show. Not exactly sure what might be wrong, but seems like the "Learn()" didn't work right maybe because of the missing X^3 in the hypothesis?


For the Linear case "OrdinaryLeastSquares()" things seem to work with this codeblock:

 
Code
			ols = new OrdinaryLeastSquares();
			ols.IsRobust = true;
			
			for(i = 0; i < Period; i++)
			{
				inputs[i] = Convert.ToDouble(i);//1,2,3....
				outputs[i] = inputs[i];//Input[i] //most recent price [0], then back 1,2,3 bars ago
			}

			// Use OLS to learn the simple linear regression
			regression = ols.Learn(inputs, outputs);

			LinearRegressionLine[0] =  regression.Transform(-1.0);
			Print(regression.ToString()+"  Int "+ regression.Intercept);
 
Code
y(x) = 1x + 3.33066907387547E-15  Int 3.33066907387547E-15
You can see this is a 1st degree equation, linear, and the Intercept matches and has the X^1 term.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #9 (permalink)
Winning Is What I do
Sacramento, CA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: NA
Favorite Futures: Stocks, Forex
 
Posts: 64 since Nov 2013
Thanks: 14 given, 16 received

Here is my output from my original code. The weights are either extremely small or large, intercept very big. but the line is more or less similar to other poly regs.

Attached Files
Register to download File Type: zip NinjaScript Output 2_17_2017 9_39 AM.zip (529.9 KB, 2 views)

Last edited by ericson; February 17th, 2017 at 01:46 PM.
Reply With Quote
 
  #10 (permalink)
Elite Member
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received



ericson View Post
Here is my output from my original code. The weights are either extremely small or large, intercept very big. but the line is more or less similar to other poly regs.


@ericson,

I think your code covers some of the problem with the base class so I wouldn't trust it. The Intercept shouldn't be that big, it should be around the Final Time Point (as X=0 at that point).

A look at Github, not entirely sure but don't see how he is handling the Degree with X^0 included in the LeastSquares():
https://github.com/accord-net/framework/blob/development/Sources/Accord.Statisti...olynomialLeastSquares.cs

I don't think it is your code, you should use the "Transform" to make sure you are doing the vector math correctly... Usually it is A1*X^1+A2*X^2... I think you may have reversed it to get a reasonable answer: A1*X^3+....

I also don't think the Intercept should appear (even with the wrong sign) in the weights, so I just think there is a calculation problem in Accord.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote

Reply



futures io > > > > > Got Accord.net coding experience?

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
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerlanguage Multicharts.NEt coding questions fjgaspar MultiCharts 5 August 5th, 2016 06:16 AM
Setting up Accord.NET on NinjaTrader NJAMC The Elite Circle 16 July 10th, 2013 04:30 PM
Why Greece's Austerity Accord Is Running Into Trouble Again Quick Summary News and Current Events 0 February 10th, 2012 01:10 PM
US Debt Accord Could Slow Gold Rally, But Not for Long Quick Summary News and Current Events 0 July 18th, 2011 03:50 PM
Budget Accord Is Reached, Averting Federal Shutdown Quick Summary News and Current Events 0 April 9th, 2011 03:51 AM


All times are GMT -4. The time now is 04:12 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.12 seconds with 20 queries on phoenix via your IP 54.234.255.29