Source »
Take Profit - source code
// Forex Strategy Builder
// Copyright (c) 2006 - 2008 Miroslav Popov - All rights reserved!
// http://forexsb.com
// info(a)forexsb.com
//
// Last changed on: 2007-06-12
using System;
using System.Drawing;
namespace Forex_Strategy_Builder
{
/// <summary>
/// indicator: Take Profit
/// The implimentation of logic is in Backtester.AnalyseClose(int iBar)
/// </summary>
public class Take_Profit : Indicator
{
/// <summary>
/// The default constructor.
/// </summary>
public Take_Profit()
{
}
/// <summary>
/// Sets the default parameters for the designated slot type.
/// </summary>
/// <param name="slotType">The slot type.</param>
public Take_Profit(SlotTypes slotType)
{
sIndicatorName = "Take Profit";
parameters = new IndicatorParam();
component = new IndicatorComp[] { };
bSeparatedChart = false;
bIsCalculated = false;
typeOfIndicator = TypeOfIndicator.Additional;
// 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[]
{
"Exit at the Take Profit level",
};
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";
// The NumericUpDown parameters.
parameters.NumParam[0].Caption = "Take Profit";
parameters.NumParam[0].Value = 20;
parameters.NumParam[0].Min = 5;
parameters.NumParam[0].Max = 2000;
parameters.NumParam[0].Enabled = true;
parameters.NumParam[0].ToolTip = "The Take Profit value (in pips)";
}
/// <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;
bIsCalculated = true;
}
}
}
Top