Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using the Zigzag indicator as a signal handler

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

    Using the Zigzag indicator as a signal handler

    I am trying to convert a signal handler from the swing indicator to the zigzag indicator and I am stuck. Here is the code I currently have.

    else if (State == State.DataLoaded){

    Zigzag = Zigzag;
    signalHandler = AddChartIndicator(zigzag);
    signalHandler.AddSignal(new Zigzag(this));

    dotsHandler = new DotsHandler(this);
    pattersHandler = new PattersHandler(this);

    Thanks in advance

    #2
    Hello ROZELA99,

    Thanks for your post.

    The code you have mentioned for "SignalHandler" "DotsHandler" and "PatternsHandler" would not be supported NinjaScript code that we provide.

    Also note that AddChartIndicator does not have a return value and cannot be assigned to a variable.

    If you would like to use the ZigZag indicator in a another NinjaScript, you could instantiate the indicator in State.DataLoaded and use the indicator's HighBar and LowBar methods to determine where ZigZig High's and Low's have occurred.

    Instantiating the indicator:
    Code:
    private ZigZag ZigZag1;
    
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            Name                                        = "MyScript";
        }
        else if (State == State.DataLoaded)
        {                
            ZigZag1                = ZigZag(Close, DeviationType.Points, 0.5, false);
        }
    }
    Syntax for using the ZigZag indicator and the HighBar and LowBar methods can be found here - https://ninjatrader.com/support/help...t8/?zigzag.htm

    Please let us know if we can be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    49 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    69 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    36 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    96 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    59 views
    0 likes
    Last Post PaulMohn  
    Working...
    X