Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 15:02:42 +0000



convert price to price-in-ticks

View Count: 2383

[2013-04-25 00:16:09]
onnb - Posts: 660
Is there an acsil method that converts price to number of ticks?

for ES, 1500 => 6000

Onn
[2013-04-25 12:47:38]
vegasfoster - Posts: 444
Dividing price by sc.TickSize will give you the number of ticks, e.g. int Ticks = sc.Close[sc.Index]/sc.TickSize;
[2013-04-25 17:25:39]
Sierra Chart Engineering - Posts: 104368
These will be added to the next release:

  unsigned int sc.PriceValueToTicks(float PriceValue)



  
  float sc.TicksToPriceValue(unsigned int Ticks)



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
[2013-04-25 18:20:12]
onnb - Posts: 660
int Ticks = sc.Close[sc.Index]/sc.TickSize;

That isn't accurate in some cases. When you divide floats like that you will receive values that are close but not exact integer values.
The code above would always round down so if the division comes out to 5999.9999 the result would be 5999. A common method to overcome this this would be:

int Ticks = (int)floor(sc.Close[sc.Index]/sc.TickSize + 0.5);

but its best if the guys at SC deal with these things and provide a good api we all can use ;)

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

Login

Login Page - Create Account