Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

standard indicator enum, how to include to the custom assembly?

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

    standard indicator enum, how to include to the custom assembly?

    Hi,

    This has to be easy but can't figure it out now, sorry


    Simple indicator like:

    public class TestCallZigZag : Indicator
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "TestCallZigZag";
    Calculate = Calculate.OnBarClose;
    IsOverlay = false;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;


    DeviationType = DeviationType.Points;
    DeviationValue = 0.5;
    UseHighLow = false;
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {
    //Add your custom indicator logic here.

    ZigZag(DeviationType, DeviationValue, UseHighLow).HighBar(0,1, 256);
    }


    [NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "DeviationType", GroupName = "NinjaScriptParameters", Order = 0)]
    public DeviationType DeviationType
    { get; set; }

    [Range(0, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "DeviationValue", GroupName = "NinjaScriptParameters", Order = 1)]
    public double DeviationValue
    { get; set; }

    [NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "UseHighLow", GroupName = "NinjaScriptParameters", Order = 2)]
    public bool UseHighLow
    { get; set; }




    and if I compile that to dll
    I have to add ZigZag that it compiles and that is okay

    but I can't import that to NinjaTrader

    Import failed The NinjaScript Archive File may contain duplicate method names that ... (and so on)


    (probably because of that included ZigZag)


    Any help?, please example, no jargon...





    #2
    Hello raffu,

    Thank you for the post.

    It looks like that is due to how the enum is defined for the system indicator. The most simple fix is to make a duplicate of the ZigZag and then wrap the enum in a custom namespace. I have attached a sample that uses the CustomZigZag indicator which is just a copy of the original. It has the enum DeviationType put in a namespace CustomZigZagUtils so it can be called explicitly.

    I tried exporting this and importing the compiled assembly and it was able to import for me.
    Attached Files

    Comment


      #3
      Okay, Thanks.

      I thought that there might be easier method for that as I just made a custom enum and used that ..

      for some reason you can call ZigZag(DeviatonType.Points ...
      and it automatically include that ZigZag in that way that it is possible to import. (no explicit include)





      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X