Login Page - Create Account

Support Board


Date/Time: Mon, 10 Mar 2025 17:25:54 +0000



Post From: Crosshair lines auto hide

[2022-03-31 14:48:20]
Tony - Posts: 553

Well, after a few hours coding a study to replace the crosshair, everything is OK except that sc.ActiveToolYValue is NOT updated on the other charts with the same symbol.

It is ok with activeToolIndex (vertical line) but not activeToolYValue nor any price related member or function (horizontal line).

Global Cursor behaviour cannot be reimplemented, i'm stuck.

How did you manage to follow the price between charts with the same symbol ?

That's the easy part, I assume all your studies are in the same .cpp file, all you need is a global variable, and that can be accessed by all studies, even in different charts of same chart book (assume Study1 is loaded in chart #1 and Study2 is loaded in chart #2, same chart book):


#include "sierrachart.h"
SCDLLName("dll_file")

double VerticalValue {0.0};

SCSFExport scsf_Study1(SCStudyInterfaceRef sc) {
// other codes
VerticalValue = sc.ActiveToolYValue;
// other codes
}

SCSFExport scsf_Study2(SCStudyInterfaceRef sc) {

double Value_Needed_To_Draw_Crosshair {0.0};
// other codes
Value_Needed_To_Draw_Crosshair = VerticalValue;
// other codes

}

I haven't tried this way, but I use global variables a lot, the only downside for crosshair lines is that there will be a slight delay on chart #2, if your computer is fast enough (mine is not, I set 250ms on my 2015 iMac), you could set update interval to, say 100ms or shorter, then you won't notice any delay.
Date Time Of Last Edit: 2022-05-28 04:57:54