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

NinjaScript Drawing Objects Not Drawing

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

    #16
    Hello,

    I tried a few more minor tweaks and none of them solved the problem.

    As you can see in the first three attached screenshots, on my 15 minute chart, it always only draws BLUE UP-ARROWS. And on my 5 minute chart, it always only draws BROWN DOWN-ARROWS. And I only see one arrow on each chart.

    Then I tried a major tweak, by creating an 'if else if' block of code to go through the six time-frames in this indicator.

    I did get it to compile with no errors, but again, I get the exact same behavior.

    Screenshots attached. And the most recent .cs file is also attached.

    Next I will try creating a Do While Loop to go through the six time-frames in this indicator.
    Attached Files

    Comment


      #17
      Hello,

      I also tried creating a Do While Loop to go through the six time-frames that I have in this indicator, but I still have the same issues.

      On my 15 minute chart, it always only draws BLUE UP-ARROWS. And on my 5 minute chart, it always only draws BROWN DOWN-ARROWS. And I only see one arrow on each chart.

      Screenshot attached. And my most recent .cs file attached.
      Attached Files

      Comment


        #18
        Hello,

        I'm going to create six different .cs file indicators, each with the different time-frame that I want to use (15 minute, 30 minute, 60 minute, 1440 minute, Weekly and Monthly). Then I plan to use the Input parameter to try to be able to access them from one single indicator.

        I am getting the desired behavior that I want when I use the 15 minute time-frame condition on my 15 minute and 5 minute charts, (after changing the condition to be when the close of the current bar is higher than the high of the previous bar, and vise versa for short trades), but when I created a new .cs file to try to draw arrows based on the 30 minute time-frame, it still drew the arrows based on the 15 minute time-frame and not based on the 30 minute time-frame.

        So I am thinking that it is because of the following code: Draw.TriangleUp(this, "myTag310" + CurrentBar, true, 0, Close[0] - TickSize, Brushes.Blue);

        How do I tell it to make the condition based on the 30 minute time-frame, and based on the 60 minute time-frame and not based on the time-frame of the chart that the indicator is placed on?

        I tried using Bar instead of CurrentBar, but that gave me errors.

        Screenshots attached.

        Comment


          #19
          Hello,

          I tried using the following and it seems to be working to make the indicator condition be based on the 30 minute time-frame, even when placed on a 15 minute or 5 minute chart, but I'm not sure:

          if(BarsInProgress == 1) combined with a Draw.TriangleUp(this, "myTag135" + CurrentBar, true, 0, Close[0] - TickSize, Brushes.Blue);

          Can someone let me know if this is correct or not?

          By the way, when I right-click on the chart and go to Drawing Tools > DrawingObjects... I get a lot of tags with both blue and brown arrows being drawn, on both my charts.

          Screenshots attached. And the .cs file is attached.

          Thanks,
          Attached Files

          Comment


            #20
            if(BarsInProgress == 1) combined with a Draw.TriangleUp(this, "myTag135" + CurrentBar, true, 0, Close[0] - TickSize, Brushes.Blue);
            If I added a 30 minute series to my indicator and then used the above logic then I would expect to see an arrow on every sixth bar when looking at a 5-min chart, every other bar on a 15-min chart, and every bar on a 30-min chart. Are you not seeing that? If it is, what are you expecting to see?

            I feel this may just be a misunderstanding of how multiple time frames are updating. Maybe I can be of more assistance if I know specifically what you are trying to accomplish?

            Are you trying to draw a triangle each time this condition becomes true or do you only want one triangle on your chart at a time?



            Josh G.NinjaTrader Customer Service

            Comment


              #21
              Hi Josh,

              Thanks for your reply.

              Since I have not been able to get the condition that I'm using to access all the time-frames that I want, I thought that I would try creating six different .cs files (one for each time-frame) and then access them through an input parameter through a new indicator that I would create.

              So in that scenario, yes, that is what I would want to see on this particular .cs file:

              An arrow on every sixth bar when looking at a 5-min chart, every other bar on a 15-min chart, and on every bar on a 30-min chart.


              Preferably the indicator removes or makes transparent all the previous arrows that were drawn on the chart and only shows the arrow that is drawn on the current price bar, if my condition is met.

              What I'm trying to accomplish is this:

              * I want to have a blue arrow be drawn on the chart when the current price bar closes above the high of the previous price bar, for each of the following time-frames:

              15 minute, 30 minute, 60 minute, 1440 minute, weekly, monthly

              * I want to have a brown arrow be drawn on the chart when the current price bar closes below the low of the previous price bar, for each of the time-frames above.

              * I want the arrows to be drawn on the chart if I put this indicator on a 1 minute chart, 2 minute chart, 5 minute chart, 150 Tick chart or any other such time-frame.


              * If I can get this to work, then later on I would want a blue arrow drawn if the signal is on just one time-frame, and to have two blue arrows to be drawn if the signal is on two to three time-frames and two green arrows to be drawn if the signal is on four or more time-frames.

              Any suggestions?

              Thanks again,

              Comment


                #22
                Hello Josh,

                I just tried creating a new .cs file where I try to access the 15 minute time-frame and the 30 minute time-frame in a different way.

                It seems to work, but I'm not sure. Blue and brown arrows are being drawn and Drawing Objects appear, but I'm not sure if that is from one of the time-frames or from both of them.

                Screenshots attached.

                And the new .cs file attached.

                Could this work to have multiple time-frames called from within one .cs file?
                Attached Files

                Comment


                  #23
                  I just made a quick indicator to demonstrate how different time frames are updating and will draw some text above each bar letting you know which time frame updated there. It will also draw a color corresponding arrow below the bar letting you know if the close is greater than the high of the previous bar on that time frame. Is this close to what you are looking for?

                  Attached Files
                  Josh G.NinjaTrader Customer Service

                  Comment


                    #24
                    Hi Josh,

                    Awesome. That is great. Thanks so much for creating that .cs file, it works perfectly.

                    I will try to code it and see if I can output what I am wanting.

                    I think this is the solution I was looking for.

                    Thanks so much, I appreciate your help very much.

                    Take care,

                    Comment


                      #25
                      Thanks again for your help Josh,

                      I do appreciate it very much.

                      Attached is a screenshot of how the arrows draw on the chart after I made a couple of tweaks.

                      Attached also is the .cs file.

                      If you see anything wrong with my logic or code, please let me know, if you get a chance.
                      Attached Files

                      Comment


                        #26
                        Happy to help! Your screenshot looks good to me and I see nothing wrong with your syntax. Let me know if I can be of further assistance.
                        Josh G.NinjaTrader Customer Service

                        Comment


                          #27
                          Hi Josh,

                          Thanks for your reply and for the feedback.

                          You and the other support staff at Ninjatrader provide a truly great service.

                          I have just one other thing that I've been trying to figure out how to do with this indicator, with no luck due to my limited programming knowledge.

                          How could I make only the most recent 10 bars or so - at a maximum - display arrows and text, if the condition I have is met?

                          I know that I could add more conditions, to have the arrows and text display less often, but I don't want to risk curve fitting/ over-fitting.

                          Comment


                            #28
                            Happy to be of assistance.

                            You could loop through the DrawObjects and remove objects where the GetBar using the time of the anchor is more than 10. You would likely need to subtract globalLine.StartAnchor.SlotIndex from the CurrentBar

                            Help Guide- DrawingObjects

                            Help Guide- GetBar()


                            Josh G.NinjaTrader Customer Service

                            Comment


                              #29
                              Thanks again Josh,

                              I will check out the help guide documents.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              436 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post FAQtrader  
                              Started by rocketman7, Today, 09:41 AM
                              5 responses
                              19 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by frslvr, 04-11-2024, 07:26 AM
                              9 responses
                              127 views
                              1 like
                              Last Post caryc123  
                              Working...
                              X