Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsPeriodType

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    BarsPeriodType

    I created a new BarType as below

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Name = Custom.Resource.NinjaScriptBarsTypeSTRType3D;
    BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 14, BarsPeriodTypeName = "STR SBars(14)", Value = 1 };

    BuiltFrom = BarsPeriodType.Tick;
    DaysToLoad = 10;
    IsIntraday = true;

    }
    else if (State == State.Configure)
    {
    Name = string.Format(Core.Globals.GeneralOptions.CurrentC ulture, Custom.Resource.DataBarsTypeSTRType3D, BarsPeriod.Value, (BarsPeriod.MarketDataType != MarketDataType.Last ? string.Format(" - {0}", Core.Globals.ToLocalizedObject(BarsPeriod.MarketDa taType, Core.Globals.GeneralOptions.CurrentUICulture)) : string.Empty));

    Properties.Remove(Properties.Find("BasePeriodType" ,true));
    Properties.Remove(Properties.Find("PointAndFigureP riceType",true));
    Properties.Remove(Properties.Find("ReversalType",t rue));


    SetPropertyName("Value", Custom.Resource.NinjaScriptBarsTypSTRTypeBias);
    SetPropertyName("Value2", Custom.Resource.NinjaScriptBarsTypeSTRTypeCuttingE dge);
    SetPropertyName("BaseBarsPeriodValue", Custom.Resource.NinjaScriptBarsTypeSTRTypeHarmoniz er);


    }
    }


    Suppose If I use 15 or another number, the code compile but then I have an unhandled exception. Why this..? and what is the maximum BarsPeriodType value.. below is the code

    BarsPeriod = new BarsPeriod { BarsPeriodType = (BarsPeriodType) 15, BarsPeriodTypeName = "STR SBars(15)", Value = 1 };

    and also how can i remove "Base Period Type = Tick" from the Bar type DataSeries user Input screen ? (see the screen shot) .I am not required this input on this Bar Type.(from the above code)
    Attached Files
    Last edited by rmk; 07-07-2015, 02:59 AM.

    #2
    What is the exception you receive? Do you have more than one bar type with the same enum value for that BarsPeriordType (15)?

    The Maximum value is int.MaxValue

    The following method should remove that user input, which I can see you have in your code:

    Code:
    Properties.Remove(Properties.Find("BaseBarsPeriodType",	true));
    Since that doesn't appear to be working, perhaps it is not getting called due to your exception in State.Defaults? Can you let me know what the exception is and we can work from there.
    MatthewNinjaTrader Product Management

    Comment


      #3
      BarsPeriodType

      I have attached the error screen Shot and my code screen Shot here.This error happened when we set BarsPeriodType =15 (see the code screen shot).If I set this BarsPeriodType as 14 then it will work as fine.I have not created any other bar type here.The BarsTypes folder contains only the default BarTypes as NT 8 currently provided.(see the DefaultBarTypes ScreenShots)

      Also in my code I set this

      Properties.Remove(Properties.Find("BaseBarsPeriodT ype", true));

      Then also this "Base Period Type " will showing my DataSeries Input screen( Please see the BasePeriodType screen shot).
      I required only 3 input parameters for running this Bar Type (Bias, Cutting Edge and Harmonizer).
      May i know what is wrong in my code?..
      Attached Files

      Comment


        #4
        I see - I believe you hit a bug that will be fixed in Beta 3. If you have created a (BarsPeriodType)14 and had it configured on a chart, then change the enum to 15 in code, compile-> then try to load it o the chart, the chart tries to find the last configured BarsPeriodType 14 which does not exist and throws an exception.

        For removing the Property, your screenshot shows BasePeriodType although you posted BaseBarsPeriodType which is the correct property name. Please double check your code is using the following (you can look at the @RangeBarsType which correctly removes this property).

        Properties.Remove(Properties.Find("BaseBarsPeriodT ype", true));
        MatthewNinjaTrader Product Management

        Comment


          #5
          Thanks for the Reply.

          Now the BaseBarsPeriodType removed from the Bartype.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wjadevries, Today, 03:35 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by Mykro, Today, 03:59 PM
          0 responses
          5 views
          0 likes
          Last Post Mykro
          by Mykro
           
          Started by venkateshdvk, Today, 01:34 PM
          1 response
          22 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by westofpluto, Today, 01:54 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by zacharydw00, Today, 02:11 PM
          4 responses
          15 views
          0 likes
          Last Post zacharydw00  
          Working...
          X