Trading Articles
Article Categories
Article Tools
Highlight Ny Session with rectangle
Updated March 7, 2018
trending_up
643 views
thumb_up
0 thanks given
group
1 followers
forum
3 posts
attach_file
1 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Highlight Ny Session with rectangle
(login for full post details)
#1 (permalink )
Margate, Fl.
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks: 5 given,
5
received
I would like to highlight the new york session with a highlighted rectangle. I assume that I need to get a bar index from datetime values, not sure how to do that. Please point me in the right direction. Thanks.
Code
#include "sierrachart.h"
SCDLLName("MySessionHighlight")
SCSFExport scsf_MyHighlightSession(SCStudyInterfaceRef sc)
{
// Draw a rectangle highlight
// Set configuration variables
if (sc.SetDefaults)
{
sc.GraphName = "MySessionHighlight";
sc.GraphRegion = 0;
sc.FreeDLL = 0;
sc.AutoLoop = 0; //No automatic looping
return;
}
// Do data processing
SCDateTime dtNySessionBegin;
SCDateTime dtNySessionEnd;
dtNySessionBegin.SetDateTimeYMDHMS(2018, 3, 6, 9, 30, 00);
dtNySessionEnd.SetDateTimeYMDHMS(2018, 3, 6, 4, 30, 00);
int BarIndex;
int& r_LineNumber = sc.GetPersistentInt(1);
s_UseTool Tool;
Tool.ChartNumber = sc.ChartNumber;
Tool.DrawingType = DRAWING_RECTANGLEHIGHLIGHT;
//int &LineNumber12 = sc.GetPersistentInt(12);
if (r_LineNumber != 0)
Tool.LineNumber = r_LineNumber;
// Update BarIndex to 30 bars from the end
BarIndex = max(sc.ArraySize - 25, 0);
// Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex]; // <- original
Tool.BeginDateTime = sc.BaseDateTimeIn[dtNySessionBegin]; // <- not correct
BarIndex = max(sc.ArraySize - 15, 0);
// Tool.EndDateTime = sc.BaseDateTimeIn[BarIndex]; // <- original
Tool.EndDateTime = sc.BaseDateTimeIn[dtNySessionEnd]; // <- not correct
Tool.BeginValue = sc.GetHighest(sc.Low, BarIndex, 10);
Tool.EndValue = sc.GetLowest(sc.Low, BarIndex, 10);
Tool.Color = RGB(255, 0, 0); // Red
Tool.LineWidth = 1; //To see the outline this must be 1 or greater.
Tool.SecondaryColor = RGB(0, 255, 0);
Tool.TransparencyLevel = 50;
Tool.AddMethod = UTAM_ADD_OR_ADJUST;
sc.UseTool(Tool);
r_LineNumber = Tool.LineNumber;//Remember line number which has been automatically set
}
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
Market Wizard
Tallinn, Estonia
Experience: Beginner
Platform: SC
Trading: NAS100
Posts: 942 since Nov 2010
Thanks: 1,825 given,
2,258
received
Does it need to be rectangle ?
One option is to use built-in study Time Range Highlight - Transparent
(login for full post details)
#4 (permalink )
Margate, Fl.
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks: 5 given,
5
received
lemons
Does it need to be rectangle ?
One option is to use built-in study Time
Range Highlight - Transparent
Thanks for that, but I would like to be able to do the rectangle
Last Updated on March 7, 2018
Right now
Ongoing
Right now
February
Coming soon
March
Register to Attend
Elite only