Login Page - Create Account

Support Board


Date/Time: Thu, 27 Feb 2025 09:32:47 +0000



SCDateTime Problem

View Count: 554

[2021-06-27 19:35:20]
User39772 - Posts: 311
Hello,

I have the following code:  
  
SCDateTime DateTime = sc.LatestDateTimeForLastBar;
SCDateTime PosTime = PositionData.LastEntryDateTime;
  
//5 Minutes after open of the position I want an action to occur
//but the following code does not work, argument "DateTime == PosTime.AddMinutes(5)" never becomes "true"

if ( DateTime == PosTime.AddMinutes(5) )
  Subgraph_Test[sc.Index] = sc.Low[sc.Index];


//Is my understanding wrong ?
[2021-06-27 22:20:25]
Sierra Chart Engineering - Posts: 104368
Change this to as shown:
if ( DateTime >= PosTime.AddMinutes(5) )

But you need to carefully consider how this would work. You really need to check a range of time like across one minute, to ensure you get a match.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2021-06-27 22:21:10

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account