Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SineWave that draws S/R on the chart

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

    #16
    I was able to get the start of the line to draw once sine wave crossed but it's pointing straight down. Initially here, just trying to get line to go horizontal by any given # of bars like 5. Just to see that.

    I want it to, (Like it's doing now) to start a line at a cross and stay until there is another line opposite. And to have all the lines remain. Right now, they disappear once a new line starts.

    Click image for larger version

Name:	2023-12-28 13_46_44-Chart - MES MAR24.png
Views:	198
Size:	45.8 KB
ID:	1284053Click image for larger version

Name:	2023-12-28 14_01_29-2023_12_28_13_58_31_.png - Paint.png
Views:	167
Size:	63.3 KB
ID:	1284054

    Comment


      #17
      Hello trdninstyle,

      To make a horizontal line you need to use the Line drawing object and then provide two prices that are the same price. For the bars ago you would need to specify at lest 1 bar, for example the start bar of 1 bars ago and the end bar of 0 bars ago. If you are trying to project a line into the future you could use a ray instead with the start bar of 1 bars ago and the end bar of 0 bars ago.

      To have multiple drawing objects you need to edit the tag to include a variable like the CurrentBar so each object has a unique tag name. If you use the same tag it will just update the existing object.

      Comment


        #18
        That worked well, I have it drawing straight out using the Ray. I won't stay with the ray, I just want to see it work.

        Click image for larger version

Name:	2023-12-28 15_45_25-Chart - MES MAR24.png
Views:	153
Size:	85.1 KB
ID:	1284068

        variable like the CurrentBar so each object has a unique tag name. Like Ray2 and Ray3 Ray4, like that?

        Click image for larger version

Name:	2023-12-28 15_52_11-2023_12_28_15_50_09_Chart_MES_MAR24.png - Paint.png
Views:	148
Size:	30.6 KB
ID:	1284069

        Comment


          #19
          Hello trdninstyle,

          In the string builder you need to click Add and then click Set inside the string box. That will open another menu where you can select misc -> current bar.

          Comment


            #20
            Lol, what did I do wrong?

            Click image for larger version

Name:	2023-12-28 16_19_07-Chart - MES MAR24.png
Views:	116
Size:	82.0 KB
ID:	1284074

            Comment


              #21
              Hello trdninstyle,

              If you are referring to the background of that image that would be expected if your condition is becoming true frequently. By adding current bar that will allow your condition to draw an object each time it is true. To avoid that you would need to make a more refined condition that is true less frequently. If you remove Current bar from the tag that will prevent multiple objects but it will move the existing object to the new position once the condition is true.

              Comment


                #22
                My look back is only 10 days so thats a lot of crosses of the SineWave so, thats why this happened.

                Instead of using the Ray draw tool I would like to use the Line and have it draw outward only until there is another Cross the other way but stay there. Then that new Line to stay current until the next cross.

                The Start Bars Ago being 1 and End Bars Ago being 0, give me a real small line, not projecting out into the future. I did however get all of them to stay, did as you described. Instead of 1 for start bars ago, can I put minus -1?

                Click image for larger version

Name:	2023-12-28 16_54_32-Chart - MES MAR24.png
Views:	128
Size:	77.3 KB
ID:	1284089

                Comment


                  #23
                  Hello trdninstyle,

                  That would be possible however it would require using manual coding to have a variable start or end bars ago. In order to have a line keep extending until a certain point would require saving the CurrentBar at the time when the line starts and then using that to calculate how many bars ago from now that was so the line could be redrawn.

                  Negative barsago are technically not supported because that would point to a bar that has not happened yet. Depending on the number you enter that may or may not work.

                  Comment


                    #24
                    I'll delve into manual coding tomorrow which I'm looking forward to, for right now I added another Action to draw Ray so I can use it in the morning trade.

                    Thank you, Jesse, my strategy looks very good. Should I start up a new work order or ticket and close this one?

                    Click image for larger version  Name:	2023-12-28 17_31_57-Chart - MES MAR24.png Views:	0 Size:	68.1 KB ID:	1284095

                    Even though small, I can identify the areas where the crosses occurred & manually draw them in as needed.
                    Last edited by trdninstyle; 12-28-2023, 04:45 PM.

                    Comment


                      #25
                      Hello trdninstyle,

                      If you are going to start manually coding I would suggest to start a new post for that so we can exclude the prior information from the builder and help with your specific questions on that topic. If you wanted to continue using the builder and still have questions related to this script you could continue to post in this thread.

                      Comment


                        #26
                        Il'' start a new post for the rest of it. This is so awesome! I didn't like having the label on top of the sine wave oscillator in the lower pane, so I unclicked the Plot on Chart box in the builder and instead placed a separate sinewave oscillator where I can remove the label.

                        There wasn't another way to remove the label from within the builder, was there? it's really a moot point I'm just curious.
                        Last edited by trdninstyle; 12-29-2023, 08:26 AM. Reason: is

                        Comment


                          #27
                          Hello trdninstyle,

                          Not in the builder, in manual coding you can set the label using the indicators variable after you add the indicator using AddChartIndicator.

                          Comment


                            #28
                            Originally posted by NinjaTrader_Jesse View Post
                            Hello trdninstyle,

                            after you add the indicator using AddChartIndicator.
                            Is this when I'm all through in the strategy building (Open code) then convert it into an indicator?

                            Comment


                              #29
                              Hello trdninstyle,

                              If you are going to make an indicator you can use the display name override to hide the name or customize it. https://ninjatrader.com/support/help...isplayname.htm

                              Comment


                                #30

                                get { return "My Custom Display " + Name; } All I would have to do is {"" + Name;} to display no name at all? {"" + Name;} or {""} ?

                                (I'm about to send my new post, I just finished writing it.)
                                Thank you

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                669 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                378 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                111 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                575 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                580 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X