Performance Suggestions Please - NinjaTrader Programming | futures io social day trading
futures io futures trading


Performance Suggestions Please
Updated: Views / Replies:589 / 1
Created: by tornadoatc 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 100,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

Thread Tools Search this Thread

Performance Suggestions Please

  #1 (permalink)
Elite Member
Ft. Lauderdale Florida
Futures Experience: Intermediate
Platform: Tradestation
Posts: 16 since Apr 2010
Thanks: 31 given, 3 received

Performance Suggestions Please

Hello All,

I have recently left the TS realm and I now attemting to code some indicators in NT7. I have read through many of the threads regarding NT7 performance suggestions and I don't quite have a grasp of the OOP aspects enough to make my code most efficient. I am still having problems understanding how best to use other indicator classes in my indicator.

In my code I am calling Bollinger(Close, .25, iWaveRiderLen).Middle[0] several times in the logic of OnBarUpdate(). I don't believe this is most efficient. I believe the best way is to declare a variable of type Bollinger in the Variables section (ie. Bollinger myBoll) and then instantiate a new object in the Initialize() (Bollinger myBool = new Bollinger()). But I was not able to get that working.

Ur help is greatly appreciated as I attempt to get up on the learning curve of C#.

Here is my indicator:
#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;

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
    /// <summary>
    /// Momentum Weitghted Avg Price 
    /// </summary>
    [Description("Momentum Weitghted Avg Price ")]
    public class IBDMWAP1 : Indicator
        #region Variables
        // Wizard generated variables
            private int iWaveRiderLen = 14; // Default setting for IWaveRiderLen
        // User defined variables (add any user defined variables below)
			private double movavg = 0 ; 
			//double xavg = 0 ; 
			//EMA myEMA = new EMA() ; 
			//Bollinger myBoll = new Bollinger() ; 
			//double bollUpper = 0 ; 
			//double bollMiddle = 0 ; 
			//double bollLower = 0 ; 
			private BoolSeries isGreenWave ; 
			private BoolSeries isRedWave ; 
			private bool isStartGreenWave = false ; 
			private bool isStartRedWave = false ; 
			private bool isContGreenWave = false ; 
			private bool isContRedWave = false ; 

			private double currWaveHigh = 0 ; 
			private double currWaveLow  = 999999.00 ; 
			private double redWaveLow = 999999.00 ; 
			private double greenWaveHigh = 0 ; 
			private double MWAP1 = 0 ; 

        /// <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.Dot, "Plot0"));
            Overlay				= true ;
			CalculateOnBarClose = true ; 
			isGreenWave = new BoolSeries(this) ; 
			isRedWave   = new BoolSeries(this) ; 

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
			//myEMA = EMA(4);						
			//myBoll = Bollinger(Close, .25, iWaveRiderLen) ; 
			//double bollLower = myBoll.Lower() ; 
			//bollMiddle = myBoll.Middle[0] ; 
			//bollUpper = myBoll.Upper[0] ; 
			// isPriorBarGreenWave = 
			if (EMA(4)[0] >= Bollinger(Close, .25, iWaveRiderLen).Middle[0] && Close[0] > Bollinger(Close, .25, iWaveRiderLen).Upper[0]) 
				isGreenWave.Set(true) ; 
				isRedWave.Set(false) ;
			else if (EMA(4)[0] <= Bollinger(Close, .25, iWaveRiderLen).Middle[0] && Close[0] < Bollinger(Close, .25, iWaveRiderLen).Lower[0]) 
				isRedWave.Set(true) ; 
				isGreenWave.Set(false) ;
			Print("Date " + Time[0].ToString("yyyyMMdd HH:mm:ss") + " isGreenWave: " + isGreenWave + " isRedWave: " + isRedWave) ; 

			bool isStartGreenWave = isGreenWave[0] && isGreenWave[1] == false ; 
			bool isStartRedWave   = isRedWave[0] && isRedWave[1] == false ; 
			bool isContGreenWave  = isGreenWave[0] && isGreenWave[1]; 
			bool isContRedWave    = isRedWave[0] && isRedWave[1]; 
			if (isStartGreenWave) 
				redWaveLow = currWaveLow ; 
				currWaveHigh = High[0] ; 
				currWaveLow  = Low[0] ; 
			else if (isStartRedWave) 
				greenWaveHigh = currWaveHigh ; 
				currWaveHigh = High[0] ; 
				currWaveLow = Low[0] ; 
			else if (isContGreenWave) 
				if (High[0] > currWaveHigh) 
					currWaveHigh = High[0] ; 
			else if (isContRedWave) 
				if (Low[0] < currWaveLow) 
					currWaveLow = Low[0] ; 
			if (isStartGreenWave || isStartRedWave) 
				MWAP1 = (greenWaveHigh + redWaveLow) * 0.5 ; 

        #region Properties
        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries Plot0
            get { return Values[0]; }

        [Description("Wave Rider Length")]
        public int IWaveRiderLen
            get { return iWaveRiderLen; }
            set { iWaveRiderLen = Math.Max(1, value); }

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


futures io > > > > > Performance Suggestions Please

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Fundraiser: Feeding Families in Need (ends Dec 17)


Battlestations! Show us your trading desks w/GFF Brokers ($750 in Prizes)


An Afternoon With Morad Askar (aka FuturesTrader71)

Elite only

Traders Tax Advice w/Ryan Curran CPA

Elite only

Black Swan Events w/Adam Grimes

Elite only

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trade statistics spreadsheet - suggestions? Gary Psychology and Money Management 37 October 8th, 2013 12:57 PM
Trader's Edge nomination suggestions Big Mike The Elite Circle 81 May 27th, 2013 05:48 AM
Suggestions On My Journey SammyD Currency Futures 11 March 6th, 2012 07:55 PM
Seeking Suggestions Re Data Feed Gedman Sierra Chart 14 February 3rd, 2012 07:56 PM
Technical Suggestions for my new Rule Set thinkfuture The Elite Circle 3 October 11th, 2011 01:53 AM

bar update, c#, code, data, data series, dataseries, ema, indicators, information, momentum, namespace, ninjascript, ninjatrader, nt7, think or swim, tos, type, values, variable

All times are GMT -4. The time now is 01:27 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business,
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 2018-12-15 in 0.09 seconds with 14 queries on phoenix