Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to transfer an indicator to another

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

    How to transfer an indicator to another

    Hi,
    is it possible to transfer an indicator to one another? I want to pass an interface wich contains an custom indicator. Doing that via parameter shows error when saving the indicator.

    Background:
    I want to separate filter and signal logic. the signal indicator should get an interface wich contains a flag or a enum when the filter indicator indicates long or short trading.
    Is this possible and how would i do that?

    Ich tried to do this like that and it seems to work but the filter indicator don't change its state. I guess the update mechanism isn't working like that:
    Code:
    FilterIndicator = KillZonesFilter(0);
    SignalIndicator = LiquidityVoid(1);
    SignalIndicator.Filter = FilterIndicator;
    In the signal indicator:

    Code:
    private ITrendFilter _filter;
    public ITrendFilter Filter
    {
    get
    {
    Update();
    return _filter;
    }
    
    set
    {
    _filter = value;
    }
    }
    ​​

    The Problem in the indicator. The filter doesn't get updated anymore...

    Code:
    protected override void OnBarUpdate()
    {
    
    if(Filter != null)
    {
    //Filter don't update anymore..
    Filter.Update();
    if (Filter.TradingModus == TradingMode.Long)
    {
    DetermineLongLiqidityGap();
    }
    else if (Filter.TradingModus == TradingMode.Short)
    {
    DetermineShortLiquidityGap();
    }
    
    return;
    }
    Last edited by Johnny90; 06-27-2023, 07:49 AM.

    #2
    Hello Johnny90,

    From the code you have posted, it appears that the _filter variable is of the type ITrendFilter which would be the only object type that can be assigned to that variable.
    This would mean that any indicator cannot be assigned as only an ITrendFilter class can be assigned.

    I would recommend contacting the original author to see if modifications can be made to accept any indicator class instead of only ITrendFilter.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,
      thanks for the quick response. I've updated the post to make it more clear. I can pass the indicator fine, but it doesen't seem to update anymore. Logic is correct and gets triggered when debugging the filter indicator but the signal indicator don't gets updated as well.

      Comment


        #4
        Hello Johnny90,

        Calling an indicator in OnBarUpdate() should cause it to update OnBarUpdate() internally.

        If the values called are not plots, added with AddPlot(), then the indicator would need to call Update() to update.
        <IndicatorName>.Update().


        I would recommend contacting the author or distributor of the script to inquire how the script should be called from a host.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello ChelseaB,
          thanks. The .Update did the trick.

          Best regards,
          Johnny

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          646 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          367 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X