Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Please need your help to improve this strategy

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

    Please need your help to improve this strategy

    I've created a simple strategy... whenever volume of a particular tick is more than 4000 a diamond is drawn for that particular tick as shown in the attachment

    According to this strategy a diamond is drawn for the current tick only. Is it possible to draw diamond to all those ticks whose volume is greater than 4000 (or user input value) from the first tick of the day to closing tick of the day?

    Please need ur help guys as i dont know the coding also this is my first strategy.

    #2
    Hello sagarjss,

    Thanks for your post.

    Draw objects require a tag name when drawn. By default the Strategy Builder will assign the same tag name to each successive draw object. By using the same tag name, the previous object will be automatically removed as you can only have a draw objects with unique tags so you are only looking at the latest occurrence of the object. This also reduce the resources used to display.

    You can create draw objects with "Unique" tag names so that each previously drawn object will remain on the chart. Please note that If you have a lot of displayed objects you may experience a performance impact.

    Here is a short video that will help with how to create draw objects with unique names as well as offset the draw objects for better display: https://paul-ninjatrader.tinytake.co...MF8xMTMwNTc0MA

    Comment


      #3
      Thank you very much bro its working perfectly.

      Comment


        #4
        Please can you help me to improve further...
        How to draw line starting from the tick with diamond drawing object to next 150ticks?
        is it possible to make these drawing object global?


        Comment


          #5
          Hello sagarjss,

          Thanks for your reply.

          The Strategy Builder would not create a global draw object, however you could Unlock the strategy builder and work directly in Ninjascript code to accomplish this by changing the Draw. method to one that allows you to specify global.

          ."How to draw line starting from the tick with diamond drawing object to next 150ticks?" The Strategy Builder is limited in this ability. All I could suggest would be to draw a horizontal line at the same time as the diamond and at the price level preferred. To avoid an over abundance of lines, you could remove all draw objects at the beginning of the session (or at a specific time). You could also accomplish your goal by unlocking the strategy builder strategy and working directly in Ninjascript. The coding effort to accomplish your goal would likely be extensive to keep track of all the lines and update them all on each new tick.

          Comment


            #6
            can you please help me with the code as im new to coding..how to make this global.. line no 77 of the attachment

            Comment


              #7
              Hello sagarjss,

              Thanks for your reply.

              Here is a link to the help guide on the Draw.Diamond() method: https://ninjatrader.com/support/help...t8/?charts.htm

              The help guide shows 6 different ways to call the Draw.Diamond method.

              You would use this one: Draw.Diamond(NinjaScriptBase owner, string tag, bool isAutoScale, int barsAgo, double y, bool isGlobal, string templateName) This shows the parameters needed and the table in the help guide identifies what the parameter data types are.

              In your case you would have to change the method as follows:

              Draw.Diamond(this, "d1"+CurrentBar, false, 0, Close[0], true, "");

              I changed the "tag name" but you can leave what you have as is if you wish.

              After carefully making the changes (syntax matters!) , right mouse click on the script and select "Compile". If successfully compiled you should remove the strategy from the chart and then reapply it(and enable it).

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              51 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              127 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              69 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X