NexusFi: Find Your Edge


Home Menu

 





Performance of Calling Indicators with No Plots


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one tornadoatc with 3 posts (1 thanks)
    2. looks_two Zondor with 1 posts (2 thanks)
    3. looks_3 Fat Tails with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 1,747 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Performance of Calling Indicators with No Plots

  #1 (permalink)
 tornadoatc 
Ft. Lauderdale Florida
 
Experience: Intermediate
Platform: Tradestation
Posts: 17 since Apr 2010
Thanks Given: 31
Thanks Received: 3

Hello,

I am attempting to code Strategy which will call several other indicators. I am wondering if there is any overhead associated with the Plot logic that would not be used by my Strategy.

IOW, I am wondering if I should have Indicators that just perform necessary calculations and establish the necessary "get" Properties to retrieve the needed values.

I am guessing the answer is "no" as I don't see this mentioned anywhere.

Thanks for your time.

ATC

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
My NQ Trading Journal
14 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



tornadoatc View Post
Hello,

I am attempting to code Strategy which will call several other indicators. I am wondering if there is any overhead associated with the Plot logic that would not be used by my Strategy.

IOW, I am wondering if I should have Indicators that just perform necessary calculations and establish the necessary "get" Properties to retrieve the needed values.

I am guessing the answer is "no" as I don't see this mentioned anywhere.

Thanks for your time.

ATC


@tornadoatc: This depends on the way you code your strategy. If you add an indicator via the Add() method, then you will effectively add a plot to your strategy, and that plot will be visible, when the strategy is activated on your chart or in the strategy analyzer. In that case there is an overhead associated as the plot is running.

Example:
 
Code
protected override void Initialize()
{
          Add(SMA(20));
}

adds an indicator to your strategy for the purpose of plotting it!


If you just call an indicator from OnBarUpdate(), then ChartControl has the value "null" when the indicator calculations are performed, and there should be no overhead associated with calling the indicator.

Reply With Quote
Thanked by:
  #4 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731

If you calling an external indicator in OnBarUpdate, you should call a previously declared and instantiated, reusable instance of the external indicator.

Just as in an indicator, that instance of an external class can be created in OnStartUp, or in OnBarUpdate with a null test condition to ensure that the instance is not RE-created if it already has been created, ie is not null.

"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #5 (permalink)
 tornadoatc 
Ft. Lauderdale Florida
 
Experience: Intermediate
Platform: Tradestation
Posts: 17 since Apr 2010
Thanks Given: 31
Thanks Received: 3


Zondor View Post
If you calling an external indicator in OnBarUpdate, you should call a previously declared and instantiated, reusable instance of the external indicator.

Just as in an indicator, that instance of an external class can be created in OnStartUp, or in OnBarUpdate with a null test condition to ensure that the instance is not RE-created if it already has been created, ie is not null.

Thank you both for your input.

So following some of your previous postings that I believe you both may have contributed to I am creating an Indy that has the following
 
Code
#region Variables
        // Wizard generated variables
			private int    i_DMILen  = 14; 
        // User defined variables (add any user defined variables below)
			private ibdDM myDM; 
			private double v_DMIPlus 	        = 0 ; 
			private double v_DMIMinus 	= 0 ; 
			private double v_ADX 		= 0 ; 
		
        #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(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "RankAllRaw"));
            Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "RankAllFast"));
            Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Line, "RankAllSlow"));
            Add(new Line(Color.FromKnownColor(KnownColor.GhostWhite), 0, "ZeroLine"));
            Overlay				= false;
        
            CalculateOnBarClose = true ; 
		
	}

	protected override void OnStartUp()
	{
			myDM = ibdDM(i_DMILen) ; 
	}
		
		/// Called on each bar update event (incoming tick)
        protected override void OnBarUpdate()
        {		
			v_DMIPlus 	= myDM.DiPlus[0] ; 
			v_DMIMinus 	= myDM.DiMinus[0] ; 
			v_ADX 		= myDM.ADX[0] ;
So does this method of instantiating the above ibdDM indicator eliminate the overhead of associated Plots?

Also, other Indys I am working with have required inputs for Plot Colors. I tried to pass in "null but it did not like "null" in those instances so I just passed in Color.FromKnownColor(KnownColor.GhostWhite).

Thanks for your time and assistance.

Started this thread Reply With Quote
  #6 (permalink)
 tornadoatc 
Ft. Lauderdale Florida
 
Experience: Intermediate
Platform: Tradestation
Posts: 17 since Apr 2010
Thanks Given: 31
Thanks Received: 3

While I am still learning C# (and probably will be for a long time) I am wondering if the use of a Partial Class might be of use for what I am trying to describe.

So I want to call other indicators / classes for use in more complex Indys or Strats. There are two issues currently wondering:
1) I do not want any overhead associated with Plot functionality
2) I sometimes only need most recent value of an Indy but the current implementation of that Indy might only be setup to return the entire DataStore. IOW, is it less efficient to return entire DataSeries (or even calculate them) if only most recent values are needed?

So, can these concerns be alleviated with use of a partial class? IOW, can I create a partial class where I would create calculations within a separate file that I can used over and over in other Indys or Strats? Can this class have multiple Properties that enable return of all the calculations I might need.

Ugg.

Thanks for your input.

Started this thread Reply With Quote




Last Updated on February 24, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts