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

Problems with finding drawing objects in my strategy

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

    Problems with finding drawing objects in my strategy

    Hi, I have noticed a problem in my strategy and do not know what to do, maybe someone can help me?
    The following problem: I can't find any drawing objects, why?
    In a test strategy everything works without problems

    I made a video about it, in which everything is quite clearly visible. On the left is my strategy and on the right the test strategy

    Video: https://youtu.be/YBUc-XA5yIs

    Click image for larger version

Name:	Screenshot_1.jpg
Views:	209
Size:	393.6 KB
ID:	1159641
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thank you for the post.

    The strategy would need to have a bar close in realtime to see any objects in the draw objects collection, it looks like you are using a condition which would equate to a historical bar in the image so that would not allow for any objects to be printed.

    Please try removing the condition so the print always happens and then also allow the script to close a bar in realtime or switch to OnEachTick processing to see if that helps.


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

    Comment


      #3
      Hi _Jesse, that can't be, because otherwise it wouldn't work with both strategies. in my example both strategies are loaded on the same chart and both are calculated on OnBarClose()

      I tried it anyway, only with:
      Code:
      foreach (DrawingTool draw in DrawObjects.ToList())
      {
         base.Print(draw.Tag);
      }
      The same result. In the test strategy everything ok, and in my strategy nothing

      Click image for larger version

Name:	Screenshot_1.jpg
Views:	212
Size:	516.7 KB
ID:	1159676
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        Unfortunately that detail doesn't really help to know why the one strategy is not seeing the objects.

        If the strategy on the left in the image is not working I would suggest to reduce it until you find the code which is causing the issue. It may instead be easier to work up from the sample on the right as that is working, you could try adding code to the sample on the right to see if something prevents the objects from being seen when added.


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

        Comment


          #5
          Hi _Jesse, if I do it this way, it goes like this:

          Code:
          foreach (IChartObject obj in chartWindow.ActiveChartControl.ChartObjects)
          {
              DrawingTool draw = obj as DrawingTool;
              if (draw != null) 
                 {
                      base.Print(draw.Tag);
                 }
          }
          I don't understand the world anymore Is there a simple explanation for this?
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment


            #6
            Hello sidlercom80,

            Unfortunately from the given details I couldn't tell you what may be happening there. The best way to diagnose the problem is to compare the working script vs the non working script to see whats different. Your script on the left is not simplified, you have some other code in the script so it would be best to remove all of the modifications to see if any part is affecting the strategy. I also can't see the defaults for each script to see if either has any different setup.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              ok, thanks anyway

              sidlercom80
              NinjaTrader Ecosystem Vendor - Sidi Trading

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by alifarahani, Today, 09:40 AM
              6 responses
              36 views
              0 likes
              Last Post alifarahani  
              Started by Waxavi, Today, 02:10 AM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by Kaledus, Today, 01:29 PM
              5 responses
              14 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by Waxavi, Today, 02:00 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by gentlebenthebear, Today, 01:30 AM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X