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 NullPointStrategies, Today, 05:17 AM
    0 responses
    43 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X