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

Input value

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

    #16
    Hello tonynt,

    How does the example above show how to use the properties?
    It provides a full sample including one of the properties being used, you can use the properties listed on that page in the same way as shown in the sample. I am not certain I could explain this any differently, this is the same concept used throughout the samples in the help guide. When an object has properties it would be listed how you see it in this sample describing each property that can be used and likely one sample including one property being used.

    eg like "Draw.HorizontalLine(NinjaScriptBaseowner,stringta g,boolisAutoScale,doubley,Brushbrush,DashStyleHelp erdashStyle,intwidth)" ?
    This is an overload pattern not a property. This is how you initially draw an object and supply the initial parameters it requires. As noted previously there is no overload pattern that includes IsLocked so you need to use the objects properties which brings us back to the help guide sample we are talking about.

    What might be the reason for this "jump-behavior" in CL please?
    I couldn't really say without trying a sample of that code myself, are you also setting the line from OnBarUpdate while trying to move it manually?

    The script has control over the line so any manual adjustments you make will be lost as soon as OnBarUpdate calls this syntax again with the same tag name. If you are also calling the Draw. syntax at the same time you are moving it, that would likely produce strange results.


    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #17
      Hello,

      thank you for your reply. The script has no control over the line as this is disabled from the bool. And there is no issue in ES, NQ.... but in CL one can not move the line as with other instruments because the line jumps somewhere else (same script of course)
      if(linedraw==false)
      {if((Closes[1][0]>Lows[1][0] || Closes[1][0]<Highs[1][0]) && linedraw==false)
      {TxLine = Draw.HorizontalLine(this, "TxLine", true, Closes[1][0], Brushes.Blue, DashStyleHelper.Dash,2);linedraw=true;
      TxLine.IsLocked=false;}}
      if(linedraw==true)
      {if (DrawObjects["TxLine"] != null && DrawObjects["TxLine"] is DrawingTools.HorizontalLine)
      {double linePrice = Instrument.MasterInstrument.RoundToTickSize(TxLine .StartAnchor.Price);linevalue = linePrice;}}

      // linedraw is true as I see in my control drawings, please see attached screenshot

      Thank you!
      Tony
      Attached Files
      Last edited by tonynt; 07-30-2019, 09:35 AM. Reason: add screenshot

      Comment


        #18
        Hello

        The script has no control over the line as this is disabled from the bool.
        That is not how the IsLocked works, this just unlocks the object. Your script is drawing the object so it still controls it. If you call the syntax after you moved the object, it will move back to where it is programmed to be.

        If the object is moving unexpectedly while you are manually moving it, are you certain that is not just your logic calling the Draw method again?

        Please let me know if I may be of further assistance.

        JesseNinjaTrader Customer Service

        Comment


          #19
          Hello,

          It looks like you had edited the post while I replied again so the information no longer matches. I will ensure to leave a longer time before replying in the future to allow your edits.

          If the line is not behaving as you are expecting this is something you need to debug. From the code snippet I cannot tell what may be happening, I would suggest adding prints to where you call the drawing object to make sure that is not being called unexpectedly.

          Please let me know if I may be of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #20
            Hello Jesse,

            attached is a video where you can see the behavior in CL. You can see its the same script, you can see in the chart the bool is set, you can see the line can be moved accurately in NQ and you can see that in CL the line jumps to somewhere. Above are posted the few lines of the code. There´s nothing more to debug after all.

            Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


            Thank you!
            Tony
            Last edited by tonynt; 07-30-2019, 10:19 AM. Reason: add link

            Comment


              #21
              Hello.

              I can see from the video what you are describing however this does not help to answer the question on why that's happening. Are you certain that your code is not being called to redraw the object while you are dragging it? The video and code snippet so far don't allow me to confirm that is not happening, I can only take your word for it. I still suggest adding prints to confirm that.

              I also see you have other items applied to the chart, are you seeing the same happen on a completely empty chart with no other modifications? It looks like you have the chart linked as well, please try a more simple test which includes only the strategy on a single data series. It looks like in your code you are using multiple series as well, I can suggest to make a more simple test to debug the situation further.

              Please let me know if I may be of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #22
                Hello,

                after debugging for hours I did now the "1st step"!!! I opened a new chart for CL and there it is working OK, same as with ES, NQ.....

                So it would be interesting why the moving of a drawing object does not work correctly depending of some changes in chart properties (or maybe dataseries). I had only one indicator (orderflow delta) on that CL chart which I removed as well. After I attached the template of a new chart (new chart saved as template "CL_Test") it worked also on that chart window where there have been the issues before. If you would be interested about this - and this is out of my scope - you can visit me with teamviewer if you want to see on the workspace where it occurs.

                Best regards
                Tony
                Last edited by tonynt; 07-30-2019, 02:13 PM. Reason: add info

                Comment


                  #23
                  Hello,

                  If you had not noted what specifically you changed that caused the result to change I don't believe we would want to do any further investigation there, it sounds like that solved the problem. If you otherwise find a specific configuration which causes that effect for drawing objects in general we can report it.

                  Please let me know if I may be of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by cls71, Today, 04:45 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post cls71
                  by cls71
                   
                  Started by mjairg, 07-20-2023, 11:57 PM
                  3 responses
                  213 views
                  1 like
                  Last Post PaulMohn  
                  Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                  4 responses
                  544 views
                  0 likes
                  Last Post PaulMohn  
                  Started by GLFX005, Today, 03:23 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post GLFX005
                  by GLFX005
                   
                  Started by XXtrader, Yesterday, 11:30 PM
                  2 responses
                  12 views
                  0 likes
                  Last Post XXtrader  
                  Working...
                  X