Roger Posted September 29, 2023 Report Share Posted September 29, 2023 Mr. Medved, I am trying to create this scan: $Change% from 7:00 AM (or any other timestamp). Symbol.Data.Last - SymbolData.Last(7:00 AM timestamp) / SymbolData.Last(7:00 AM timestamp) * 100 And create a Column for this: Change7 How do I get SymbolData.Last at specific time? (7:00 AM timestamp) Thanks, Roger Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted September 29, 2023 Report Share Posted September 29, 2023 The scan, when it runs, does not run only on the very last candle. It runs on every candle first (then, as the real time data comes in, it keeps running on the last and then new candles). So something like this will work int lastdaynum = -1; double CloseAt7 = 0; public void MainCalculation() { if (TradingDay.DayNumber != lastdaynum) { CloseAt7 = 0; lastdaynum = TradingDay.DayNumber; } if (CloseAt7 == 0 && Timestamp >= TradingDay.SessionStart.AddHours(3)) // session starts at 4am, so add 3 to get 7am { CloseAt7 = Close; } if (CloseAt7 == 0) SetScanResult(0); else SetScanResult(Close-CloseAt7); } Quote Link to comment Share on other sites More sharing options...
Roger Posted September 29, 2023 Author Report Share Posted September 29, 2023 Thank you, works great. Roger Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.