Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 17:20:21 +0000



[User Discussion] - Using Persistent Variables for Time

View Count: 994

[2015-02-07 03:13:17]
CustomIndicators - Posts: 126
I'm trying to get my automatic drawings to show up correctly, but I'm having a hard time. Am I doing this right?

Up top, I put:
SCDateTime& peakOneDT=sc.PersistVars->scdt1;

Down in the logic, I have:
peakOneDT = sc.BaseDateTimeIn[sc.Index -2];

And when I try to use that in a drawing:
IndicatorTarget.BeginIndex = peakOneDT;
IndicatorTarget.BeginValue = sc.BaseData[SC_HIGH][peakOneDT];

This is for a DRAWING_HORIZONTAL_RAY.
If I comment out the BeginIndex, it gives me the line on the right price. If I don't comment out the BeginIndex, it gives me nothing. Am I doing the SCDateTime persistent variable wrong or something?
[2015-02-07 03:59:40]
ejtrader - Posts: 688
You can try this instead ( replace BefinIndex with BeginDatetime )

IndicatorTarget.BeginDateTime = peakOneDT;
[2015-02-07 04:16:44]
ejtrader - Posts: 688
You can try this instead ( replace BeginIndex with BeginDatetime )

IndicatorTarget.BeginDateTime = peakOneDT;

Or alternately:

IndicatorTarget.BeginIndex = sc.BaseDataIn[sc.GetContainingIndexForSCDateTime(sc.ChartNumber,peakOneDT)]; // There might be better version of it - but not sure
Date Time Of Last Edit: 2015-02-07 05:53:48
[2015-02-07 05:39:28]
CustomIndicators - Posts: 126
ejtrader, thank you very much! That was the answer to this issue. :)

I used your first answer, and it nailed it.

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

Login

Login Page - Create Account