Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jjs12, Today, 10:29 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by lakman184, 03-24-2024, 01:30 PM
    5 responses
    28 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by thumper57, 05-11-2024, 04:30 PM
    16 responses
    44 views
    0 likes
    Last Post thumper57  
    Started by Salahinho99, 05-05-2024, 04:13 AM
    10 responses
    72 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by lorem, 04-25-2024, 09:18 AM
    13 responses
    56 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X