Support Board
Date/Time: Thu, 23 May 2024 16:52:53 +0000
Post From: Customizing trade window from control bar
[2019-11-10 08:35:54] |
T44 - Posts: 363 |
This code almost works but I'm having floating point imprecision issues. I can solve this using the precision feature of the format specifier but I'm not sure how to get and pass the correct value on a per instrument basis. e.g. %.1f for gold, %.0f for Dow, %.5f for EUR/USD. (without an ugly workaround of detecting the symbol e.g. sc.Symbol.CompareNoCase and case/switch) s_SCPositionData PositionData;
int Quantity = 0; Quantity = PositionData.PositionQuantity; float AveragePrice = 0; AveragePrice = sc.RoundToTickSize(PositionData.AveragePrice, sc.TickSize); PositionQuantity.Format("%d @ %.1f", Quantity, AveragePrice); sc.SetCustomStudyControlBarButtonText(ACS_BUTTON_9, PositionQuantity); Date Time Of Last Edit: 2019-11-10 08:36:04
|