Source »
Close and Reverse - source code
// Forex Strategy Builder
// Copyright (c) 2006 - 2008 Miroslav Popov - All rights reserved!
// http://forexsb.com
// info(a)forexsb.com
//
// Last changed on: 2006-09-01
using System;
using System.Drawing;
namespace Forex_Strategy_Builder
{
/// <summary>
/// Close and Reverse
/// </summary>
class Close_and_Reverse : Indicator
{
/// <summary>
/// The default constructor.
/// </summary>
public Close_and_Reverse()
{
}
/// <summary>
/// Sets the default parameters for the designated slot type.
/// </summary>
/// <param name="slotType">The slot type.</param>
public Close_and_Reverse(SlotTypes slotType)
{
sIndicatorName = "Close and Reverse";
parameters = new IndicatorParam();
bSeparatedChart = false;
bIsCalculated = false;
typeOfIndicator = TypeOfIndicator.Additional;
timeExecution = TimeExecution.CloseAndReverse;
// The indicator name.
parameters.IndicatorName = sIndicatorName;
// The slot type.
parameters.SlotType = slotType;
// The ComboBox parameters.
parameters.ListParam[0].Caption = "Logic";
parameters.ListParam[0].ItemList = new string[] { "Close all positions and open a new one in the opposite direction" };
parameters.ListParam[0].Index = 0;
parameters.ListParam[0].Text = parameters.ListParam[0].ItemList[parameters.ListParam[0].Index];
parameters.ListParam[0].Enabled = true;
parameters.ListParam[0].ToolTip = "Logic of application of the indicator";
}
/// <summary>
/// Calculates the indicator's components.
/// </summary>
/// <param name="slotType">The slot type.</param>
public override void Calculate(SlotTypes slotType)
{
if (parameters.SlotType == SlotTypes.NotDefined) return;
Data.Strategy.OppSignalAction = OppositeDirSignalAction.Reverse;
bIsCalculated = true;
}
}
}
Top