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

Current day condition

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

    Current day condition

    Hi,
    I'd like to have my rays drawn on the current day only. As it stands, I get rays drawn at the inputed times on both the current day and prior days. I suspect I need to add a date series condition of some sort.
    Thanks.

    Click image for larger version

Name:	Current day.png
Views:	19
Size:	26.7 KB
ID:	1295833

    #2
    Hello manraygun,

    Thank you for your post.

    The key to drawing one ray rather than multiple is the "Tag" field. If you use the same tag each time it is drawn, the same object is modified. If you use a unique tag, such as in your screenshot that puts CurrentBars[0] + Ray_1, then a new object is created each time. Please modify your tag to only be "Ray_1" without the CurrentBar value and this should result in only one ray being drawn and modified each time. For more information on the different parameters for drawing rays:


    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply, Emily.
      My goal is to keep all rays drawn on the current day within the inputed times. (I believe that means the tag is necessary.)
      What I am trying to eliminate from my chart are rays drawn on the prior day(s) within the inputed times.
      On the attached chart, the inputed time is 5:30 am to 6:30 am.
      The rays I want to keep were drawn on the current day.
      The rays drawn yesterday 5:30 am to 6:30 are the ones I'm trying to eliminate.
      Click image for larger version

Name:	current prior.png
Views:	15
Size:	47.9 KB
ID:	1295911
      Attached Files

      Comment


        #4
        Originally posted by manraygun View Post
        Thanks for the reply, Emily.
        My goal is to keep all rays drawn on the current day within the inputed times. (I believe that means the tag is necessary.)
        What I am trying to eliminate from my chart are rays drawn on the prior day(s) within the inputed times.
        On the attached chart, the inputed time is 5:30 am to 6:30 am.
        The rays I want to keep were drawn on the current day.
        The rays drawn yesterday 5:30 am to 6:30 are the ones I'm trying to eliminate.
        Click image for larger version

Name:	current prior.png
Views:	15
Size:	47.9 KB
ID:	1295911
        Thank you for the clarification.

        What I suggest is to create a new set of Conditions and Actions that checks if it is 5:29am, and if so the action is to remove all draw objects. This is likely the most simple option in the Strategy Builder if the rays are the only draw objects you are working with. Here is a screenshot example:Otherwise, you could use Action > Drawing > Remove draw object to remove individual objects based on their tag values, but you would need a way to save all of the tags for each object drawn on the previous day. This could be done with a custom String series created on the Additional Data screen but could get complex in the Strategy Builder due to limitations of its capabilities, and would ultimately be easier to do in an unlocked script edited in the NinjaScript Editor.

        Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Thank you!

          Comment


            #6
            I got it to work by unlocking and adding this code suggest by Google Gemini to what I had. Thanks again.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Karado58, 11-26-2012, 02:57 PM
            8 responses
            14,828 views
            0 likes
            Last Post Option Whisperer  
            Started by Option Whisperer, Today, 09:05 AM
            0 responses
            1 view
            0 likes
            Last Post Option Whisperer  
            Started by cre8able, Yesterday, 01:16 PM
            3 responses
            11 views
            0 likes
            Last Post cre8able  
            Started by Harry, 05-02-2018, 01:54 PM
            10 responses
            3,204 views
            0 likes
            Last Post tharton3  
            Started by ChartTourist, Today, 08:22 AM
            0 responses
            6 views
            0 likes
            Last Post ChartTourist  
            Working...
            X