Announcement

Collapse
No announcement yet.

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 varun12343, Today, 03:09 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_Marco  
              Started by Lance El Camino, Yesterday, 04:14 PM
              2 responses
              21 views
              0 likes
              Last Post NT-Roland  
              Started by MatthewLesko, Yesterday, 11:13 PM
              1 response
              12 views
              0 likes
              Last Post NT-Roland  
              Started by kevinenergy, Today, 01:44 AM
              0 responses
              2 views
              0 likes
              Last Post kevinenergy  
              Started by jtrading82, Yesterday, 04:56 PM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Working...
              X