/// <summary/> public override double GetTimeframeRatio(Timeframe tf) { if (tf is Timeframe1Min) { return(60 * 2); // 8 hours approximatively } if (tf is Timeframe5Min) { return(12 * 2); } if (tf is Timeframe10Min) { return(6 * 2); } if (tf is Timeframe30Min) { return(2 * 2); } if (tf is TimeframeHour) { return(1 * 2); } throw new ArgumentOutOfRangeException("tf wrong: " + tf); }
/// <summary/> public override double GetTimeframeRatio(Timeframe tf) { if (tf == Timeframes.DAY) { return(5); } return(Timeframes.DAY.GetTimeframeRatio(tf) * 5); }
/// <summary/> public override double GetTimeframeRatio(Timeframe tf) { if (tf == Timeframes.DAY) { return(30 * 5 / 7); } if (tf == Timeframes.WEEK) { return(30 / 7); } return(Timeframes.DAY.GetTimeframeRatio(tf) * 30 * 5 / 7); }
/// <summary> /// Returns how many times the second timeframe fits in the first one. /// </summary> public static double GetTimeframeRatio(Timeframe first, Timeframe second) { if (first == second) { return(1); } if (first < second) { return(1 / GetTimeframeRatio(second, first)); } return(first.GetTimeframeRatio(second)); }
/// <summary/> public override double GetTimeframeRatio(Timeframe tf) { if (tf is TimeframeMonth) { return(12); } if (tf is TimeframeWeek) { return(52); } if (tf is TimeframeDay) { return(250); } return(Timeframes.DAY.GetTimeframeRatio(tf) * 250); }
/// <summary> /// This function does convert the given date from the $orig_timeframe in a /// date of the $dest_timeframe. Take care that the destination timeframe must be /// bigger than the original timeframe. /// </summary> public static DateTime ConvertDate( DateTime date, Timeframe orig, Timeframe dest ) { // #WAR# WARN "the destination time frame must be bigger" if ( $orig <= $dest); return dest.ConvertToDateTime( orig.ConvertToString( date ) ); }
/// <summary/> public override double GetTimeframeRatio( Timeframe tf ) { if ( tf == Timeframes.DAY ) return 30 * 5 / 7; if ( tf == Timeframes.WEEK ) return 30 / 7; return Timeframes.DAY.GetTimeframeRatio( tf ) * 30 * 5 / 7; }
/// <summary/> public override double GetTimeframeRatio( Timeframe tf ) { if ( tf is Timeframe1Min ) return 60; // 8 hours approximatively if ( tf is Timeframe5Min ) return 12; if ( tf is Timeframe10Min ) return 6; if ( tf is Timeframe30Min ) return 2; if ( tf is TimeframeHour ) return 1; throw new ArgumentOutOfRangeException( "tf wrong: " + tf ); }
/// <summary> /// Returns how many times the second timeframe fits in the first one. /// </summary> public abstract double GetTimeframeRatio( Timeframe other );
/// <summary/> public bool Equals( Timeframe tf ) { return tf != null && tf.Id == Id; }
/// <summary/> public override double GetTimeframeRatio( Timeframe tf ) { if ( tf is TimeframeMonth ) return 12; if ( tf is TimeframeWeek ) return 52; if ( tf is TimeframeDay ) return 250; return Timeframes.DAY.GetTimeframeRatio( tf ) * 250; }
/// <summary> /// This function does convert the given date from the $orig_timeframe in a /// date of the $dest_timeframe. Take care that the destination timeframe must be /// bigger than the original timeframe. /// </summary> public static DateTime ConvertDate(DateTime date, Timeframe orig, Timeframe dest) { // #WAR# WARN "the destination time frame must be bigger" if ( $orig <= $dest); return(dest.ConvertToDateTime(orig.ConvertToString(date))); }
/// <summary/> public override double GetTimeframeRatio(Timeframe tf) { throw new Exception("Cannot set timeframe ratio for tick data"); }
/// <summary/> public bool Equals(Timeframe tf) { return(tf != null && tf.Id == Id); }
/// <summary> /// Returns how many times the second timeframe fits in the first one. /// </summary> public abstract double GetTimeframeRatio(Timeframe other);
/// <summary> /// Returns how many times the second timeframe fits in the first one. /// </summary> public static double GetTimeframeRatio( Timeframe first, Timeframe second ) { if ( first == second ) return 1; if ( first < second ) { return ( 1 / GetTimeframeRatio( second, first ) ); } return first.GetTimeframeRatio( second ); }
/// <summary/> public override double GetTimeframeRatio( Timeframe tf ) { throw new Exception( "Cannot set timeframe ratio for tick data" ); }
/// <summary/> public override double GetTimeframeRatio( Timeframe tf ) { if ( tf == Timeframes.DAY ) return 5; return Timeframes.DAY.GetTimeframeRatio( tf ) * 5; }