Support Board
Date/Time: Sat, 01 Mar 2025 04:56:54 +0000
Post From: Detecting OnPriceChanged Intrabar
[2021-09-12 03:09:51] |
silvereagle - Posts: 23 |
I think my brain panicked a little after looking at some of that code, but after digging around a little and some experimentation and a cold beer, I think the key line of code I was looking for was: sc.LastTradePrice
Basically, to get OnPriceChanged functionality, 1. create a persistant float to house the prior price value 2. get the last trade price, float ltp = sc.LastTradePrice 3. if PriorPrice != ltp, then ... the price changed. 4. set priorprice to ltp I also found sc.GetLastPriceForTrading(). Not sure if I should use that or sc.LastTradePrice, or if it really matters. In the logging, it looks the same. Hope this helps someone someday. :) |