NexusFi: Find Your Edge


Home Menu

 





Highlight Ny Session with rectangle


Discussion in Sierra Chart

Updated
    1. trending_up 1,233 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 3 posts
    2. attach_file 1 attachments




 
Search this Thread

Highlight Ny Session with rectangle

  #1 (permalink)
 funk101 
Margate, Fl.
 
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks Given: 5
Thanks Received: 5

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 

}

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #3 (permalink)
 
lemons's Avatar
 lemons 
Tallinn, Estonia
 
Experience: Beginner
Platform: SC
Trading: NAS100
Posts: 959 since Nov 2010


Does it need to be rectangle ?

One option is to use built-in study Time Range Highlight - Transparent


Reply With Quote
  #4 (permalink)
 funk101 
Margate, Fl.
 
Experience: Advanced
Platform: SierraCharts
Trading: Futures
Posts: 28 since Jun 2009
Thanks Given: 5
Thanks Received: 5


lemons View Post
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

Started this thread Reply With Quote




Last Updated on March 7, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts