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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X