Source »
Lot Limiter - 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-09-20
using System;
using System.Drawing;
namespace Forex_Strategy_Builder
{
/// <summary>
/// indicator: Lot Limiter
/// </summary>
public class Lot_Limiter : Indicator
{
/// <summary>
/// The default constructor.
/// </summary>
public Lot_Limiter()
{
}
/// <summary>
/// Sets the default parameters for the designated slot type.
/// </summary>
/// <param name="slotType">The slot type.</param>
public Lot_Limiter(SlotTypes slotType)
{
sIndicatorName = "Lot Limiter";
parameters = new IndicatorParam();
component = new IndicatorComp[] { };
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[]
{
"Limit the number of position's lots"
};
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 = "Indicators' logic";
// The NumericUpDown parameters.
parameters.NumParam[0].Caption = "Maximum lots";
parameters.NumParam[0].Value = 5;
parameters.NumParam[0].Min = 1;
parameters.NumParam[0].Max = 100;
parameters.NumParam[0].Enabled = true;
parameters.NumParam[0].ToolTip = "Maximum number of position's lots";
}
/// <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