Please HELP! Driving me NUTso - NinjaTrader Programming | futures io social day trading
futures io futures trading


Please HELP! Driving me NUTso
Updated: Views / Replies:1,123 / 4
Created: by Trader.Jon 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
 

Please HELP! Driving me NUTso

  #1 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

Please HELP! Driving me NUTso

Greets from my den of frustration ::

Trying to write a very basic MTF indicator from scratch, and getting a simple "does not exist in current context" message on the single DataSeries initialized in the indicator. I tried Print and it doesnt print out the value of the dataseries (of course) but I cant get it any simpler without not doing this at all!! And, no, it doesnt show data in the databox or plot either.

 
Code
#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
	/// <summary>
	///  (BR5Close) is the Better Renko 5 CLOSE
	/// </summary>
	[Description("The BR5Close is a framework to have Better Renko OHLC available in trading systems as DATA.")]
	public class BR5Close : Indicator
	{
		#region Variables
		private int			thePeriod		= 5;
		
		private DataSeries sBR5Cl;
		#endregion

		protected override void Initialize()
		{
			Add(PeriodType.Custom4, thePeriod);  // BarsInProgress index = 1
			Add(new Plot(Color.Green, "BR5Cl"));
			Plots[0].Pen.DashStyle = DashStyle.Dot;
			sBR5Cl = new DataSeries(this);
			//
			CalculateOnBarClose	= true;
			DisplayInDataBox	= true;
			Overlay				= true;		
			PaintPriceMarkers	= true;
		}

		protected override void OnBarUpdate()
		{ 
			if (CurrentBar == 0)
			{
				if (BarsInProgress == 0)  //
			{
				Print("Value of 00 close = "+Closes[0][0]+", CurrentBar0#="+CurrentBars[0]+"Time of bar="+Time[0]+", CurrentBar1#="+CurrentBars[1]);
			}
		
			if (BarsInProgress == 1)  //Better Renko
			{
				sBR5Cl.Set(Close[0]);   
				// sBR5Cl.Set(Closes[0][0]); has the same problem 
				Print("Value of BR5 close = "+Closes[1][0]+", CurrentBar1#="+CurrentBars[1]+"Time of bar="+Time[0]+", bar0 closed "+Closes[0][0]+", Bar0HI="+Highs[0][0]+", Bar0LO="+Lows[0][0]+", CurrentBar00#="+CurrentBars[0]);
				Print("Value of BR5CI        = "+sBR5CI[0]);
			}
		}
		}
		#region Properties
		//
		[Description("Numbers of bars used for calculations")]
		[GridCategory("Parameters")]
		public int ThePeriod
		{
			get { return thePeriod; }
			set { thePeriod =  value; }
		}
		#endregion
	}
}
Printing shows the bars for both BIP 0 & BIP 1 ... but obviously not the Dataseries:

Quoting 
Value of BR5 close = 1.361, CurrentBar1#=3593Time of bar=3/3/2010 3:27:54 AM, bar0 closed 1.3605, Bar0HI=1.3605, Bar0LO=1.36, CurrentBar00#=9486
Value of 00 close = 1.361, CurrentBar0#=9487Time of bar=3/3/2010 3:28:12 AM, CurrentBar1#=3593
Value of BR5 close = 1.3615, CurrentBar1#=3594Time of bar=3/3/2010 3:28:32 AM, bar0 closed 1.361, Bar0HI=1.361, Bar0LO=1.3605, CurrentBar00#=9487
Value of 00 close = 1.3615, CurrentBar0#=9488Time of bar=3/3/2010 3:28:33 AM, CurrentBar1#=3594
Value of 00 close = 1.3613, CurrentBar0#=9489Time of bar=3/3/2010 3:29:20 AM, CurrentBar1#=3594
Value of 00 close = 1.361, CurrentBar0#=9490Time of bar=3/3/2010 3:30:55 AM, CurrentBar1#=3594
Value of 00 close = 1.3613, CurrentBar0#=9491Time of bar=3/3/2010 3:32:20 AM, CurrentBar1#=3594
Value of 00 close = 1.3613, CurrentBar0#=9492Time of bar=3/3/2010 3:34:07 AM, CurrentBar1#=3594
Value of 00 close = 1.3611, CurrentBar0#=9493Time of bar=3/3/2010 3:36:26 AM, CurrentBar1#=3594
Value of 00 close = 1.3608, CurrentBar0#=9494Time of bar=3/3/2010 3:38:37 AM, CurrentBar1#=3594
Value of 00 close = 1.3612, CurrentBar0#=9495Time of bar=3/3/2010 3:39:47 AM, CurrentBar1#=3594
Value of 00 close = 1.3609, CurrentBar0#=9496Time of bar=3/3/2010 3:43:13 AM, CurrentBar1#=3594
Value of BR5 close = 1.3605, CurrentBar1#=3595Time of bar=3/3/2010 3:43:56 AM, bar0 closed 1.3609, Bar0HI=1.3614, Bar0LO=1.3609, CurrentBar00#=9496
Value of 00 close = 1.361, CurrentBar0#=9497Time of bar=3/3/2010 3:45:01 AM, CurrentBar1#=3595

Can any astute observer of newbie code errors please reply!?

Thanks from the tips of my cold cramped fingers,
Jon

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
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.

 
  #3 (permalink)
Elite Member
Cheyenne,Wyoming...USA
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: NQ, YM
 
Posts: 69 since Nov 2010
Thanks: 329 given, 54 received

Maybe this will help


Hi Jon,
I cant figure out what is wrong in your code but here is how I got mine to work.
Scotts webinar helped me out tremendously. Hopefully he will have one on MTF indys!!!

 
Code
                            
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    
/// <summary>
    /// Shows an EMA from a different timeframe Range Bar Chart
    /// </summary>
    
[Description("Shows an EMA from a different timeframe Range Bar Chart")]
    public class 
EmaMtfOnRangeBars Indicator
    
{
        
#region Variables
               
private int altPeriod 8// Default setting for AltPeriod
            
private int eMAPeriod 89// Default setting for EMAPeriod
        #endregion
        
        
private EMA _EMA1;

        private 
bool _initialized false;
 
        protected 
override void Initialize()
        {
            
Add(new Plot (new Pen (Color.FromKnownColor(KnownColor.DarkOrchid), 2), PlotStyle.Line"EMA 1"));
            
Plots[0].Pen.DashStyle DashStyle.Dash;
            
            
CalculateOnBarClose    true;
            
DisplayInDataBox    false;
            
Overlay                true;        
            
PaintPriceMarkers    false;
            
            
Add(PeriodType.RangealtPeriod);
        }

        
        protected 
override void OnBarUpdate()
        {
            if (!
_initialized)
            {
                
_EMA1 = (EMA(BarsArray[1], eMAPeriod));    
                
_initialized true;
            }
            
            if (
CurrentBar <= eMAPeriod)
                return;
            
            
EMA1.Set (_EMA1 [0]);
        }

        
#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 EMA1
        
{
            
get { return Values[0]; }
        }

        [
Description("Alternate Range Bar Period")]
        [
GridCategory("Parameters")]
        public 
int AltPeriod
        
{
            
get { return altPeriod; }
            
set altPeriod Math.Max(1value); }
        }

        [
Description("Period for EMA")]
        [
GridCategory("Parameters")]
        public 
int EMAPeriod
        
{
            
get { return eMAPeriod; }
            
set eMAPeriod Math.Max(1value); }
        }
        
#endregion
    
}



Last edited by sam028; March 9th, 2011 at 03:23 PM. Reason: add php tag
Reply With Quote
The following user says Thank You to gever17 for this post:
 
  #4 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

almost fixed

OK .. so it compiles without errors.. but still wont plot, and data doesnt appear in the databox ... but it does print out ok .. anybody??
 
Code
{
	/// <summary>
	///  (R5Close) is the Range 5 CLOSE
	/// </summary>
	[Description("The R5Close is a framework to have Range5 Close available in trading systems as DATA.")]
	public class R5Close : Indicator
	{
		private int			thePeriod		= 5;
		public DataSeries sRange5Closes;
	
		protected override void Initialize()
		{	Add( PeriodType.Range, thePeriod);
			 Add(new Plot(new Pen (Color.FromKnownColor(KnownColor.ForestGreen), 3), PlotStyle.Line, "sRange5Closes"));
			Plots[0].Pen.DashStyle = DashStyle.Solid;
			sRange5Closes = new DataSeries (this); 
			//
			CalculateOnBarClose	= true;
			DisplayInDataBox	= true;
			Overlay				= true;			}

		protected override void OnBarUpdate()
		{ 			if (CurrentBar < 0 || CurrentBars[1] < 0)
						return; 
			{				if (BarsInProgress == 0)
		{	Print("BIP=0 close = "+Closes[0][0]+", CurrentBar0#="+CurrentBars[0]+"Time of bar0="+Times[0][0]+", Bar0HI="+Highs[0][0]+", Bar0LO="+Lows[0][0]);	}
		//
			if (BarsInProgress == 1)  
			{	sRange5Closes.Set(Closes[1][0]);   
				Print("BIP=1 close = "+Closes[1][0]+", CurrentBar1#="+CurrentBars[1]+"Time of bar1="+Times[1][0]+", Bar1HI="+Highs[1][0]+", Bar1LO="+Lows[1][0]);
				Print("Range5Close=        "+sRange5Closes[0]);			}
		}
		}
		#region Properties
			//
		[Description("Numbers of bars used for calculations")]
		[GridCategory("Parameters")]
		public int ThePeriod
		{
			get { return thePeriod; }
			set { thePeriod =  value; }
		}
		#endregion
	}
}

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
 
  #5 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

Gary,

IF I dont have a solution tomorrow I will try to modify yours ... thanks for the codes!

Jon

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote

Reply



futures io > > > > > Please HELP! Driving me NUTso

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
Ethanol Wars Cattlemen Driving Hard to End Ethanol Subsidy kbit News and Current Events 0 May 15th, 2011 03:23 PM
Week Ahead: New Bulls in the Herd Driving Stocks Higher Quick Summary News and Current Events 0 February 12th, 2011 04:30 AM
Driving Ninjatrader charts with web query price feed RJ3000 NinjaTrader Programming 5 October 20th, 2010 12:42 AM


All times are GMT -4. The time now is 07:17 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.10 seconds with 19 queries on phoenix via your IP 54.92.194.75