Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy only drawing one arrow

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

    #16
    Hello sergey_z,

    Thanks for your posts.

    I will update this thread later this morning.

    Thanks in advance for your patience.

    Comment


      #17
      Hello sergey_z,

      Thanks for your patience.

      I've attached a couple of screenshots that show a strategy test script and the results of that script in the chart and on the output window.
      The script store the values of +1 or -1 in the private data series referencing the same bar as when the cross condition occurs. Once connected to realtime (meaning all of the history has been processed) the code then iterates over the private data series to provide the information if there was a cross, as illustrated in the output window.


      Click image for larger version

Name:	sergey_z-1.PNG
Views:	159
Size:	151.3 KB
ID:	1050639
      Click image for larger version

Name:	sergey_z-2.PNG
Views:	151
Size:	66.2 KB
ID:	1050640

      Comment


        #18
        Thanks a lot. Its an amazing example!
        Last edited by sergey_z; 03-07-2019, 01:50 PM.

        Comment


          #19
          Please explain me how I can collect/analyze cross for next use not for Output?
          I need to know date,time and OHLC of Daily Bar when SMAs was crossed.

          What is the best idea for this task?

          Thanks a lot!

          Comment


            #20
            Hello sergey_z,

            Thanks for your reply.

            With the code example I posted, you can search through the data series as I did for the print statements and add additional if statement(s) where if the value of the data series crossDetect is +1 or -1 then you can assign the Time or date of that bar and OHLC values from the barsago where the +/- 1 value exists (assuming you apply it to a chart of daily bars). For example, if in the search the last positive cross was 23 bars ago you would access like Time[23], High[23], Low[23], Close[23], Open[23]. The key is once you have a barsago value then you can access the price and time series where the crosses occurred.

            Even though I have previously provided a brief code example, you will need to code your own script as we do not provide coding services If this is beyond your skill/knowledge please keep in mind that you can always hire a programmer skilled in Ninjascript and if requested we can provide references links to such programmers.

            Comment


              #21
              Hello, I am trying to do the same thing, but ran into issues similar to what was described in this post. When I tried to access the links with the video and other references, I am getting Page Not Found and that the Video format is not supported. I am on Windows 10 machine with the latest Firefox browser. I am using Ninjatrader 8.1.2.1 64-bit

              I created a strategy and converted it into indicator using the wizard - I added the conditions I want to see the indicator to show arrows when conditions are met.

              This works only for the latest condition. All the prior conditions when met do not have those signals. From the post I gather that "the tag name needs to be unique to see all occurrences". Can you help me how I should change the code to see all occurrences on the chart where conditions are met with the arrows?

              Thanks for your help!

              Comment


                #22
                Hello stockbux,

                I tried the video and it appears to work, you can also use the following link to access the file directly:



                To make a tag unique you can add the CurrentBar to the tag. If you are manually coding that would look like the following:

                "MyTag" + CurrrentBar

                Comment


                  #23
                  Thank you, Jesse. I will try those.

                  Comment


                    #24
                    Hi NinjaTrader_Jesse​, would you verify the link to the video? I am getting the following when I try the link (on both FireFox and Microsoft Edge browsers): https://tinytake.s3.amazonaws.com/pu...8-01-30-00.mp4

                    This XML file does not appear to have any style information associated with it. The document tree is shown below.
                    <Error>
                    <Code>InvalidObjectState</Code>
                    <Message>
                    The operation is not valid for the object's storage class
                    </Message>
                    <StorageClass>DEEP_ARCHIVE</StorageClass>
                    <RequestId>96Y309357FMA0DK4</RequestId>
                    <HostId>
                    Bc1THJwssI4k5feCpK5INcCWNzH7oF3/eivRjb68Jjs5gOsifi3siheT23jy3dVlso9aFFTUPqg=
                    </HostId>
                    </Error>​
                    Last edited by stockbux; 05-10-2024, 12:45 PM.

                    Comment


                      #25
                      Hello stockbux,

                      Unfortunately it looks like the tinytake video is broken. PaulH is no longer with the team so unfortunately we don't have access to this video.

                      Regarding unique tag names, the tag for a drawing object is a unique ID used to reference that specific drawing object. If you reuse the same tag, each time you call a drawing object the same drawing object will be referenced and the existing drawing object will be modified instead of a new object being created.

                      For example, if you tag your drawing object “myTag”, each time you use “myTag” the same drawing object will be modified.

                      To create a new drawing object, use a new unique string as the tag each time you call a Draw method. As an easy way to make a new string unique add ‘CurrentBar’ to the string.

                      Help Guide: NinjaScript > Language Reference > Common > OnBarUpdate() > CurrentBar

                      The code below will create a new red dot one tick below the low each time it is called.
                      Draw.Dot(this, "myTag" + CurrentBar, true, 0, Low[0] - TickSize, Brushes.Red);

                      We also have a sample script which demonstrates.

                      https://ninjatrader.com/support/help...aw_objects.htm

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by NullPointStrategies, Today, 05:17 AM
                      0 responses
                      52 views
                      0 likes
                      Last Post NullPointStrategies  
                      Started by argusthome, 03-08-2026, 10:06 AM
                      0 responses
                      130 views
                      0 likes
                      Last Post argusthome  
                      Started by NabilKhattabi, 03-06-2026, 11:18 AM
                      0 responses
                      70 views
                      0 likes
                      Last Post NabilKhattabi  
                      Started by Deep42, 03-06-2026, 12:28 AM
                      0 responses
                      44 views
                      0 likes
                      Last Post Deep42
                      by Deep42
                       
                      Started by TheRealMorford, 03-05-2026, 06:15 PM
                      0 responses
                      48 views
                      0 likes
                      Last Post TheRealMorford  
                      Working...
                      X