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

StrategyPlot() in if(BarsInProgress == 1)

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

    StrategyPlot() in if(BarsInProgress == 1)

    Hi, I have the StrategyPlot() in my strategy working when it is inside
    Code:
    if(BarsInProgress == 0)
    , but it will not work inside
    Code:
    if(BarsInProgress == 1)
    . Here is the strategyplot line
    Code:
                        StrategyPlot(0).DrawDot("Flat" + CurrentBar.ToString(),true,0,High[0] + TickSize, Color.GreenYellow);
    BarsInProgress == 1 is a different instrument then the 0. So I guess what I am trying to do is, when its in the '1' instrument, to draw on the '0' instrument chart. Is this possible?

    #2
    Maybe not. Why don't you try doing it in the primary bars context with Highs[1][0] instead of High[0].
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh, that was how it was originally setup except after stepping through I noticed some events only trigger correctly if the code is also in the second bars array.

      Actually, its not where the StrategyPlot plots that is important. Its just that a plot trigger only seems to happen correctly if the code is located within the second bars array event.

      E.g., If I have the strategy calculate on bar close, sometimes it seems (based on the output window) that the second bars array calculates before the primary one. Is this behavior correct assuming that each bars array were based on 30 second timeframe, just different instruments? For the most part, primary bars array closes first.

      Comment


        #4
        I might not have the complete picture ... but you can't rely in the sequence of OnBarUpdate being triggered for different series in your scenario, since a tick on secondary series (instrument B) might come in before tick on primary series (instrument A), even when on the same second.

        Comment


          #5
          OK. Thats actually the way I thought it would be (event driven, not sequence driven).

          So I guess it sounds like the strategyplot can only be called from the BarsInProgress == 0.

          Comment


            #6
            I believe it could be called from any BarsInProgress context. However, restriction as per my post be low applies.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by PaulMohn, Today, 03:49 AM
            0 responses
            6 views
            0 likes
            Last Post PaulMohn  
            Started by inanazsocial, Today, 01:15 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by rocketman7, Today, 02:12 AM
            0 responses
            10 views
            0 likes
            Last Post rocketman7  
            Started by dustydbayer, Today, 01:59 AM
            0 responses
            4 views
            0 likes
            Last Post dustydbayer  
            Started by trilliantrader, 04-18-2024, 08:16 AM
            5 responses
            23 views
            0 likes
            Last Post trilliantrader  
            Working...
            X