Trading days

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #138377 quote
    umebonumebon
    Participant
    Average

    Hi

    If I want my system too start on monday 00:01 and stop friday 21:59, how do I code that?

    #138381 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Since you posted in ProBuilder support I assume you are talking about an indicator, but the following code works fine with screeners and strategies, as well.

    You can use the code at https://www.prorealcode.com/topic/time-and-day-conditions/.

    There you go:

    ONCE startT = 000000   //Starting TIME
    ONCE endT   = 240000   //Ending TIME
    td0         = 0 AND OpenDayOfWeek = 0 AND OpenTime >= startT AND OpenTime <= endT   //Sunday
    td1         = 1 AND OpenDayOfWeek = 1 AND OpenTime >= 000100 AND OpenTime <= endT   //Monday
    td2         = 1 AND OpenDayOfWeek = 2 AND OpenTime >= startT AND OpenTime <= endT   //Tuesday
    td3         = 1 AND OpenDayOfWeek = 3 AND OpenTime >= startT AND OpenTime <= endT   //Wednesday
    td4         = 1 AND OpenDayOfWeek = 4 AND OpenTime >= startT AND OpenTime <= endT   //Thursday
    td5         = 1 AND OpenDayOfWeek = 5 AND OpenTime >= startT AND OpenTime <= 215900 //Friday
    td6         = 0 AND OpenDayOfWeek = 6 AND OpenTime >= startT AND OpenTime <= endT   //Saturday
    tdCond      = td0 OR td1 OR td2 OR td3 OR td4 OR td5 OR td6
    IF tdCond THEN
      .
      . //add your code here
      .
    ENDIF
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Trading days


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
6 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/04/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...