Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Updated June 14, 2019
Top Posters
looks_one
tulanch
with 6 posts (16 thanks)
looks_two
Grantx
with 5 posts (0 thanks)
looks_3
Quick Summary
with 1 posts (0 thanks)
looks_4
mkata
with 1 posts (2 thanks)
trending_up
4,465 views
thumb_up
18 thanks given
group
9 followers
forum
12 posts
attach_file
3 attachments
June 7th, 2019, 02:42 PM
Columbus, OH
Experience: Intermediate
Platform: SierraChart
Trading: CL
Posts: 35 since May 2013
Thanks Given: 153
Thanks Received: 24
Grantx
Can anyone help me out here? I am trying to set the starting point of a line to a specific date and time.
If I set my DateTime object to a date, how do I get Tool.BeginDateTime to accept it as a date?
SCDateTime GrantxDateTime;
GrantxDateTime.SetDateTime(2019, 06, 07, 10, 39, 0);
Tool.BeginDateTime = GrantxDateTime;
Tool.EndDateTime = sc.BaseDateTimeIn[DrawingIndex];
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
June 7th, 2019, 03:09 PM
Reading UK
Legendary no drama Llama
Posts: 1,776 since Oct 2016
Thanks Given: 2,830
Thanks Received: 5,059
mkata
SCDateTime GrantxDateTime;
GrantxDateTime.SetDateTime(2019, 06, 07, 10, 39, 0);
Tool.BeginDateTime = GrantxDateTime;
Tool.EndDateTime = sc.BaseDateTimeIn[DrawingIndex];
Works
Had to use .SetDateTimeYMDHMS(2019, 06, 07, 14, 39, 0);
Thank you!
June 14th, 2019, 12:13 PM
Reading UK
Legendary no drama Llama
Posts: 1,776 since Oct 2016
Thanks Given: 2,830
Thanks Received: 5,059
Hoping someone can help me out here. I am attempting to modify the 'High/Low for time period' study.
If I set the study to show the 1st hour of the US opening range , then it plots higher and lower lines on the chart. I would like the study to also reflect the difference between the high and low of that opening range.
You can see in the attached images what I mean. One image shows the standard study settings and the other one shows it with the text I am trying to add.
Here is the modified code. Everything I have added is commented with 'My stuff'.
You can see right at the bottom I calculate the high and low but then I dont know why the study does not add that data to the chart? I have added the drawstyle as text but why aint it showing?
Code
/*============================================================================
Session high low
----------------------------------------------------------------------------*/
SCSFExport scsf_SessionHighLow(SCStudyInterfaceRef sc)
{
SCSubgraphRef HighOfDay = sc.Subgraph[0];
SCSubgraphRef LowOfDay = sc.Subgraph[1];
//my stuff
SCSubgraphRef HighLowRange = sc.Subgraph[2];;
SCFloatArrayRef TimeRangeHigh = sc.Subgraph[0].Arrays[0];
SCFloatArrayRef TimeRangeLow = sc.Subgraph[0].Arrays[1];
SCFloatArrayRef DataRange = sc.Subgraph[0].Arrays[2];
SCInputRef StartTime = sc.Input[0];
SCInputRef EndTime = sc.Input[1];
SCInputRef Version = sc.Input[2];
SCInputRef InputDataHigh = sc.Input[3];
SCInputRef InputDataLow = sc.Input[4];
SCInputRef DisplayHighLowIncrementally = sc.Input[5];
SCInputRef NumberDaysToCalculate = sc.Input[6];
if (sc.SetDefaults)
{
sc.GraphName = "High/Low for Time Period";
sc.GraphRegion = 0;
sc.AutoLoop = 0;
HighOfDay.Name = "High";
HighOfDay.DrawStyle = DRAWSTYLE_DASH;
HighOfDay.PrimaryColor = RGB(0,255,0);
HighOfDay.DrawZeros = false;
LowOfDay.Name = "Low";
LowOfDay.DrawStyle = DRAWSTYLE_DASH;
LowOfDay.PrimaryColor = RGB(255,0,255);
LowOfDay.DrawZeros = false;
//My stuff:
HighLowRange.Name = "Range";
HighLowRange.DrawStyle = DRAWSTYLE_TEXT;
HighLowRange.LineWidth = 8;
HighLowRange.LineLabel = LL_DISPLAY_VALUE | LL_VALUE_ALIGN_RIGHT | LL_VALUE_ALIGN_CENTER;
HighLowRange.PrimaryColor = RGB(0, 255, 0);
StartTime.Name = "Start Time";
//Set the start time to US session time 14:30
StartTime.SetTime(52200);
EndTime.Name = "End Time";
//Set the start time to US session time 15:30
EndTime.SetTime(55800);
InputDataHigh.Name = "Input Data High";
InputDataHigh.SetInputDataIndex(SC_HIGH);
InputDataLow.Name = "Input Data Low";
InputDataLow.SetInputDataIndex(SC_LOW);
DisplayHighLowIncrementally.Name = "Display High Low Incrementally";
DisplayHighLowIncrementally.SetYesNo(false);
NumberDaysToCalculate.Name= "Number Of Days To Calculate";
NumberDaysToCalculate.SetInt(10000);
Version.SetInt(2);
return;
}
if(Version.GetInt() < 2 )
{
InputDataHigh.SetInputDataIndex(SC_HIGH);
InputDataLow.SetInputDataIndex(SC_LOW);
Version.SetInt(2);
}
if (NumberDaysToCalculate.GetInt() <= 0)
NumberDaysToCalculate.SetInt(10000);
int InputDataHighIndex = InputDataHigh.GetInputDataIndex();
int InputDataLowIndex = InputDataLow.GetInputDataIndex();
SCDateTime InStartTime = StartTime.GetDateTime();
SCDateTime InEndTime = EndTime.GetDateTime();
for(int Index = sc.UpdateStartIndex; Index < sc.ArraySize; Index++)
{
SCDateTime DaysToCalculateStartDateTime = sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[sc.ArraySize-1]) - ( NumberDaysToCalculate.GetInt() - 1 );
if (sc.BaseDateTimeIn[Index] < DaysToCalculateStartDateTime)
continue;
SCDateTime StartDateTime = 0;
SCDateTime EndDateTime = 0;
SCDateTime BarDate = sc.BaseDateTimeIn[Index].GetDate();
if(InStartTime < InEndTime)
{
StartDateTime = BarDate + InStartTime;
EndDateTime = BarDate + InEndTime;
}
//Times are reversed and the current time is greater than or equal to the start time
else if (sc.BaseDateTimeIn[Index].GetTimeInSeconds() >= InStartTime.GetTimeInSeconds() )
{
StartDateTime = BarDate + InStartTime;
EndDateTime = BarDate + 1 + InEndTime;
}
//Times are reversed and the current time is less than or equal to the end time
else if (sc.BaseDateTimeIn[Index].GetTimeInSeconds() <= InEndTime.GetTimeInSeconds() )
{
StartDateTime = BarDate + InStartTime - 1;
EndDateTime = BarDate + InEndTime;
}
//Initial calculations or start of new time range
if(Index == 0 || sc.BaseDateTimeIn[Index - 1] < StartDateTime)
{
TimeRangeHigh[Index] = -FLT_MAX;
TimeRangeLow[Index] = FLT_MAX;
//My stuff: This actually does fuckall
DataRange[Index] = -FLT_MAX - FLT_MAX;
}
else
{
TimeRangeHigh[Index] = TimeRangeHigh[Index - 1];
TimeRangeLow[Index] = TimeRangeLow[Index - 1];
}
//Outside of range
if(sc.BaseDateTimeIn[Index] > EndDateTime || sc.BaseDateTimeIn[Index] < StartDateTime)
continue;
if(sc.BaseData[InputDataHighIndex].GetArraySize() > 0)
{
if(TimeRangeHigh[Index] < sc.BaseData[InputDataHighIndex][Index])
TimeRangeHigh[Index] = sc.BaseData[InputDataHighIndex][Index];
}
else
{
if(TimeRangeHigh[Index] < sc.BaseData[0][Index])
TimeRangeHigh[Index] = sc.BaseData[0][Index];
}
if(sc.BaseData[InputDataLowIndex].GetArraySize() > 0)
{
if(TimeRangeLow[Index] > sc.BaseData[InputDataLowIndex][Index])
TimeRangeLow[Index] = sc.BaseData[InputDataLowIndex][Index];
}
else
{
if(TimeRangeLow[Index] < sc.BaseData[0][Index])
TimeRangeLow[Index] = sc.BaseData[0][Index];
}
if (DisplayHighLowIncrementally.GetYesNo())
{
HighOfDay[Index] = TimeRangeHigh[Index];
LowOfDay[Index] = TimeRangeLow[Index];
My stuff: This also does fuckall
HighLowRange[Index] = DataRange[Index];
}
else
{
int BackIndex = Index;
while(true)
{
if(BackIndex < 0)
break;
SCDateTime IndexDateTime = sc.BaseDateTimeIn[BackIndex];
if(IndexDateTime < StartDateTime)
break;
HighOfDay[BackIndex] = TimeRangeHigh[Index];
LowOfDay[BackIndex] = TimeRangeLow[Index];
//My stuff:
float Openprice = sc.BaseDataIn[SC_OPEN][Index];
float HighPrice = sc.BaseDataIn[SC_HIGH][Index];
float LowPrice = sc.BaseDataIn[SC_LOW][Index];
float ClosePrice = sc.BaseDataIn[SC_LAST][Index];
DataRange[Index] = HighPrice - LowPrice;
BackIndex--;
if(sc.UpdateStartIndex != 0)
sc.EarliestUpdateSubgraphDataArrayIndex = BackIndex;
}
}
}
}
Last Updated on June 14, 2019