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

Display Bug in DrawText Method

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

    Display Bug in DrawText Method

    When I invoke DrawText from a strategy's BarsInProgress==1 code, I find that the text displayed is off by a bar ... it should be 1 bar further to the right.

    See attached.
    Attached Files

    #2
    KBJ, thanks for the post - I'll try reproducing this on my end.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      KBJ, I tried this on my end but not sure I follow what you would expect to see - the DrawText is placed on the next bar after your barcount condition is fullfilled.
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Bertrand View Post
        KBJ, I tried this on my end but not sure I follow what you would expect to see - the DrawText is placed on the next bar after your barcount condition is fullfilled.
        Bertrand, The "next bar after" would be the bar to the right of the current bar, and I would understand it if that were happening. (I might not like it, but I would understand it.)

        Inseead, the text is being displayed 1/2 to 1.5 bars to the left of the bar in question (see my screen snapshot again).

        Since the DrawText method is being called from immediately after the EnterLong call, shouldn't the text be displayed on the same bar as the trade visualization?

        (That's all I'm trying to do, by the way, is to just add some additional text to the trade visualization, for which there is no provision in the overloads for SetStopLoss and SetProfitTarget. Add to feature suggestions?)

        I'd expect the text display to be a bar to the left if I'd specified the "barsAgo" parameter with a value of 1, but I didn't do that.

        Is there some other nuance that I'm missing here?

        Comment


          #5
          KBJ, thanks for clarifying - in backtesting the EnterLong is processed on the following bar, so this would explain the differences you note. Maybe drawing on the this on the BIP 1 OnBarUpdate would bring you closer to what you seek.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Bertrand, Thanks for the explanation.

            It was already calling the DrawText method on the BarsInProgress==1 OnBarUpdate.

            I changed the design so it now does the display on the next BarsInProgress==1 OnBarUpdate. This now works but is lots of extra coding.

            What contortions it takes to make it do what I want.

            If anyone's interested, the working version of the code is attached. (It is, at least a good ... and fairly well commented ... example of how to switch control back and forth between the OnBarUpdate calls with the different BarsInProgress values.)
            Attached Files

            Comment


              #7
              KBJ, thanks for sharing this.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rocketman7, Today, 01:00 AM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by wzgy0920, 04-23-2024, 09:53 PM
              3 responses
              76 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by JonesJoker, 04-22-2024, 12:23 PM
              9 responses
              46 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by timko, Today, 06:45 AM
              1 response
              7 views
              0 likes
              Last Post gaz0001
              by gaz0001
               
              Started by Waxavi, 04-19-2024, 02:10 AM
              3 responses
              41 views
              0 likes
              Last Post gaz0001
              by gaz0001
               
              Working...
              X