Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time as Indicator

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

    Time as Indicator

    Is anyone aware of any way to use time only as an indicator? By this, I mean, to have a signal for action (i.e. enter buy or sell order at the bid or ask) strictly based on the time of day. For example, I want to submit a buy at the bid order at the market open at 9:30:00 exactly

    #2
    Hello Bdanels,

    Thank you for your post.

    You could use time as a signal to buy or sell in a similar way to the following reference sample:


    The SampleTimeFilter strategy creates a time filter to only trade during certain times of the day, although you could implement this idea to enter a buy or sell order at the market open if you'd like:

    Code:
    /* Checks to see if the time is during the busier hours (format is HHMMSS or HMMSS). Only allow trading if current time is during a busy period.
    The timezone used here is (GMT-05:00) EST. */
    if ((ToTime(Time[0]) >= 93000 && ToTime(Time[0]) < 120000) || (ToTime(Time[0]) >= 140000 && ToTime(Time[0]) < 154500))
    {
    // Entry Signal: If current close greater than previous close, enter long
    if (Close[0] > Close[1])
    EnterLong();
    }

    If you are wanting to use this in an indicator rather than a strategy, you could still use the same time filters as conditions, then for the signal you could have the indicator draw an object on your chart. If you want to place orders from an indicator, you would need to utilize the Account class to subscribe to account related events and place orders:


    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X