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 Pattontje, Yesterday, 02:10 PM
        2 responses
        15 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        229 views
        0 likes
        Last Post TradingLoss  
        Started by agclub, 04-21-2024, 08:57 PM
        3 responses
        17 views
        0 likes
        Last Post TradingLoss  
        Started by TradingLoss, 04-21-2024, 04:32 PM
        4 responses
        44 views
        2 likes
        Last Post TradingLoss  
        Started by cre8able, 04-17-2024, 04:16 PM
        6 responses
        57 views
        0 likes
        Last Post cre8able  
        Working...
        X