Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optionally Run Time-Based Trading Rule

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

    Optionally Run Time-Based Trading Rule

    Good morning! I'd like to use a time filter, which I understand from examples. I'd like to use this time filter optionally and set up a bool. Testing this morning, it was not filtering when TimeFrame was set to true. Is there a better method or is there a problem with this method?



    StartTime = DateTime.Parse("08:45", System.Globalization.CultureInfo.InvariantCulture) ;
    EndTime = DateTime.Parse("14:45", System.Globalization.CultureInfo.InvariantCulture) ;
    ​TimeFilter = true;


    if ((TimeFilter == true && (Times[0][0].TimeOfDay >= StartTime.TimeOfDay) && (Times[0][0].TimeOfDay < EndTime.TimeOfDay)) || (TF == false))


    #2
    Hello trilliantrader,

    For this type of question I would suggest adding a Print to output the values you have used in your condition. That will let you see what the Time values are to get a better idea of what is happening with the condition.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    15 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    59 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    42 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    47 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    38 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X