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

Multiple Patterns

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

    Multiple Patterns

    Hello,

    I have been for at a road block with an indicator and I on the hunt to create Multiple Patterns on a Chart Simultaneously.
    Given a New Code of...

    OnBarUpdate()
    {
    DrawTriangle("Triangle", true, 0, High[0], -1, Low[-1], -2, High[-2], Color.White, Color.White, 1);
    DrawTriangle("Triangle", true, 0, High[0], -2, Low[-2], -4, High[-4], Color.White, Color.White, 1);
    }

    Where the CurrentBar will print to the Right Every other or Ever two Candles.
    I have the Suspicion that the Code is ONLY printing the MOST updated Pattern. (i.e. the Lower One.)
    Any Ideas will be greatly appreciated.

    #2
    Originally posted by Timothy_Miller View Post
    Hello,

    I have been for at a road block with an indicator and I on the hunt to create Multiple Patterns on a Chart Simultaneously.
    Given a New Code of...

    OnBarUpdate()
    {
    DrawTriangle("Triangle", true, 0, High[0], -1, Low[-1], -2, High[-2], Color.White, Color.White, 1);
    DrawTriangle("Triangle", true, 0, High[0], -2, Low[-2], -4, High[-4], Color.White, Color.White, 1);
    }

    Where the CurrentBar will print to the Right Every other or Ever two Candles.
    I have the Suspicion that the Code is ONLY printing the MOST updated Pattern. (i.e. the Lower One.)
    Any Ideas will be greatly appreciated.
    Your triangles have the same tag, so the last one will overwrite any others. Make your tags unique.

    The syntax in the NTHelp states this rather clearly.



    ref: http://www.ninjatrader.com/support/h...awtriangle.htm
    Attached Files
    Last edited by koganam; 12-17-2014, 11:58 AM.

    Comment


      #3
      Hello Timothy,

      koganam is correct in his reply -- as long as you are using the same tag for both triangles, the second one will always update the first one, rather than drawing a new triangle.

      However, I will add this to koganam's reply: In order to assign a unique tag to each triangle, you will need to find a way to assign a value that can be updated on each bar. For example, something like ("Triangle" + CurrentBar) will result in unique tags that include the current bar number ("Triangle233," Triangle234," etc.).

      Please let me know if I can assist further.
      Dave I.NinjaTrader Product Management

      Comment


        #4
        Dear NinjaTrader_David and koganam,

        Both of your ideas have worked and I am still amazed at how it was such a simple fix.
        Also I have the DrawTriangle() in a for() Loop and prints different Values for each point.
        Again, thank you very much.

        Simplified version...

        for (...)
        {
        DrawTriangle("Triangle1" + CurrentBar, ...)
        DrawTriangle("Triangle2" + CurrentBar, ...)
        }

        I am using a pair of triangles for each successful loop.
        Timothy Miller
        Last edited by Timothy_Miller; 12-17-2014, 09:22 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by r68cervera, Today, 05:29 AM
        0 responses
        2 views
        0 likes
        Last Post r68cervera  
        Started by geddyisodin, Today, 05:20 AM
        0 responses
        3 views
        0 likes
        Last Post geddyisodin  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        6 responses
        35 views
        0 likes
        Last Post JonesJoker  
        Started by GussJ, 03-04-2020, 03:11 PM
        12 responses
        3,239 views
        0 likes
        Last Post Leafcutter  
        Started by AveryFlynn, Today, 04:57 AM
        0 responses
        6 views
        0 likes
        Last Post AveryFlynn  
        Working...
        X