Octave - Open Source Analysis Package - Matlab, R project and Python | futures io social day trading
futures io futures trading


Octave - Open Source Analysis Package
Updated: Views / Replies:5,979 / 25
Created: by NJAMC 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
 

Octave - Open Source Analysis Package

  #11 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received


gregid View Post
@Xav1029
Using the OctaveSharp I linked it should be as simple as:
 
Code
                            
   octave = new Octave(@"D:\Download\Soft\Octave3.6.0_gcc4.6.2\bin"false); 

   
octave.ExecuteCommand("a=[1,2;3,4];");
   
octave.ExecuteCommand("result=a';");
   
double[][] octave.GetMatrix("result"); 

Thanks @gregid. My programming skills are still very basic and limited to what I have learned to do inside NT in the past 6 months. My question is when I download projects or libraries, what are the steps to being able to use them inside NT? Do I have to move the files to a certain location? Do I have to declare "using" statements? I appreciate all your help and I am trying to learn more in depth programming.

Reply With Quote
 
  #12 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

@Xav1029

There are 2 options:
1) You can locate LibSharpTave.dll in the downloaded code for OctaveSharp. Then add reference to this file from your ninjascript (right click in the NinjaScript editor "References", "Add" then browse for the LibSharpTave.dll
2) You can locate Octave.cs file from source code and copy it to your Strategy or Indicator folder in NT. Compile some indicator/strategy

Whichever option you choose - you need to use the following statement:

 
Code
                            
using LibSharpTave
The rest is just as in the snippet above. Please bear in mind I haven't tested it so I may have missed something, but I don't think so.

Obviously when you instantiate Octave you need to provide correct path

Good luck and let us know how are you doing!

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #13 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received



gregid View Post
@Xav1029

There are 2 options:
1) You can locate LibSharpTave.dll in the downloaded code for OctaveSharp. Then add reference to this file from your ninjascript (right click in the NinjaScript editor "References", "Add" then browse for the LibSharpTave.dll
2) You can locate Octave.cs file from source code and copy it to your Strategy or Indicator folder in NT. Compile some indicator/strategy

Whichever option you choose - you need to use the following statement:

 
Code
                            
using LibSharpTave
The rest is just as in the snippet above. Please bear in mind I haven't tested it so I may have missed something, but I don't think so.

Obviously when you instantiate Octave you need to provide correct path

Good luck and let us know how are you doing!

Thanks for this information. I just started going through the Octave Manual page by page, and should be able to start using it by next week. Would tick by tick calculations take too long with C# and a standard PC? I don't want to start experimenting with tick data just to find out any reasonably priced setup would be too slow, or that NT running on C# would be too slow.

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


Xav1029 View Post
Thanks for this information. I just started going through the Octave Manual page by page, and should be able to start using it by next week. Would tick by tick calculations take too long with C# and a standard PC? I don't want to start experimenting with tick data just to find out any reasonably priced setup would be too slow, or that NT running on C# would be too slow.

I have adapted the OctaveSharp from CodeProject to .NET 3.5 for NT7 and so it doesn't need a DLL which looked like it would be .NET 4.0 and NT7 would not load it. I have also added some features and the ability to maintain a single copy of Octave per strategy. Without the changes you could end up with many copies of Octave running in the background.

The Strategy has example code on sending Matrix's and receiving Scalar's, Vector's, and Matrix's. Also how to access the matrix values.

This approach does use Standard output so keep in mind the logic will want to use it to minimize IO size. Create a way to append to arrays and only import data you need.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Attached Files
Register to download File Type: zip OctaveBridgeExample01.zip (3.9 KB, 16 views)
Reply With Quote
The following 3 users say Thank You to NJAMC for this post:
 
  #15 (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

There are a few major sections (In Startup)
m_Octave=new Octave(m_OctavePath,false); // Makes the connection to Octave
m_Octave.ExecuteCommand("a=[1,2,3,4,5,6,7,8,9,10];");
m_Octave.ExecuteCommand("b=[11,21,31,41,51,61,71,81,91,101];");
m_Octave.ExecuteCommand("aa=[a;b];");
OnBarUpdate:
m_Octave.ExecuteCommand("c=["+CurrentBar+","+(CurrentBar+1)+","+(CurrentBar+2)+
","+(CurrentBar+3)+","+(CurrentBar+4)+","+(CurrentBar+5)+
","+(CurrentBar+6)+","+(CurrentBar+7)+","+(CurrentBar+8)+","+(CurrentBar+9)+"];");
// Creates a vector "c" of the current bar with offset depending on depth in vector
m_Octave.ExecuteCommand("scalar=c(9);");
// scalar is set to the 9th element of "c" (starting index in Octave is 1 not 0)

m_Octave.ExecuteCommand("m=a.+b.+c");
// Dot wise addition
m_Octave.ExecuteCommand("aa=[a;b;m];");
// Creates a 3x10 matrix by combining the row vectors into a matrix


//Get the Scalar, Vector, & Matrix values from Octave back into C#
val = m_Octave.GetScalar("scalar");
double [] a = m_Octave.GetVector("a");
double [] b = m_Octave.GetVector("b");
double [] c = m_Octave.GetVector("c");
double [] m = m_Octave.GetVector("m");
double [][] aa = m_Octave.GetMatrix("aa");

Here is a sample run from the strategy (Print statements in Strategy):

Scalar: 29 Matrix(aa): aa =

1 2 3 4 5 6 7 8 9 10
11 21 31 41 51 61 71 81 91 101
33 45 57 69 81 93 105 117 129 141


a: a =

1 2 3 4 5 6 7 8 9 10


Matrix(:,1): ans =

1
11
33


Matrix(1,: ): ans =

1 2 3 4 5 6 7 8 9 10


a[0]+b[0]+c[0]=m[0] ==> 1+11+21=33
a[1]+b[1]+c[1]=m[1] ==> 2+21+22=45
a[2]+b[2]+c[2]=m[2] ==> 3+31+23=57
a[3]+b[3]+c[3]=m[3] ==> 4+41+24=69
a[4]+b[4]+c[4]=m[4] ==> 5+51+25=81
a[5]+b[5]+c[5]=m[5] ==> 6+61+26=93
a[6]+b[6]+c[6]=m[6] ==> 7+71+27=105
a[7]+b[7]+c[7]=m[7] ==> 8+81+28=117
a[8]+b[8]+c[8]=m[8] ==> 9+91+29=129
a[9]+b[9]+c[9]=m[9] ==> 10+101+30=141
Line #0: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
Line #1: 11, 21, 31, 41, 51, 61, 71, 81, 91, 101,
Line #2: 33, 45, 57, 69, 81, 93, 105, 117, 129, 141,

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
The following user says Thank You to NJAMC for this post:
 
  #16 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received

Help with least squares

Bear with me guys, I haven't looked at this level mathematics in over 6 years. Could someone post a simple example of finding the least squares solution of a system of linear equations, returning the solution and the residual matrix?

Ex:
M =[ 1000 .21 10 0 ; 500 .23 12 1 ; 777 .45 12 -1 ; 888 .35 9 -3]
b = [12 16 18 20]

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


Xav1029 View Post
Bear with me guys, I haven't looked at this level mathematics in over 6 years. Could someone post a simple example of finding the least squares solution of a system of linear equations, returning the solution and the residual matrix?

Ex:
M =[ 1000 .21 10 0 ; 500 .23 12 1 ; 777 .45 12 -1 ; 888 .35 9 -3]
b = [12 16 18 20]

I would try here for ideas:
Linear Least Squares - GNU Octave

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
The following user says Thank You to NJAMC for this post:
 
  #18 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received


NJAMC View Post
I would try here for ideas:
Linear Least Squares - GNU Octave

I used the OLS function already, but how do I return the r matrix, or sigma?

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


Xav1029 View Post
I used the OLS function already, but how do I return the r matrix, or sigma?

I think you truly need to return the value into the matrix as shown:
[beta, sigma, r] = ols (y, x)

I think this is how multiple parameters are returned. You will then get beta, sigma, & r set from the OLS function.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
The following user says Thank You to NJAMC for this post:
 
  #20 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received



NJAMC View Post
I think you truly need to return the value into the matrix as shown:
[beta, sigma, r] = ols (y, x)

I think this is how multiple parameters are returned. You will then get beta, sigma, & r set from the OLS function.

I will have to try that when I get home. FYI I think this function is too slow calculate on a tick by tick basis. The simple example above took about .5 sec on my laptop(no the greatest laptop).

Reply With Quote

Reply



futures io > > > > Octave - Open Source Analysis Package

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
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
A new (open source?) trading platform Big Mike Platforms and Indicators 140 January 6th, 2017 03:15 PM
Free/open source portfolio management software? stockpapa Beginners and Introductions 3 November 30th, 2012 04:08 PM
Open Source Charting Program for Linux Zondor Traders Hideout 2 March 5th, 2012 06:41 PM
Gom Package help neko333 The Elite Circle 11 October 25th, 2010 06:18 AM
Volitility indicator question - Open - Open / open - close / close to open andresimon NinjaTrader 2 September 27th, 2010 01:33 AM


All times are GMT -4. The time now is 08:30 PM.

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-11 in 0.16 seconds with 20 queries on phoenix via your IP 54.83.122.227