Support Board
Date/Time: Sat, 30 Nov 2024 06:33:39 +0000
Clock - Study Indicator
View Count: 1990
[2020-04-05 17:04:48] |
Oxcap - Posts: 65 |
Hello, I've the clock - realtime study on most of my charts. I see that some charts show the time while most are not showing it. Is this due to a specific setting? I've attached a screenshot as example. It is enabled and not hidden. Thanks |
Attachment Deleted. SC - Clock study.png / V - Attached On 2020-04-05 17:04:19 UTC - Size: 118.11 KB - 526 views |
[2020-04-05 18:09:22] |
Ackin - Posts: 1865 |
Just idea: Try mark study "Clock-realtime" and then using the button "Move Down" move study to the last position in the window (studies window as on your attached picture)...because it is possible that the study is graphically overlapped by another study. Date Time Of Last Edit: 2020-04-05 18:36:45
|
[2020-04-05 18:52:39] |
Oxcap - Posts: 65 |
Thanks. I tried that just now and didn't work.
|
[2020-04-07 12:13:40] |
Sierra Chart Engineering - Posts: 104368 |
There is a setting on the Clock - Real Time study for Draw Above Main Price Graph. Set this to Yes to have the Clock drawn above the other items in the chart. If you do not have this option in the study, then update to the latest release to have this available. Also try removing the study from the chart and adding it again. 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 |
[2022-10-19 04:02:01] |
User132988 - Posts: 13 |
Sierra, is it possible to give the clock a name? So you can print NY and London times with the actual location name as part of the study?
|
[2022-10-19 15:52:55] |
John - SC Support - Posts: 36350 |
There is not a way in the Clock - Realtime study to add text. You could modify the source code to the study to make the change yourself. Refer to the following: How to Build an Advanced Custom Study from Source Code Or you can add a Stationary Text drawing and set the parameters to match the clock and then align it where you want with the clock. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2022-10-19 20:12:12] |
User132988 - Posts: 13 |
Thanks John, I can do that, but when I add a second clock I cant see it (one for UK, one for US)
|
[2022-10-19 22:07:46] |
John - SC Support - Posts: 36350 |
You would need to change the position of the second clock that you add. The Inputs for Initial Horizontal Position from Left and Initial Vertical Position from Bottom control this. Refer to the Inputs section at the following: Clock - RealTime If you follow the link, you will see that after the Clock - Realtime study is added, changing these inputs does not change position. Make sure you go through the links to get to how to move it, if this is what you need. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2022-10-20 07:05:14] |
User132988 - Posts: 13 |
Thanks John, tried that but I still cant see the clock - only the first clock seems to display OK The only way i can get both to display is to change the chart region for the second clock |
[2022-10-20 13:13:36] |
JohnR - User831573 - Posts: 306 |
I'm just a CS user trying to be helpful. I can get 2 or more clocks to show on the same chart and the same region. I would suggest you follow these steps. 1 -> First add clock #1. press OK to get back to the chart and not in study edit/add window. 2 -> Now move clock #1. Now that this is done, 3 -> Open the Studies window and add clock #2. Click OK to get back to the chart and you should see 2 clocks. I changed the background of the first clock to verify I can tell which clock is which. Also, you could do this color change to represent your different time zones if you did not want to change source code. Hope this helps, JohnR |
[2022-10-20 14:16:44] |
JohnR - User831573 - Posts: 306 |
OK, Since there have been many to help me with my coding issues, Here is a simple give back. I've attached a screen shot, .cpp source file, and compiled .DLL which can be added to your Data directory. I've modified the ClockRealTime to now allow text to be added to the end of the display. I call it MyClockRealTime. I have include source as well as the prebuilt DLL. This is my first time offering code. It can be added to User Contributed Studies, or used to modify the built in original - if SC chooses to do so. Basically all I did was change the name of the DLL, Study and Graph Name. Then add an additional input [9] for the text and added 1 line of code to add the text to the original string. --> RemainingTimeString += Input_MyTimeZone.GetString(); Hope this helps, JohnR // The top of every source code file must include this line #include "sierrachart.h" // This line is required. Change the text within the quote // marks to what you want to name your group of custom studies. SCDLLName("MyClockRealTime") /*==========================================================================*/ // changed name of study to MyClockRealTime SCSFExport scsf_MyClockRealTime(SCStudyInterfaceRef sc) { SCSubgraphRef Subgraph_Clock = sc.Subgraph[0]; SCInputRef Input_HorizontalPosition = sc.Input[0]; SCInputRef Input_VerticalPosition = sc.Input[1]; SCInputRef Input_UseAMPM = sc.Input[3]; SCInputRef Input_DrawAboveMainPriceGraph = sc.Input[4]; SCInputRef Input_UseBoldFont = sc.Input[5]; SCInputRef Input_TransparentLabelBackground = sc.Input[7]; SCInputRef Input_HourOffset = sc.Input[8]; // Line added below for MyTimeZone SCInputRef Input_MyTimeZone = sc.Input[9]; if (sc.SetDefaults) { // Set the configuration and defaults // Changed name of graph to My Clock - RealTime sc.GraphName = "MY Clock - RealTime"; sc.AutoLoop = 0;//Manual looping sc.GraphRegion = 0; sc.ValueFormat = 0; sc.UpdateAlways = 1; // Changed name of graph to My Clock Subgraph_Clock.Name = "My Clock"; Subgraph_Clock.LineWidth = 20; Subgraph_Clock.DrawStyle = DRAWSTYLE_CUSTOM_TEXT; Subgraph_Clock.PrimaryColor = RGB(0, 0, 0); //black Subgraph_Clock.SecondaryColor = RGB(255, 127, 0); //Orange Subgraph_Clock.SecondaryColorUsed = true; Subgraph_Clock.DisplayNameValueInWindowsFlags = 1; Input_HorizontalPosition.Name.Format("Initial Horizontal Position From Left (1-%d)", static_cast<int>(CHART_DRAWING_MAX_HORIZONTAL_AXIS_RELATIVE_POSITION)); Input_HorizontalPosition.SetInt(20); Input_HorizontalPosition.SetIntLimits(1, static_cast<int>(CHART_DRAWING_MAX_HORIZONTAL_AXIS_RELATIVE_POSITION)); Input_VerticalPosition.Name.Format("Initial Vertical Position From Bottom (1-%d)", static_cast<int>(CHART_DRAWING_MAX_VERTICAL_AXIS_RELATIVE_POSITION)); Input_VerticalPosition.SetInt(90); Input_VerticalPosition.SetIntLimits(1, static_cast<int>(CHART_DRAWING_MAX_VERTICAL_AXIS_RELATIVE_POSITION)); Input_UseAMPM.Name = "Use A.M. and P.M."; Input_UseAMPM.SetYesNo(false); Input_DrawAboveMainPriceGraph.Name = "Draw Above Main Price Graph"; Input_DrawAboveMainPriceGraph.SetYesNo(false); Input_UseBoldFont.Name = "Use Bold Font"; Input_UseBoldFont.SetYesNo(true); Input_TransparentLabelBackground.Name = "Transparent Label Background"; Input_TransparentLabelBackground.SetYesNo(false); Input_HourOffset.Name = "Hour Offset"; Input_HourOffset.SetInt(0); // 2 Lines added below for MyTimeZone Input_MyTimeZone.Name = "My Time Zone"; Input_MyTimeZone.SetString("USA"); return; } int Hour = 0, Minute = 0, Second = 0; if (sc.IsReplayRunning()) SCDateTimeMS(sc.GetEndingDateTimeForBarIndex(sc.ArraySize - 1)).GetTimeHMS(Hour, Minute, Second); else sc.CurrentSystemDateTimeMS.GetTimeHMS(Hour, Minute, Second); if (Input_HourOffset.GetInt() != 0) { Hour += Input_HourOffset.GetInt(); if (Hour > 24) Hour -= 24; else if (Hour < 0) Hour += 24; } SCString RemainingTimeString; if (Input_UseAMPM.GetYesNo()) { int AdjustedHour = Hour; if (Hour >= 13) AdjustedHour -= 12; RemainingTimeString.Format("%d:%02d:%02d ", AdjustedHour, Minute, Second); if (Hour < 12) RemainingTimeString += "am"; else RemainingTimeString += "pm"; } else RemainingTimeString.Format("%d:%02d:%02d", Hour, Minute, Second); // Line added below for MyTimeZone RemainingTimeString += Input_MyTimeZone.GetString(); int HorizontalPosition = Input_HorizontalPosition.GetInt(); int VerticalPosition = Input_VerticalPosition.GetInt(); int DrawAboveMainPriceGraph = Input_DrawAboveMainPriceGraph.GetYesNo(); int TransparentLabelBackground = Input_TransparentLabelBackground.GetYesNo(); int UseBoldFont = Input_UseBoldFont.GetYesNo(); sc.AddAndManageSingleTextUserDrawnDrawingForStudy(sc, 0, HorizontalPosition, VerticalPosition, Subgraph_Clock, TransparentLabelBackground, RemainingTimeString, DrawAboveMainPriceGraph, 0, UseBoldFont); } /*==========================================================================*/ Date Time Of Last Edit: 2022-10-21 02:22:18
|
SC MyRealTimeClock.jpg / V - Attached On 2022-10-20 14:07:43 UTC - Size: 24.94 KB - 177 views MyClockRealTime.dll - Attached On 2022-10-20 14:08:16 UTC - Size: 80 KB - 278 views MyRealTimeClock.cpp - Attached On 2022-10-20 14:09:53 UTC - Size: 4.25 KB - 296 views |
[2022-10-20 21:34:32] |
User132988 - Posts: 13 |
Thanks John! I cant see the DLL to test it out though :)
|
[2022-10-21 02:25:00] |
JohnR - User831573 - Posts: 306 |
Try again, The DLL file was marked private. I am not sure it that was by default, or if support changed it to private as it is an executable. Hopefully, I am not doing something 'wrong' by making the DLL file "Public". JohnR Date Time Of Last Edit: 2022-10-21 02:27:24
|
[2022-10-21 03:20:03] |
User132988 - Posts: 13 |
Thanks! ill try and get it working :) not familiar with custom studies, ill work it out. Thanks John!
|
[2022-12-06 16:34:25] |
DKtrades - Posts: 39 |
Can I chime in here with a question about this custom study? Is there a way for the input for the Hour Offset to accommodate fractions, ie 0.x and 0.xx numbers? My local timezones are at times both UTC+9.5 and UTC+8:45 so having a whole number here doesn't help. I have very limited understanding of the code, but is this where the code would be changed: Input_HourOffset.Name = "Hour Offset"; Input_HourOffset.SetInt(0); I don't know how to set the second line above to accept a fraction for example 9.5 or 8.75 (as this would be 8 hrs 45 mins I would assume, hopefully correctly). Thanks. |
[2022-12-06 18:49:03] |
JohnR - User831573 - Posts: 306 |
DKtrades, I don't think it is possible if you are using the SC funcitons to display the Date- Time. Because in the end you are displaying an SC function, which is looking for an Int I'm self taught, so I am a little light in many SC and C++ capabilities. From looking at the SC docs, Hour is defined as an int from SC. To change the line you are asking about, it could be Input_HourOffset.SetFloat(0.0); But you would also need to change other lines that refer to it to also be float from int. Like the following if (Input_HourOffset.GetFloat() != 0.0) { Hour += Input_HourOffset.GetFloat(); Also in the line above if you use the "Hour' variable, it is going to round to an Int, losing your fractional amount. I could be wrong, Hope this helps, JohnR |
[2022-12-07 14:21:56] |
DKtrades - Posts: 39 |
Thanks JohnR, that's great as it definitely gives me something to start with. All my coding is self-taught, but is pretty much HTML/PHP and a little javascript related! Much appreciated for the reply. |
To post a message in this thread, you need to log in with your Sierra Chart account: