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 argusthome, Yesterday, 10:06 AM
    0 responses
    14 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    11 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    9 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    4 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    31 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X