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

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
    Paul H.NinjaTrader Customer Service

    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.

          Paul H.NinjaTrader Customer Service

          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).

              Paul H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Aviram Y, Today, 05:29 AM
              0 responses
              1 view
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              6 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              216 views
              1 like
              Last Post PaulMohn  
              Working...
              X