Support Board
Date/Time: Sat, 08 Feb 2025 15:52:09 +0000
Post From: Rounding issue
[2020-07-06 10:03:10] |
gfx2trade - Posts: 48 |
Hi team, I don't really get why the rounding to tick size doesn't work with the following code... why does the only hard coded value provide a correct rounding number ? avgPrice = sc.RoundToTickSize(PositionData.AveragePrice, 0.01); ServiceLogStr.Format(" Average Price : %f ", avgPrice ); sc.AddMessageToTradeServiceLog(ServiceLogStr, 0); avgPrice = sc.RoundToTickSize(PositionData.AveragePrice, sc.TickSize); ServiceLogStr.Format(" Average Price : %f ", avgPrice ); sc.AddMessageToTradeServiceLog(ServiceLogStr, 0); avgPrice = sc.RoundToTickSize(PositionData.AveragePrice, myTickSize); ServiceLogStr.Format(" Average Price : %f ", avgPrice ); sc.AddMessageToTradeServiceLog(ServiceLogStr, 0); with SCInputRef Input_TickSize = sc.Input[19]; float myTickSize = 0.00; Input_TickSize.Name = "Asset Tick Size"; Input_TickSize.SetFloat(0.01); Input_TickSize.SetDescription("Underlying asset tick size."); myTickSize = Input_TickSize.GetFloat(); |