Login Page - Create Account

Support Board


Date/Time: Mon, 23 Dec 2024 00:04:42 +0000



Post From: Draw line with ACSIL question.

[2015-04-10 13:49:40]
marcovth - Posts: 61

I am answering my own question for others to use ... this seems to work fine for me ...


float topPrice=sc.YPixelCoordinateToGraphValue(sc.ChartRegion1TopCoordinate);
float botPrice=sc.YPixelCoordinateToGraphValue(sc.ChartRegion1BottomCoordinate);
float MiddlePrice=(topPrice+botPrice)/2.0f;
float P1px=sc.RegionValueToYPixelCoordinate(MiddlePrice,0);
float P2px=sc.RegionValueToYPixelCoordinate(MiddlePrice-sc.TickSize,0);
float PixelsPerTickSize=P2px-P1px;
int LineWidthPerTickSize=(int)(PixelsPerTickSize-2.0f);

Remember, this calculates the LineWidth per TickSize for the Price Window, and not for a study frame.