Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Show my available time to trade on chart

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

    Show my available time to trade on chart

    I am gradually getting to know how to code my indicators, but I am having difficulty with date and time functions, even though I have spent about 3 hrs searching the forums.
    My requirement is simple, I would like to change the background colour of a pane to show when I am available to trade= daylight hours in Australia, but I still want to have the data available all day, (24/5.5). I can change the background colour based on price actions, but I cannot code to take account of the time interval.
    Available period = time > 0600 and time < 1800; in plain English. My chart date/time is in local time.
    Thank you for any help.
    I am not too sure if using the session times, that the data flows all day, or only for the session period?

    #2
    oldhiker,

    I am happy to assist.

    Something like this should work.

    Code:
    if (ToTime(Time[0]) >= ToTime(6, 0, 0) && ToTime(Time[0]) <= ToTime(14, 0, 0))
    {
    BackColorAll = Color.Green;
    }
    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hello AdamP,
      That is what I wanted. I just deleted the 'All' from the code, as I wanted to show on the main pane only. As I expected, one line of code did the job, but the problem is in the correct syntax.

      I will add this snippet to my list of "good tips" for future reference.

      As a contribution to others, if you use a general back colour, (like I do) to distinguish each pane, then you have to watch the order of execution of the two back ground colour scripts.

      Thank you

      Comment


        #4
        Oldhiker,

        Please don't hesitate to contact us should you require additional assistance.

        Thank you for your suggestion.
        Adam P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ZenCortexCLICK, Today, 04:58 AM
        0 responses
        1 view
        0 likes
        Last Post ZenCortexCLICK  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,279 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        17 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        4 views
        0 likes
        Last Post adeelshahzad  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X