Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limiting plot values

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

    Limiting plot values

    Hi
    I have read through the earlier post as I want to set a max value for a plot. Hope you can help as the suggestions made did not work and it is because I am working with time.

    I have written a simple code to time a volume bar relative to previous bars and then color it accordingly. This shows me whether the volume is accelerating or not. I want to limit the plot value of each bar to a max of 120 secs regardless of the actual time value.
    I want to do this as the first bar on Sunday pm is 179,100 secs (fri close to sunday pm open)
    and the average is about 70 secs during trading hours so the 70 gets lost from the graph once the bar is plotted. Same problem over night as well.

    Obviously I cant have anything less or more than 86,400 secs in a day but I was hoping to be able to terminate the plot (not the value) at 120 secs per bar.

    Any ideas?

    Code:
    TimeSpan timer = Time[0] - Time[1];
    Value.Set(timer.TotalSeconds);

    Thanks;

    Ben.

    #2
    Hello Ben,
    Thanks for writing in and I am happy to assist you.

    You can use the Math.Min method to set a value.
    Like
    Code:
    Value.Set(Math.Min(timer.TotalSeconds, 120));
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Perfect thankyou.

      Comment


        #4
        Hello Ben,
        Glad you could resolve the issue.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fredrikn, 05-08-2019, 04:01 AM
        57 responses
        4,389 views
        2 likes
        Last Post Momentum  
        Started by Blairski, Yesterday, 09:19 AM
        2 responses
        11 views
        0 likes
        Last Post Blairski  
        Started by tonynt, Today, 09:33 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by minotti1, Today, 08:31 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by SmartArtsStudio, 05-15-2021, 10:46 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X