Performance impact of calling multiple instances of an external indicator - NinjaTrader Programming | futures io social day trading
futures io futures trading


Performance impact of calling multiple instances of an external indicator
Updated: Views / Replies:1,478 / 12
Created: by Big Mike 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 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
 
Thread Tools Search this Thread
 

Performance impact of calling multiple instances of an external indicator

  #1 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,217 received

Performance impact of calling multiple instances of an external indicator

Can someone more knowledgeable than me comment on the performance impact of calling multiple instances of a single external indicator?

For example, the indicator is 'Bob' and it has three separate DataSeries of DS1, DS2 and DS3.

If the parent indicator or strategy is setup with its own DataSeries to hold the indicator values of 'Bob' dataseries, as most are, it would look like:

private DataSeries bobds1;
private DataSeries bobds2;
private DataSeries bobds3;

bobds1 = new DataSeries(this);
bobds2 = new DataSeries(this);
bobds3 = new DataSeries(this);

bobds1.Set(Bob(value).ds1[0]));
bobds2.Set(Bob(value).ds2[0]));
bobds3.Set(Bob(value).ds3[0]));

So my question is, since I am calling Bob() three times, is the performance penalty 3x the cost of calling it once? Even though the data is identical and I am just retrieving other DataSeries? Judging from my informal testing, the answer is definitely yes - the impact is 3x as costly, but I haven't setup any timer events to actually prove that.

I ask, because if the answer is yes, then wouldn't it be faster to set 'Bob' up to use a single DataSeries and use a deliminator so that the parent indicator could just call the Bob() code once, and then parse the string into the three separate values?

The problem is, I know there is BoolSeries and DataSeries but there is no StringSeries, so I am trying to figure out the best way to accomplish that.

Of course, the fastest way would be to localize Bob() inside of the parent. But that is not always practical.

Thoughts?

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike 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)
Elite Member
Los Angeles, California Republic
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES, Mongolian Horse Futures
 
srgtroy's Avatar
 
Posts: 1,456 since Jan 2011
Thanks: 1,009 given, 2,238 received


I don't know the answer but I have a related question:

Is there a performance difference if you call an instance of an external indicator versus localizing it? It seems the way NT is built, its all part of the same code so there shouldn't be a difference, but I don't know enough to be sure.

P.S. -- I don't intend in anyway to hijack this thread so please go ahead and delete this post if you feel it does that!

Know The Rules Well So You Can Break Them Effectively
Reply With Quote
 
  #4 (permalink)
Elite Member
Los Angeles, California Republic
 
Futures Experience: Intermediate
Platform: Sierra Chart
Favorite Futures: ES, Mongolian Horse Futures
 
srgtroy's Avatar
 
Posts: 1,456 since Jan 2011
Thanks: 1,009 given, 2,238 received


Big Mike View Post

The problem is, I know there is BoolSeries and DataSeries but there is no StringSeries, so I am trying to figure out the best way to accomplish that.

According to the NT help section, there is a StringSeries Class. Search for it in the help section and you will find more info.

Know The Rules Well So You Can Break Them Effectively
Reply With Quote
The following user says Thank You to srgtroy 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


Big Mike View Post
private DataSeries bobds1;
private DataSeries bobds2;
private DataSeries bobds3;

bobds1 = new DataSeries(this);
bobds2 = new DataSeries(this);
bobds3 = new DataSeries(this);

bobds1.Set(Bob(value).ds1[0]));
bobds2.Set(Bob(value).ds2[0]));
bobds3.Set(Bob(value).ds3[0]));

So my question is, since I am calling Bob() three times, is the performance penalty 3x the cost of calling it once?

Mike

Mike,

Are you looking to find out if what you have above is faster (due to the local DataSeries) vs the following?

private DataSeries bobds1;
private DataSeries bobds2;
private DataSeries bobds3;

bobds1 = Bob(value).ds1;
bobds2 = Bob(value).ds2;
bobds3 = Bob(value).ds3;

This should be overall faster as there should still be a pointer passed back to the indicator that already has the data series defined and built. Also, you don't need to copy each bars value to the new series with each OnBarUpdate() call. This would also be better memory handling.

Certainly, if you need to perform an operation on Bob's data, you structure would be better, such as zeroing out certain values due to other logic.

I haven't used the above structure, but it should work, I would tend to define a "Bob" variable and access the members:

private Bob MyBob;

in Init (Strategy), startup (indicator):

MyBob=Bob(value);

Then access the DataSeries:
MyBob.ds1
MyBob.ds2
MyBob.ds3

Bars:
MyBob.ds1[0]
MyBob.ds2[0]
MyBob.ds3[0]

Maybe missed your question, but hope this helps.

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:
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


NJAMC View Post
Mike,

Are you looking to find out if what you have above is faster (due to the local DataSeries) vs the following?

private DataSeries bobds1;
private DataSeries bobds2;
private DataSeries bobds3;

bobds1 = Bob(value).ds1;
bobds2 = Bob(value).ds2;
bobds3 = Bob(value).ds3;

This should be overall faster as there should still be a pointer passed back to the indicator that already has the data series defined and built. Also, you don't need to copy each bars value to the new series with each OnBarUpdate() call. This would also be better memory handling.

Yes I am aware that can be done as well, but doesn't it still make three separate calls? I am not sure how NT handles caching the data, if all exported DataSeries is cached on call 1, so call 2 and call 3 are instant, or if everything has to be looked up again on subsequent calls.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #7 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


srgtroy View Post
According to the NT help section, there is a StringSeries Class. Search for it in the help section and you will find more info.

Wow, that is awesome. I did a Google search and couldn't find anything! I didn't think of searching NT help file.

That will let me do a single 'call' easily, and then just split a deliminated string locally.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

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


Big Mike View Post
Yes I am aware that can be done as well, but doesn't it still make three separate calls? I am not sure how NT handles caching the data, if all exported DataSeries is cached on call 1, so call 2 and call 3 are instant, or if everything has to be looked up again on subsequent calls.

Mike

I believe this is "pointer" based so with a little luck, you are accessing memory as allowed through the "Public" variable interface. This is definitely faster than moving a copy of the current bar from the same location into a local data structure, just access it directly.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #9 (permalink)
Elite Member
Munich, Germany
 
Futures Experience: Intermediate
Platform: NinjaTrader, TWS
Broker/Data: IB, NinjaTrader Brokerage
Favorite Futures: ES,NQ,6E
 
Posts: 62 since Feb 2010
Thanks: 15 given, 22 received

I think following code is fastest

define variable for Bob indicator

private Bob ixBob;

and for dataseries which will become refrence of Bob's dataseries

private DataSeries bobds1;
private DataSeries bobds2;
private DataSeries bobds3;


in OnStartup get reference of Bob

ixBob = Bob(value);

and references of dataseries

bobds1 = ixBob.ds1;
bobds2 = ixBob.ds2;
bobds3 = ixBob.ds3;


in OnBarUpdate call ixBob.Update() before you access bobds1 ... to ensure OnBarUpdate is called in indicator Bob

Reply With Quote
 
  #10 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,217 received


Thanks guys.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote

Reply



futures io > > > > > Performance impact of calling multiple instances of an external indicator

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
Calling external DLL from EasyLanguage Big Mike EasyLanguage Programming 11 August 6th, 2015 11:03 AM
[Q] Indicator-to-External App comms Traderji NinjaTrader Programming 8 May 12th, 2013 07:08 PM
Calling Indicator in Wrapper Function? serac NinjaTrader Programming 2 February 9th, 2011 04:54 PM
Relative Performance Indicator soulartist NinjaTrader 4 November 22nd, 2010 10:21 PM
Performance Indicator MXASJ NinjaTrader Programming 2 April 16th, 2010 01:13 AM


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