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

reducing the number of Rays drawn

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

  • NinjaTrader_Jesse
    replied
    Hello kaywai,

    You could make time conditions to control when you draw something.

    The rays are being drawn based on your conditions so part of that condition could be a time/date condition.

    https://ninjatrader.com/support/help...lightsub=today
    https://ninjatrader.com/support/help...ightsub=totime

    If I were to remove all drawing objects the the Draw.Rays indicator, would the rest of my drawn objects be removed as well?

    Any that were drawn by this script if you call RemoveDrawObject with its tag, other objects drawn by other scripts or manually are not affected.

    Leave a comment:


  • kaywai
    replied
    Hi Jesse,

    Is it possible if I wanted to use time to control whether Rays are drawn or not? If I were to draw rays from today's trading data? Would that be possible? Would time zones matter if I was trading the US markets from Asia?
    If I were to remove all drawing objects the the Draw.Rays indicator, would the rest of my drawn objects be removed as well?

    Regards
    Kay Wai

    Leave a comment:


  • kaywai
    replied
    THank you for your suggestions and guidance Jesse. I will take a look and work on it.

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello kaywai,

    You can restrict the number of drawn objects by using either non unique tag names or logic to remove old objects.

    If you wanted to always have 15 total objects you can use non unique tags, for example re use the same 15 tags. Each time you re use a tag it will update the old object to the new values effectively moving the object and limiting to a certain number of tags. You would have to modify your logic to work with repeating tags instead of making unique tag names for each object, this would be something you would have to figure out based on what you made.

    You can also use logic to remove old objects based on some factor. You can use RemoveDrawObject with tags of objects you created to remove them. One way to do that would be to use a for loop to loop over a number. This depends on how you make your tag, you would have to make tags that increment in order to be able to use a loop to later remove them by the tag name.

    An alternative would be to use a List and store the objects in the list after you draw them. Later you could loop over that list to remove objects based on whatever criteria you wanted.

    https://ninjatrader.com/support/help...moveDrawObject

    Leave a comment:


  • kaywai
    started a topic reducing the number of Rays drawn

    reducing the number of Rays drawn

    Hi,

    I've got too many Rays drawn on my chart (it's doing as per code) but I would like to restrict or curb the number of Rays drawn as some Rays are no longer relevant (too old) and are occupying precious real estate.

    Could I restrict the number of Rays drawn to say the most recent 15? How would I do that?
    Alternatively, could I have keep Rays drawn which begin from a specific day or specific time (like from yesterday 12pm?
    Or could have I keep Rays which are drawn within a certain range (like yesterday's trading range)?

    I tried de-selecting autoscale and adjusting the chart scale but it didn't help. By the time I re-scaled it, the candles were mostly below the bottom of the chart window.

    Regards
    Kay Wai
    Last edited by kaywai; 05-23-2022, 04:20 AM.

Latest Posts

Collapse

Topics Statistics Last Post
Started by SharkTankValue, Today, 03:19 AM
0 responses
2 views
0 likes
Last Post SharkTankValue  
Started by Sheridan, Yesterday, 11:06 AM
1 response
26 views
0 likes
Last Post NinjaTrader_Jason  
Started by JasmneGardne, Today, 01:07 AM
0 responses
22 views
0 likes
Last Post JasmneGardne  
Started by ttodua, 01-28-2018, 04:24 PM
6 responses
975 views
0 likes
Last Post Heart
by Heart
 
Started by jeronymite, Yesterday, 10:22 PM
0 responses
31 views
0 likes
Last Post jeronymite  
Working...
X