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

Drawing not loading- strategy bujilder

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

    Drawing not loading- strategy bujilder

    When I run my strategy, the drawing will not load unless I refresh the chart. Please help.

    #2
    Hello hthphillip12,

    Welcome to the NinjaTrader forums!

    Is this a draw method like Draw.Dot() being called from OnBarUpdate()?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello hthphillip12,

      With Calculate set to OnBarClose the actions will take place when the bar closes. Set this to OnPriceChange / OnEachTick to have the script start updating in real-time.

      In historical data GetCurrentAsk/Bid will return the Close price.

      Use prints to understand why conditions are evaluating as true or false when expected.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hello hthphillip12,

        Have you added a print in the 'Do the following' section under Misc? (As demonstrated in the Debugging using prints with the Strategy Builder video)

        Are you receiving real-time data for this instrument? (Do you see the ask and bid changing in Chart Trader or on the SuperDOM)?

        My thought is that with GetCurrentBid() this is changing as the script is refreshed. Printing these to the output window would let us see if the conditions are evaluating as true or false and when.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello hthphillip12,

          The action appears to be in the same condition set, so the print would only appear if the condition is true. Perhaps the condition is not evaluating as true.

          Copy the print to a new condition set with no conditions (as demonstrated in the video).

          Start with just the time of the bar, do you see the bar close time appearing for every tick in real-time?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hello hthphillip12,

            The code shown ensures the logic and actions are being evaluated when the primary series is processing (BarsInProgress 0), and that the primary series has at least 1 bar.

            This is automatically added by the strategy builder to help prevent indexing errors.
            Hello, I want to create an indicator that show data in a chart but calculate in other charttime different to the time of the chart where is showed. For example:
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              What I am trying to do is if the values called by indicator specified value I want an arrow to print and if the values changes or one is more than the other I want the arrow to print the new update
              example: 5 volume up print arrow up or if the it changes to 5 volume down I want it to draw the arrow down in replacement.
              of if its the opposite.
              It will draw the arrow up or down, but leave both on the chart, it wont remove the one that is no longer valid, unless i refresh the chart.
              How do I program this to update to new value and draw new arrow up or down on update of the new value? Click image for larger version  Name:	code5.PNG Views:	0 Size:	18.5 KB ID:	1177982

              Comment


                #8
                Click image for larger version

Name:	b4 refresh.PNG
Views:	120
Size:	9.3 KB
ID:	1177984Click image for larger version

Name:	After regresh.PNG
Views:	103
Size:	8.6 KB
ID:	1177985
                First pic before refresh
                second pic after refresh.

                Comment


                  #9
                  Hello hthphillip12,

                  The GetCurrentAsk()/GetCurrentBid() will change as a bar is building. It may be true and false on the same bar as the ask and bid change when using Calculate OnPriceChange or OnEachTick.

                  If you refresh a chart, the most recent bid value would be used, which would be a different value than what was received sometime while the bar was open.

                  Debug the script by printing the values to understand why the condition is not evaluting as true.

                  Below is a link to a forum post that includes a video that demonstrates how to print values to understand behavior.


                  Save the output to a text file and attach this with your reply and we will be happy to analyze the output to understand why the condition is not evaluating as true.

                  Where you have asked: "How do I program this to update to new value and draw new arrow up or down on update of the new value?"

                  Save the GetCurrentBid() to a variable in the last condition set. On a new bar if the GetCurrentBid() is not equal to the saved variable, then the value has changed.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by KonAdams, Today, 10:53 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post KonAdams  
                  Started by JGriff5646, Today, 10:02 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post JGriff5646  
                  Started by AdamDJ8, Today, 09:18 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post AdamDJ8
                  by AdamDJ8
                   
                  Started by knowmad, Today, 03:52 AM
                  2 responses
                  33 views
                  0 likes
                  Last Post knowmad
                  by knowmad
                   
                  Started by ETFVoyageur, Today, 07:05 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post ETFVoyageur  
                  Working...
                  X