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 with Strategy Builder

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

    Drawing with Strategy Builder

    Hi
    I want to draw, for example, a vertical line with the condition of a falling MACD and it must be under 0.

    With NT7 it drawn on every single bar (backward) a vertical line when condition where given.
    With NT8 it does not, it only draws the vertical line on the 2. last bar and not backward.

    What do I have to change so it works like in NT7

    Thanks for any help,
    Michael

    #2
    Hello Michael,

    You will need to make the tag name unique. I would recommend adding the CurrentBar number to the tag string.

    What code is being used to draw the object in NinjaTrader 7?
    What code is being used to draw the object in NinjaTrader 8?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB

      I used the Strategy Builder to make the drawing. So when you say "I would recommend adding the CurrentBar number to the tag string" I have no idea what that means.

      I add the strategy I wrote with NT8, it is absolutely the same I made in NT7, but I don't use NT7 anymore.
      Attached Files

      Comment


        #4
        Hello michi08,

        NinjaTrader 7 scripts cannot run in NinjaTrader 8. If these scripts are exactly the same, then it would not work at all..

        I want to see specifically the NinjaTrader 7 script to see what is being used as the tag name.

        Attached is a screenshot that demonstrates how to add CurrentBar to the tag string.

        Below is a publicly available link to the Strategy Builder 301 training video hosted on YouTube.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello ChelseaB

          sorry for the misunderstanding, I didn't mean that I use the same script from NT7, it is a NT8 script but with the same value and terms.
          I did install NT7 and wrote the script so you can verify it.
          Also I did adjust the "add CurrentBar to the tag string" but now I do not see any vertical line.

          here are the script from NT7
          Attached Files

          Comment


            #6
            Hello michi08,

            Thank you for providing both scripts as requested.

            The code is not the same.

            From the NinjaTrader 7 script:
            DrawVerticalLine("My vertical line" + CurrentBar, 0, Color.Lime);

            From the NinjaTrader 8 script:
            Draw.VerticalLine(this, @"TSIdirection Vertical Line_1", 0, Brushes.Lime, DashStyleHelper.Solid, 2);

            The NinjaTrader 7 script adds the CurrentBar number to each tag to make each tag unique per bar by adding the bar number.

            The NinjaTrader 8 script that you have posted in post #3

            You will need to add the CurrentBar to the tag in the NinjaTrader 8 script.

            You mention that the line is not appearing, what changes did you make? May we see?
            Last edited by NinjaTrader_ChelseaB; 12-05-2017, 04:01 PM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I did it again with restart and it is working, ok the vertical lines. But now I can't see the bars.
              Scale is out of range
              Attached Files
              Last edited by michi08; 12-05-2017, 04:25 PM.

              Comment


                #8
                Hello michi08,

                If you remove the script from the chart are bars showing on the chart?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hello ChelseaB

                  I made a completely new script (same values), deleted the DB cache, restarted and it is working now, can see on every bar a vertical line.

                  When I want instead of vertical lines triangles, do I have also to add "CurrentBar to the tag string"?

                  Michael

                  Comment


                    #10
                    Hello Michael,

                    With any drawing object if the tag name is re-used the object is re-drawn (meaning removed and re-added) using the new parameters.

                    Any time a tag name is unique a new drawing object is drawn.

                    Yes, this also applies to Draw.Triangle(), Draw.TriangleDown(), and Draw.TriangleUp(), along with all drawing objects.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello ChelseaB,

                      I wrote a script (same values like the vertical lines) but with triangle up and down.
                      Unfortunately it isn't working, can you please check this strategy and tell me what I'm doing wrong this time.

                      Thank you very much,
                      Michael
                      Attached Files

                      Comment


                        #12
                        Hello Michael,

                        It looks like the objects should be drawn 4 points (on the ES with a TickSize of .25 this would be 16 ticks) above or below the bar and the auto scale is turned off.

                        When you say it is not working, what exactly is not working?

                        Are you opening the DrawObjects window and there are no objects?

                        Are the objects out of view because they are drawn too far above the bar?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Hello ChelseaB,

                          I'm looking at a CL chart so the triangle must be drawn 4 ticks above or below of the bar (OK, that was with NT7).
                          But you are right, the triangles are 400 ticks away from the bar.
                          So I changed it to +/- 0.04 and it is working now.

                          A lot of small things are different between NT7 and NT8, I hope with the time I get used to it.

                          Anyway thank you for anything.

                          Regards,
                          Michael

                          Comment


                            #14
                            Hi Michael,

                            Were you meaning to use an Offset with the Offset Type set to Ticks?

                            You probably have the offset type set to Arithmetic in the builder. Set it to ticks if you want ticks.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello ChelseaB,

                              Thank you, I did change it from Arithmetic to Tick. I think with those draw typ's I did understand it.

                              What I did now is a strategy with Fixed Text. I add a string "Current Bars" like before, but it shows both text (long - short) on every bar and not when it should.
                              Can you pleeeease check that too.

                              Other question with those Fixed Text option, can I change the size and color of those text?

                              Thank you,
                              Michael
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,235 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Started by jclose, Yesterday, 09:37 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,415 views
                              0 likes
                              Last Post Traderontheroad  
                              Working...
                              X