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 DJ888, 04-16-2024, 06:09 PM
        4 responses
        12 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by terofs, Today, 04:18 PM
        0 responses
        7 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by nandhumca, Today, 03:41 PM
        0 responses
        6 views
        0 likes
        Last Post nandhumca  
        Started by The_Sec, Today, 03:37 PM
        0 responses
        3 views
        0 likes
        Last Post The_Sec
        by The_Sec
         
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X