Add(Instrument.FullName,PeriodType.... ReversalBarsType - NinjaTrader Programming | futures io social day trading
futures io futures trading


Add(Instrument.FullName,PeriodType.... ReversalBarsType
Updated: Views / Replies:1,843 / 19
Created: by pcomm69 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
 

Add(Instrument.FullName,PeriodType.... ReversalBarsType

  #1 (permalink)
Elite Member
paris france
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Continuum
Favorite Futures: gold & crude light
 
pcomm69's Avatar
 
Posts: 50 since Oct 2011
Thanks: 13 given, 4 received

Add(Instrument.FullName,PeriodType.... ReversalBarsType

Hi,

ReversalBarsType is well present in Data Series Type / ChartStyle
but dont appear in
Add(Instrument.FullName,PeriodType. .... (see the list)

It mean that
Add(Instrument.FullName,PeriodType.ReversalBarsType, 10); // [1]
is impossible.

Could you help me ?

Thanks
Pierre

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
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



pcomm69 View Post
Hi,

ReversalBarsType is well present in Data Series Type / ChartStyle
but dont appear in
Add(Instrument.FullName,PeriodType. .... (see the list)

It mean that
Add(Instrument.FullName,PeriodType.ReversalBarsType, 10); // [1]
is impossible.

Could you help me ?

Thanks
Pierre

I gather ReversalBars is some custom bar type you have imported to NT. The only way to add custom bar type is to use Custom or Final eg. assuming that ReversalBars use Custom5 you would use:
 
Code
Add(Instrument.FullName,PeriodType.Custom5, 10);
// or simply:
Add(PeriodType.Custom5, 10);
Check the code to see which PeriodType variable it is using.

Search for something similar to:
 
Code
public ReversalBarsType() : base(PeriodType.Custom5) { }

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #4 (permalink)
Elite Member
paris france
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Continuum
Favorite Futures: gold & crude light
 
pcomm69's Avatar
 
Posts: 50 since Oct 2011
Thanks: 13 given, 4 received

Thanks for your help

here is the code decompiled
I don t find the good indication about
"public ReversalBarsType() : base(PeriodType.CustomX) { }"

#region Using declarations
using System;
using System.Collections;
using System.ComponentModel;
using System.Text;
#endregion

// This namespace holds all bars types. Do not change it.
namespace NinjaTrader.Data
{

/// <summary>
/// </summary>
public class ReversalBarsType: BarsType
{
private static bool registered = Data.BarsType.Register(new ReversalBarsType());

private bool OxFln4MCc;
private static bool VUHamLYRw;

/// <summary>
/// </summary>
/// <param name="bars"></param>
/// <param name="open"></param>
/// <param name="high"></param>
/// <param name="low"></param>
/// <param name="close"></param>
/// <param name="time"></param>
/// <param name="volume"></param>
/// <param name="isRealtime"></param>

#if NT7
public override void Add(Data.Bars bars, double open, double high, double low, double close, DateTime time,long volume, bool isRealtime)
#else
public override void Add(Data.Bars bars, double open, double high, double low, double close, DateTime time,int volume, bool isRealtime)
#endif
{


object[] objectArray1;
object[] objectArray2;
if (bars.Count == 0)
{
// base.AddBar (bars, open, high, low, close, time, volume);
AddBar(bars, open, high, low, close, time, volume,isRealtime);
this.OxFln4MCc = true;
return;
}
Bar bar1 = ((Bar) bars.Get (((int) (bars.Count - 1))));
double double1 = bars.Instrument.MasterInstrument.TickSize;
double double2 = (Math.Floor (((10000000D * ((double) bars.Period.Value)) * double1)) / 10000000D);
if ((! this.OxFln4MCc) && (bars.Instrument.MasterInstrument.Compare (close, (bar1.Low + double2)) >= 0))
{
objectArray1 = new object[] { close, (bar1.Low + double2), double2 };
this.OxFln4MCc = true;
// base.AddBar (bars, close, close, close, close, time, 0);
AddBar(bars, close, close, close, close, time, 0,isRealtime);
}
else if (this.OxFln4MCc && (bars.Instrument.MasterInstrument.Compare ((bar1.High - double2), close) >= 0))
{
objectArray2 = new object[] { close, (bar1.High - double2), double2 };
this.OxFln4MCc = false;
// base.AddBar (bars, close, close, close, close, time, 0);
AddBar(bars, close, close,close, close, time, 0,isRealtime);
}
else
{
UpdateBar(bars, open, high, low, close, time, volume,isRealtime);
}
}

#if NT7
/// <summary>
/// </summary>
/// <param name="barsData"></param>
public override void ApplyDefaults(Gui.Chart.BarsData barsData)
{
barsData.DaysBack = 5;
barsData.Period.Value = 5;
}
#endif
/// <summary>
/// </summary>
public override PeriodType BuiltFrom
{
get { return PeriodType.Tick; }
}

/// <summary>
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public override string ChartDataBoxDate(DateTime time)
{
return time.ToString(Cbi.Globals.CurrentCulture.DateTimeFormat.ShortDatePattern);
}

/// <summary>
/// </summary>
/// <param name="chartControl"></param>
/// <param name="time"></param>
/// <returns></returns>
public override string ChartLabel(NinjaTrader.Gui.Chart.ChartControl chartControl, DateTime time)
{
return time.ToString(chartControl.LabelFormatSecond, Cbi.Globals.CurrentCulture);
}


#if NT7
/// <summary>
/// Here is how you restrict the selectable chart styles by bars type
/// </summary>
public override Gui.Chart.ChartStyleType[] ChartStyleTypesSupported
{
get { return new Gui.Chart.ChartStyleType[] { Gui.Chart.ChartStyleType.Box, Gui.Chart.ChartStyleType.CandleStick, Gui.Chart.ChartStyleType.HiLoBars, Gui.Chart.ChartStyleType.LineOnClose,
Gui.Chart.ChartStyleType.OHLC, Gui.Chart.ChartStyleType.Custom0, Gui.Chart.ChartStyleType.Custom1, Gui.Chart.ChartStyleType.Custom2, Gui.Chart.ChartStyleType.Custom3,
Gui.Chart.ChartStyleType.Custom4, Gui.Chart.ChartStyleType.Custom5, Gui.Chart.ChartStyleType.Custom6, Gui.Chart.ChartStyleType.Custom7, Gui.Chart.ChartStyleType.Custom8,
Gui.Chart.ChartStyleType.Custom9, Gui.Chart.ChartStyleType.Final0, Gui.Chart.ChartStyleType.Final1, Gui.Chart.ChartStyleType.Final2, Gui.Chart.ChartStyleType.Final3,
Gui.Chart.ChartStyleType.Final4 }; } }
#endif

/// <summary>
/// </summary>
/// <returns></returns>
public override object Clone()
{
return new ReversalBarsType ();
}
#if !NT7
/// <summary>
/// </summary>
public override int DaysBack
{
get { return Gui.Chart.ChartData.DaysBackTick; }
}
#endif

/// <summary>
/// </summary>
public override int DefaultValue
{
get { return 5; }
}

/// <summary>
/// </summary>
public override string DisplayName
{
get { return "ReversalBarsType"; }
}

#if !NT7
/// <summary>
/// </summary>
public override bool IsTimeBased
{
get { return false; }
}

/// <summary>
/// </summary>
public override int MaxLookBackDays
{
get { return 10;}
}

/// <summary>
/// </summary>
public override int MaxValue
{
get { return -1; }
}
#endif

#if NT7
/// <summary>
/// </summary>
/// <param name="period"></param>
/// <param name="barsBack"></param>
/// <returns></returns>
public override int GetInitialLookBackDays(Period period, int barsBack)
{
return 1;
}
#endif

/// <summary>
/// </summary>
public override double GetPercentComplete(Data.Bars bars, DateTime now)
{
return Math.Abs((double)bars.Period.Value);

}

/// <summary>
/// </summary>
/// <param name="propertyDescriptor"></param>
/// <param name="period"></param>
/// <param name="attributes"></param>
/// <returns></returns>
#if NT7
public override PropertyDescriptorCollection GetProperties(PropertyDescriptor propertyDescriptor, Period period, Attribute[] attributes)
{
PropertyDescriptorCollection properties = base.GetProperties(propertyDescriptor, period, attributes);

// here is how you remove properties not needed for that particular bars type
properties.Remove(properties.Find("BasePeriodType", true));
properties.Remove(properties.Find("BasePeriodValue", true));
properties.Remove(properties.Find("PointAndFigurePriceType", true));
properties.Remove(properties.Find("ReversalType", true));
properties.Remove(properties.Find("Value2", true));

// here is how you change the display name of the property on the properties grid
Gui.Design.DisplayNameAttribute.SetDisplayName(properties, "Value", "\rRev Bar Size");

return properties;
}
#endif

#if !NT7
/// <summary>
/// </summary>
public override int SortOrder
{
get { return 15000; }
}
#endif
/// <summary>
/// </summary>
public override bool IsIntraday
{
get { return true; }
}

/// <summary>
/// </summary>
/// <param name="period"></param>
/// <returns></returns>
public override string ToString(Period period)
{
return "ReversalBarsType " + period.Value.ToString();
}

/// <summary>
/// </summary>
public ReversalBarsType () : base(PeriodType.Custom4)
{
this.OxFln4MCc = true;
}

static ReversalBarsType ()

{
ReversalBarsType.VUHamLYRw = BarsType.Register (((BarsType) new ReversalBarsType ()));
}
}
}

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


pcomm69 View Post
Thanks for your help

here is the code decompiled
I don t find the good indication about
"public ReversalBarsType() : base(PeriodType.CustomX) { }"

You had it at the bottom:
 
Code
		/// <summary>
		/// </summary>
		public ReversalBarsType () : base(PeriodType.Custom4)
		{
			this.OxFln4MCc = true;
		}
So use Custom4 to add the bar type.

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #6 (permalink)
Elite Member
paris france
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Continuum
Favorite Futures: gold & crude light
 
pcomm69's Avatar
 
Posts: 50 since Oct 2011
Thanks: 13 given, 4 received

Oups !
Thanks
The compilation is good
but the execution in UT2 dont works
Have you an idea ?
in UT 2 :

protected override void Initialize()
{
Add(Instrument.FullName,PeriodType.Custom4, 10);// [1]
CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (BarsInProgress == 1 && (CurrentBar >=1))
{
DrawTextFixed("tag1", " ", TextPosition.TopRight); /// on efface le message
DrawTextFixed("tag1", (Opens[1][1]).ToString(), TextPosition.TopRight);
}
}

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


pcomm69 View Post
Oups !
Thanks
The compilation is good
but the execution in UT2 dont works
Have you an idea ?
in UT 2 :

What is UT2?

Try adding without the Instrument.FullName, ie:
 
Code
Add(PeriodType.Custom4, 10);// [1]
Also for better debugging add Print method to check in the output window if it executes:
 
Code
        protected override void OnBarUpdate()
        {
          if (BarsInProgress == 1) 
		{		
                     Print("inside secondary bars");	
                }
        }
Check for any errors in the output window and log tab of Control Center and let me know if it says something.

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #8 (permalink)
Elite Member
paris france
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Continuum
Favorite Futures: gold & crude light
 
pcomm69's Avatar
 
Posts: 50 since Oct 2011
Thanks: 13 given, 4 received

it say nothing
it is mute

THE LOG SAY : ERROR ON CALLING OnBarUpDate on bar 0 Bar Index Need

try it in Chart 2 min (UT 2 min)

protected override void Initialize()
{
Add(Instrument.FullName,PeriodType.Custom4, 10);// [1]
CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
Print("inside secondary bars");
}
}

Reply With Quote
 
  #9 (permalink)
Elite Member
paris france
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Continuum
Favorite Futures: gold & crude light
 
pcomm69's Avatar
 
Posts: 50 since Oct 2011
Thanks: 13 given, 4 received

THE LOG SAY : ERROR ON CALLING OnBarUpDate on bar 0. Bar Index Needs

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



pcomm69 View Post
THE LOG SAY : ERROR ON CALLING OnBarUpDate on bar 0. Bar Index Needs

I think the error message is cutoff - can you scroll to the right to get a full one?

Reply With Quote
The following user says Thank You to gregid for this post:

Reply



futures io > > > > > Add(Instrument.FullName,PeriodType.... ReversalBarsType

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
Why you should add to winners and never add to losers SMCJB Traders Hideout 34 October 26th, 2017 10:15 AM
NinjaTrader 7 List of used BarsType base(PeriodType.?) zacharydw00 NinjaTrader Programming 13 December 16th, 2015 01:59 PM
Which Instrument? xylem Emini Index Futures Trading 7 November 20th, 2014 11:48 AM
Cant add contacts or friends when trying to add them PLEASE HELP budfox Feedback and Announcements 0 October 21st, 2014 03:41 PM
Instrument multiplier/divider by other instrument, name of that? raffu NinjaTrader Programming 4 August 24th, 2011 03:37 AM


All times are GMT -4. The time now is 11:04 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.145.16.43