Login Page - Create Account

Support Board


Date/Time: Tue, 22 Apr 2025 06:48:48 +0000



[Programming Help] - Percnt character in Format string

View Count: 113

[2025-01-29 12:17:19]
gtaranti - Posts: 94
One thing that has bitten me a few times is that I forget that I need to escape the '%' character in format strings.
The result is that the study compiles but as soon as the line with the format string is executed, Sierra Chart closes abruptly w/o any other message on the Message Log or anything. If you hadn't saved the chartbook, you lose the latest changes.

The solution is of course to add another '%' character, like this : %%

For example, note the double % in Wick Length in below snippet:


SCSTring LogData;
LogData.Format("RSI: %.2f, Open: %.3f, Seconds in Bar: %d, Wick Length %%: %d", _RSILastValue, DailyOpenValue, seconds, WickLengthPct);


Date Time Of Last Edit: 2025-01-29 16:25:47

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

Login

Login Page - Create Account