本文整理汇总了C#中SlotTypes类的典型用法代码示例。如果您正苦于以下问题:C# SlotTypes类的具体用法?C# SlotTypes怎么用?C# SlotTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SlotTypes类属于命名空间,在下文中一共展示了SlotTypes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.Indicator;
IndParam.ExecutionTime = ExecutionTime.DuringTheBar;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new[]
{
"ADX rises",
"ADX falls",
"ADX is higher than the Level line",
"ADX is lower than the Level line",
"ADX crosses the Level line upward",
"ADX crosses the Level line downward",
"ADX changes its direction upward",
"ADX changes its direction downward"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
IndParam.ListParam[1].Caption = "Smoothing method";
IndParam.ListParam[1].ItemList = Enum.GetNames(typeof (MAMethod));
IndParam.ListParam[1].Index = (int) MAMethod.Exponential;
IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index];
IndParam.ListParam[1].Enabled = true;
IndParam.ListParam[1].ToolTip = "The Moving Average method used for smoothing the ADX value.";
IndParam.ListParam[2].Caption = "Base price";
IndParam.ListParam[2].ItemList = new[] {"Bar range"};
IndParam.ListParam[2].Index = 0;
IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
IndParam.ListParam[2].Enabled = true;
IndParam.ListParam[2].ToolTip = "ADX uses current and previous bar ranges.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Period";
IndParam.NumParam[0].Value = 14;
IndParam.NumParam[0].Min = 1;
IndParam.NumParam[0].Max = 200;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The period of ADX.";
IndParam.NumParam[1].Caption = "Level";
IndParam.NumParam[1].Value = 0;
IndParam.NumParam[1].Min = 0;
IndParam.NumParam[1].Max = 100;
IndParam.NumParam[1].Point = 0;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "A critical level (for the appropriate logic).";
// The CheckBox parameters
IndParam.CheckParam[0].Caption = "Use previous bar value";
IndParam.CheckParam[0].Enabled = true;
IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar.";
}
示例2: Initialize
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.DateTime;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new[]
{
"Do not open positions before",
"Do not open positions after"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of the date filter.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Year";
IndParam.NumParam[0].Value = 2000;
IndParam.NumParam[0].Min = 1900;
IndParam.NumParam[0].Max = 2100;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The year.";
IndParam.NumParam[1].Caption = "Month";
IndParam.NumParam[1].Value = 1;
IndParam.NumParam[1].Min = 1;
IndParam.NumParam[1].Max = 12;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "The month.";
}
示例3: Calculate
/// <summary>
/// Calculates the indicator's components
/// </summary>
public override void Calculate(SlotTypes slotType)
{
// Calculation
double[] adClosePrice = new double[Bars];
for (int iBar = 1; iBar < Bars; iBar++)
if (Time[iBar - 1].Day != Time[iBar].Day)
adClosePrice[iBar - 1] = Close[iBar - 1];
// Check the last bar
TimeSpan tsBarClosing = Time[Bars - 1].TimeOfDay.Add(new TimeSpan(0, (int)Period, 0));
TimeSpan tsDayClosing = new TimeSpan(24, 0, 0);
if (tsBarClosing == tsDayClosing)
adClosePrice[Bars - 1] = Close[Bars - 1];
// Saving the components
Component = new IndicatorComp[1];
Component[0] = new IndicatorComp();
Component[0].CompName = "Closing price of the day";
Component[0].DataType = IndComponentType.ClosePrice;
Component[0].ChartType = IndChartType.NoChart;
Component[0].FirstBar = 2;
Component[0].Value = adClosePrice;
return;
}
示例4: Lot_Limiter
/// <summary>
/// Sets the default indicator parameters for the designated slot type
/// </summary>
public Lot_Limiter(SlotTypes slotType)
{
// General properties
IndicatorName = "Lot Limiter";
PossibleSlots = SlotTypes.OpenFilter;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.Additional;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[] { "Limit the number of open lots" };
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Indicator's logic";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Maximum lots";
IndParam.NumParam[0].Value = 5;
IndParam.NumParam[0].Min = 1;
IndParam.NumParam[0].Max = 100;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "Maximum number of open lots.";
return;
}
示例5: Narrow_Range
/// <summary>
/// Sets the default indicator parameters for the designated slot type
/// </summary>
public Narrow_Range(SlotTypes slotType)
{
// General properties
IndicatorName = "Narrow Range";
PossibleSlots = SlotTypes.OpenFilter;
SeparatedChart = true;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.Additional;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"There is a NR4 formation",
"There is a NR7 formation",
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Indicator's logic.";
// The CheckBox parameters
IndParam.CheckParam[0].Caption = "Use previous bar value";
IndParam.CheckParam[0].Checked = PrepareUsePrevBarValueCheckBox(slotType);
IndParam.CheckParam[0].Enabled = true;
IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar.";
return;
}
示例6: Enter_Once
/// <summary>
/// Sets the default indicator parameters for the designated slot type
/// </summary>
public Enter_Once(SlotTypes slotType)
{
// General properties
IndicatorName = "Enter Once";
PossibleSlots = SlotTypes.OpenFilter;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.DateTime;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"Enter no more than once a bar",
"Enter no more than once a day",
"Enter no more than once a week",
"Enter no more than once a month"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Indicator's logic.";
return;
}
示例7: Take_Profit
/// <summary>
/// Sets the default indicator parameters for the designated slot type
/// </summary>
public Take_Profit(SlotTypes slotType)
{
// General properties
IndicatorName = "Take Profit";
PossibleSlots = SlotTypes.Close;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.Additional;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"Exit at the Take Profit level",
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Take Profit";
IndParam.NumParam[0].Value = 200;
IndParam.NumParam[0].Min = 5;
IndParam.NumParam[0].Max = 5000;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The Take Profit value (in pips).";
return;
}
示例8: Initialize
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
IndParam.ExecutionTime = ExecutionTime.AtBarClosing;
IndParam.IndicatorType = TypeOfIndicator.DateTime;
IndParam.IsAllowLTF = false;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new[]
{
"Exit the market before the specified hour"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Indicator's logic.";
IndParam.ListParam[1].Caption = "Base price";
IndParam.ListParam[1].ItemList = new[] {"Close"};
IndParam.ListParam[1].Index = 0;
IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index];
IndParam.ListParam[1].Enabled = true;
IndParam.ListParam[1].ToolTip = "Exit price of the position.";
// The NumericUpDown parameters.
IndParam.NumParam[0].Caption = "Exit hour";
IndParam.NumParam[0].Value = 0;
IndParam.NumParam[0].Min = 0;
IndParam.NumParam[0].Max = 24;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The position's closing hour.";
}
示例9: Account_Percent_Stop
/// <summary>
/// Sets the default indicator parameters for the designated slot type.
/// </summary>
public Account_Percent_Stop(SlotTypes slotType)
{
// General properties
IndicatorName = "Account Percent Stop";
PossibleSlots = SlotTypes.Close;
SeparatedChart = false;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
IndParam.IndicatorType = TypeOfIndicator.Additional;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"Limit the risk to percent of the account"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Account percent";
IndParam.NumParam[0].Value = 2;
IndParam.NumParam[0].Min = 1;
IndParam.NumParam[0].Max = 20;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "Maximum account to risk.";
return;
}
示例10: Parabolic_SAR
/// <summary>
/// Sets the default indicator parameters for the designated slot type
/// </summary>
public Parabolic_SAR(SlotTypes slotType)
{
// General properties
IndicatorName = "Parabolic SAR";
PossibleSlots = SlotTypes.OpenFilter | SlotTypes.Close;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
if (slotType == SlotTypes.OpenFilter)
IndParam.ListParam[0].ItemList = new string[]
{
"The price is higher than the PSAR value"
};
else if (slotType == SlotTypes.Close)
IndParam.ListParam[0].ItemList = new string[]
{
"Exit the market at PSAR"
};
else
IndParam.ListParam[0].ItemList = new string[]
{
"Not Defined"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Starting AF";
IndParam.NumParam[0].Value = 0.02;
IndParam.NumParam[0].Min = 0.00;
IndParam.NumParam[0].Max = 5.00;
IndParam.NumParam[0].Point = 2;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The starting value of Acceleration Factor.";
IndParam.NumParam[1].Caption = "Increment";
IndParam.NumParam[1].Value = 0.02;
IndParam.NumParam[1].Min = 0.01;
IndParam.NumParam[1].Max = 5.00;
IndParam.NumParam[1].Point = 2;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "Increment value.";
IndParam.NumParam[2].Caption = "Maximum AF";
IndParam.NumParam[2].Value = 2.00;
IndParam.NumParam[2].Min = 0.01;
IndParam.NumParam[2].Max = 9.00;
IndParam.NumParam[2].Point = 2;
IndParam.NumParam[2].Enabled = true;
IndParam.NumParam[2].ToolTip = "The maximum value of the Acceleration Factor.";
return;
}
示例11: Calculate
/// <summary>
/// Calculates the indicator's components
/// </summary>
public override void Calculate(SlotTypes slotType)
{
// Calculation
int iFirstBar = 1;
double[] adBars = new double[Bars];
// Calculation of the logic
for (int iBar = 0; iBar < Bars - 1; iBar++)
{
if (Time[iBar].DayOfWeek > DayOfWeek.Wednesday &&
Time[iBar + 1].DayOfWeek < DayOfWeek.Wednesday)
adBars[iBar] = Close[iBar];
else
adBars[iBar] = 0;
}
// Check the last bar
TimeSpan tsBarClosing = Time[Bars - 1].TimeOfDay.Add(new TimeSpan(0, (int)Period, 0));
TimeSpan tsDayClosing = new TimeSpan(24, 0, 0);
if (Time[Bars - 1].DayOfWeek == DayOfWeek.Friday && tsBarClosing == tsDayClosing)
adBars[Bars - 1] = Close[Bars - 1];
// Saving the components
Component = new IndicatorComp[1];
Component[0] = new IndicatorComp();
Component[0].CompName = "Week Closing";
Component[0].DataType = IndComponentType.ClosePrice;
Component[0].ChartType = IndChartType.NoChart;
Component[0].ShowInDynInfo = false;
Component[0].FirstBar = iFirstBar;
Component[0].Value = adBars;
return;
}
示例12: Initialize
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
// Setting up the indicator parameters
IndParam.IndicatorType = TypeOfIndicator.Additional;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new[]
{
"Standard Deviation rises",
"Standard Deviation falls",
"Standard Deviation is higher than the Level line",
"Standard Deviation is lower than the Level line",
"Standard Deviation crosses the Level line upward",
"Standard Deviation crosses the Level line downward",
"Standard Deviation changes its direction upward",
"Standard Deviation changes its direction downward"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
IndParam.ListParam[1].Caption = "Smoothing method";
IndParam.ListParam[1].ItemList = Enum.GetNames(typeof (MAMethod));
IndParam.ListParam[1].Index = (int) MAMethod.Simple;
IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index];
IndParam.ListParam[1].Enabled = true;
IndParam.ListParam[1].ToolTip = "The method of Moving Average used for the calculations.";
IndParam.ListParam[2].Caption = "Base price";
IndParam.ListParam[2].ItemList = Enum.GetNames(typeof (BasePrice));
IndParam.ListParam[2].Index = (int) BasePrice.Close;
IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
IndParam.ListParam[2].Enabled = true;
IndParam.ListParam[2].ToolTip = "The price the indicator is based on.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Period";
IndParam.NumParam[0].Value = 20;
IndParam.NumParam[0].Min = 2;
IndParam.NumParam[0].Max = 200;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The period of calculation.";
IndParam.NumParam[1].Caption = "Level";
IndParam.NumParam[1].Value = 0;
IndParam.NumParam[1].Min = 0;
IndParam.NumParam[1].Max = 100;
IndParam.NumParam[1].Point = 4;
IndParam.NumParam[1].Enabled = true;
IndParam.NumParam[1].ToolTip = "A critical level (for the appropriate logic).";
// The CheckBox parameters
IndParam.CheckParam[0].Caption = "Use previous bar value";
IndParam.CheckParam[0].Enabled = true;
IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar.";
}
示例13: Initialize
public override void Initialize(SlotTypes slotType)
{
SlotType = slotType;
// Setting up the indicator parameters
IndParam.IndicatorType = TypeOfIndicator.Additional;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"Exit at the Stop Loss level",
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Stop Loss";
IndParam.NumParam[0].Value = 200;
IndParam.NumParam[0].Min = 5;
IndParam.NumParam[0].Max = 5000;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The Stop value (in points).";
}
示例14: Force_Index
/// <summary>
/// Sets the default indicator parameters for the designated slot type
/// </summary>
public Force_Index(SlotTypes slotType)
{
// General properties
IndicatorName = "Force Index";
PossibleSlots = SlotTypes.OpenFilter | SlotTypes.CloseFilter;
SeparatedChart = true;
// Setting up the indicator parameters
IndParam = new IndicatorParam();
IndParam.IndicatorName = IndicatorName;
IndParam.SlotType = slotType;
// The ComboBox parameters
IndParam.ListParam[0].Caption = "Logic";
IndParam.ListParam[0].ItemList = new string[]
{
"The Force Index rises",
"The Force Index falls",
"The Force Index is higher than the zero line",
"The Force Index is lower than the zero line",
"The Force Index crosses the zero line upward",
"The Force Index crosses the zero line downward",
"The Force Index changes its direction upward",
"The Force Index changes its direction downward"
};
IndParam.ListParam[0].Index = 0;
IndParam.ListParam[0].Text = IndParam.ListParam[0].ItemList[IndParam.ListParam[0].Index];
IndParam.ListParam[0].Enabled = true;
IndParam.ListParam[0].ToolTip = "Logic of application of the indicator.";
IndParam.ListParam[1].Caption = "Smoothing method";
IndParam.ListParam[1].ItemList = Enum.GetNames(typeof(MAMethod));
IndParam.ListParam[1].Index = (int)MAMethod.Simple;
IndParam.ListParam[1].Text = IndParam.ListParam[1].ItemList[IndParam.ListParam[1].Index];
IndParam.ListParam[1].Enabled = true;
IndParam.ListParam[1].ToolTip = "The method of smoothing.";
IndParam.ListParam[2].Caption = "Base price";
IndParam.ListParam[2].ItemList = Enum.GetNames(typeof(BasePrice));
IndParam.ListParam[2].Index = (int)BasePrice.Close;
IndParam.ListParam[2].Text = IndParam.ListParam[2].ItemList[IndParam.ListParam[2].Index];
IndParam.ListParam[2].Enabled = true;
IndParam.ListParam[2].ToolTip = "The price the Force Index is based on.";
// The NumericUpDown parameters
IndParam.NumParam[0].Caption = "Period";
IndParam.NumParam[0].Value = 13;
IndParam.NumParam[0].Min = 1;
IndParam.NumParam[0].Max = 100;
IndParam.NumParam[0].Enabled = true;
IndParam.NumParam[0].ToolTip = "The smoothing period.";
// The CheckBox parameters
IndParam.CheckParam[0].Caption = "Use previous bar value";
IndParam.CheckParam[0].Checked = PrepareUsePrevBarValueCheckBox(slotType);
IndParam.CheckParam[0].Enabled = true;
IndParam.CheckParam[0].ToolTip = "Use the indicator value from the previous bar.";
return;
}
示例15: SetDescription
/// <summary>
/// Sets the indicator logic description
/// </summary>
public override void SetDescription(SlotTypes slotType)
{
EntryPointLongDescription = "at the beginning of the bar";
EntryPointShortDescription = "at the beginning of the bar";
return;
}