<commit_before>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using AgenaTrader.API;
using AgenaTrader.Custom;
using AgenaTrader.Plugins;
using AgenaTrader.Helper;
using System.Globalization;

/// <summary>
/// Version: in progress
/// -------------------------------------------------------------------------
/// <NAME> 2016
/// <NAME> 2016
/// -------------------------------------------------------------------------
/// The initial version of this strategy was inspired by the work of <NAME>: https://www.whselfinvest.at/de/Store_Birger_Schaefermeier_Trading_Strategie_Open_Range_Break_Out.php
/// Further developments are inspired by the work of <NAME> and <NAME> from the Worcester Polytechnic Institute (2010)
/// Trading System Development: Trading the Opening Range Breakouts https://www.wpi.edu/Pubs/E-project/Available/E-project-042910-142422/unrestricted/Veselin_Iliev_IQP.pdf
/// -------------------------------------------------------------------------
/// ****** Important ******
/// To compile this indicator without any error you also need access to the utility indicator to use these global source code elements.
/// You will find this indicator on GitHub: https://github.com/simonpucher/AgenaTrader/blob/master/Utility/GlobalUtilities_Utility.cs
/// -------------------------------------------------------------------------
/// Namespace holds all indicators and is required. Do not change it.
/// </summary>
namespace AgenaTrader.UserCode
{
    /// <summary>
    /// This interface must be used in each ORB indicator, ORB condition and ORB strategy.
    /// </summary>
    interface IORB
    {
        //input
        int ORBMinutes { get; set; }
        Color Color_ORB { get; set; }
        string Color_ORBSerialize { get; set; }
        Color Color_TargetAreaShort { get; set; }
        string Color_TargetAreaShortSerialize { get; set; }
        Color Color_TargetAreaLong { get; set; }
        string Color_TargetAreaLongSerialize { get; set; }
        TimeSpan Time_OpenRangeStartDE { get; set; }
        //TimeSpan Time_OpenRangeEndDE { get; set; }
        TimeSpan Time_OpenRangeStartUS { get; set; }
        //TimeSpan Time_OpenRangeEndUS { get; set; }
        TimeSpan Time_EndOfDay_DE { get; set; }
        TimeSpan Time_EndOfDay_US { get; set; }
        //string EmailAdress { get; set; }
        bool Send_email { get; set; }

        //output


        //internal
        bool IsEmailFunctionActive { get; }
    }


    [Description("ORB Indicator")]
    public class ORB_Indicator : UserIndicator, IORB
    {

        //input
        private Color _currentsessionlinecolor = Color.LightBlue;
        private int _currentsessionlinewidth = Const.DefaultLineWidth;
        private DashStyle _currentsessionlinestyle = DashStyle.Solid;

        private int _opacity = Const.DefaultOpacity;
        private Color _plot1color = Const.DefaultIndicatorColor;
        private int _plot1width = Const.DefaultLineWidth;
        private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;
        private int _orbminutes = Const.DefaultOpenRangeSizeinMinutes;
        private Color _col_orb = Color.LightBlue;
        private Color _col_target_short = Color.PaleVioletRed;
        private Color _col_target_long = Color.PaleGreen;

        private TimeSpan _tim_OpenRangeStartDE = new TimeSpan(9, 0, 0);  
        //private TimeSpan _tim_OpenRangeEndDE = new TimeSpan(10, 15, 0);  

        private TimeSpan _tim_OpenRangeStartUS = new TimeSpan(15, 30, 0);   
        //private TimeSpan _tim_OpenRangeEndUS = new TimeSpan(16, 45, 0);    

        private TimeSpan _tim_EndOfDay_DE = new TimeSpan(17, 30, 0);  
        private TimeSpan _tim_EndOfDay_US = new TimeSpan(22, 00, 0);  

        private bool _send_email = false;

        //output
        private double _rangelow = Double.NaN;
        private double _rangehigh = Double.NaN;

        //internal 
        private IBar long_breakout = null;
        private IBar short_breakout = null;
        public IBar long_target_reached = null;
        public IBar short_target_reached = null;
        private DateTime currentdayofupdate = DateTime.MinValue;
        private ITimePeriod timeperiod = null;
        private IBars bardata = null;
        private bool shoulddrawonchart = true;

   

        /// <summary>
        /// If we use this indicator from another script we need to initalize all important data first.<commit_msg>private -> public for long_breakout and short_breakout variables<commit_after>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using AgenaTrader.API;
using AgenaTrader.Custom;
using AgenaTrader.Plugins;
using AgenaTrader.Helper;
using System.Globalization;

/// <summary>
/// Version: in progress
/// -------------------------------------------------------------------------
/// <NAME> 2016
/// <NAME> 2016
/// -------------------------------------------------------------------------
/// The initial version of this strategy was inspired by the work of <NAME>: https://www.whselfinvest.at/de/Store_Birger_Schaefermeier_Trading_Strategie_Open_Range_Break_Out.php
/// Further developments are inspired by the work of <NAME> and <NAME> from the Worcester Polytechnic Institute (2010)
/// Trading System Development: Trading the Opening Range Breakouts https://www.wpi.edu/Pubs/E-project/Available/E-project-042910-142422/unrestricted/Veselin_Iliev_IQP.pdf
/// -------------------------------------------------------------------------
/// ****** Important ******
/// To compile this indicator without any error you also need access to the utility indicator to use these global source code elements.
/// You will find this indicator on GitHub: https://github.com/simonpucher/AgenaTrader/blob/master/Utility/GlobalUtilities_Utility.cs
/// -------------------------------------------------------------------------
/// Namespace holds all indicators and is required. Do not change it.
/// </summary>
namespace AgenaTrader.UserCode
{
    /// <summary>
    /// This interface must be used in each ORB indicator, ORB condition and ORB strategy.
    /// </summary>
    interface IORB
    {
        //input
        int ORBMinutes { get; set; }
        Color Color_ORB { get; set; }
        string Color_ORBSerialize { get; set; }
        Color Color_TargetAreaShort { get; set; }
        string Color_TargetAreaShortSerialize { get; set; }
        Color Color_TargetAreaLong { get; set; }
        string Color_TargetAreaLongSerialize { get; set; }
        TimeSpan Time_OpenRangeStartDE { get; set; }
        //TimeSpan Time_OpenRangeEndDE { get; set; }
        TimeSpan Time_OpenRangeStartUS { get; set; }
        //TimeSpan Time_OpenRangeEndUS { get; set; }
        TimeSpan Time_EndOfDay_DE { get; set; }
        TimeSpan Time_EndOfDay_US { get; set; }
        //string EmailAdress { get; set; }
        bool Send_email { get; set; }

        //output


        //internal
        bool IsEmailFunctionActive { get; }
    }


    [Description("ORB Indicator")]
    public class ORB_Indicator : UserIndicator, IORB
    {

        //input
        private Color _currentsessionlinecolor = Color.LightBlue;
        private int _currentsessionlinewidth = Const.DefaultLineWidth;
        private DashStyle _currentsessionlinestyle = DashStyle.Solid;

        private int _opacity = Const.DefaultOpacity;
        private Color _plot1color = Const.DefaultIndicatorColor;
        private int _plot1width = Const.DefaultLineWidth;
        private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;
        private int _orbminutes = Const.DefaultOpenRangeSizeinMinutes;
        private Color _col_orb = Color.LightBlue;
        private Color _col_target_short = Color.PaleVioletRed;
        private Color _col_target_long = Color.PaleGreen;

        private TimeSpan _tim_OpenRangeStartDE = new TimeSpan(9, 0, 0);  
        //private TimeSpan _tim_OpenRangeEndDE = new TimeSpan(10, 15, 0);  

        private TimeSpan _tim_OpenRangeStartUS = new TimeSpan(15, 30, 0);   
        //private TimeSpan _tim_OpenRangeEndUS = new TimeSpan(16, 45, 0);    

        private TimeSpan _tim_EndOfDay_DE = new TimeSpan(17, 30, 0);  
        private TimeSpan _tim_EndOfDay_US = new TimeSpan(22, 00, 0);  

        private bool _send_email = false;

        //output
        private double _rangelow = Double.NaN;
        private double _rangehigh = Double.NaN;

        //internal 
        public IBar long_breakout = null;
        public IBar short_breakout = null;
        public IBar long_target_reached = null;
        public IBar short_target_reached = null;
        private DateTime currentdayofupdate = DateTime.MinValue;
        private ITimePeriod timeperiod = null;
        private IBars bardata = null;
        private bool shoulddrawonchart = true;

   

        /// <summary>
        /// If we use this indicator from another script we need to initalize all important data first.
{'fraction_non_alphanumeric': 0.14368128877762054, 'fraction_numerical': 0.012191139653858714, 'mean_word_length': 2.3062252608852103, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 24, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5000137', 'n_tokens_mistral': 2581, 'n_tokens_neox': 2460, 'n_words': 725}