예제 #1
0
 protected override void OnStateChange()
 {
     if (State == State.SetDefaults)
     {
         Description             = @"Enter the description for your new custom Indicator here.";
         Name                    = "VerticalLineAtTime";
         Calculate               = Calculate.OnBarClose;
         IsOverlay               = true;
         DisplayInDataBox        = true;
         DrawOnPricePanel        = true;
         DrawHorizontalGridLines = true;
         DrawVerticalGridLines   = true;
         PaintPriceMarkers       = true;
         ScaleJustification      = NinjaTrader.Gui.Chart.ScaleJustification.Right;
         //Disable this property if your indicator requires custom values that cumulate with each new market data event.
         //See Help Guide for additional information.
         IsSuspendedWhileInactive = true;
         LineTime = DateTime.Parse("07:30", System.Globalization.CultureInfo.InvariantCulture);
         ABrush   = Brushes.DimGray;
     }
     else if (State == State.Configure)
     {
         startTime = long.Parse(LineTime.ToString("HHmmss"));
     }
 }
예제 #2
0
 public static LineTime CopyTwoLineTimes(LineTime copyFrom, LineTime copyTo)
 {
     if (copyFrom == null)
     {
         copyFrom = new LineTime();
     }
     if (copyTo == null)
     {
         copyTo = new LineTime();
     }
     copyTo.Hours        = copyFrom.Hours;
     copyTo.Minutes      = copyFrom.Minutes;
     copyTo.Seconds      = copyFrom.Seconds;
     copyTo.MilliSeconds = copyFrom.MilliSeconds;
     return(copyTo);
 }
예제 #3
0
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            int selectedindex = (int)values[1];

            if (selectedindex == -1)
            {
                return("");
            }
            double dbl = 0;

            if (!double.TryParse((string)values[3], out dbl))
            {
                return("");
            }
            LineTime starttime = LineTime.NewFromString((string)values[2]);

            if (starttime == null)
            {
                return("");
            }
            List <Line> lines = values[0] as List <Line>;

            if (lines == null || lines.Count < 2)
            {
                return("");
            }
            StringBuilder stringbuilder = new StringBuilder();

            double currentlinestartingmilliseconds = lines[selectedindex].StartTime.ToMilliSeconds();
            double currentlineendingmilliseconds   = lines[selectedindex].EndTime.ToMilliSeconds();
            bool   withpweline  = false;
            bool   withnextline = false;
            string perlinetext  = "";
            string nextlinetext = "";

            if (selectedindex > 0)
            {
                double previouslinemilliseconds = lines[selectedindex - 1].EndTime.ToMilliSeconds();

                if (previouslinemilliseconds > currentlinestartingmilliseconds)
                {
                    withpweline = true;
                    perlinetext = (previouslinemilliseconds - currentlinestartingmilliseconds) / 1000 + "";
                }
            }
            if (selectedindex + 1 <= lines.Count - 1)
            {
                double nextlinestartingmilliseconds = lines[selectedindex + 1].StartTime.ToMilliSeconds();
                if (currentlineendingmilliseconds > nextlinestartingmilliseconds)
                {
                    withnextline = true;
                    nextlinetext = (currentlineendingmilliseconds - nextlinestartingmilliseconds) / 1000 + "";
                }
            }
            if (withnextline == true || withpweline == true)
            {
                stringbuilder.Append("line overlapping ");
                if (withnextline == true && withpweline == false)
                {
                    stringbuilder.Append(nextlinetext + " s with next line");
                }
                else if (withpweline = true && withnextline == false)
                {
                    stringbuilder.Append(perlinetext + " s with previous line");
                }
                else
                {
                    stringbuilder.Append(perlinetext + " s with previous line , " + nextlinetext + " s with next line");
                }
            }

            return(stringbuilder.ToString());
        }
 public static MusixmatchSubtitleFormattedLine FromLyricsLine(LyricsLine line) => new MusixmatchSubtitleFormattedLine
 {
     Text = line.Text, Time = LineTime.FromTimeSpan(line.LyricsTime)
 };