
#region Variables
// Wizard generated variables
private int profit = 4; // Default setting for Profit
private int stop = 4; // Default setting for Stop
private double Variable0 = 15.0;
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
SetProfitTarget("", CalculationMode.Ticks, Profit);
SetStopLoss("", CalculationMode.Ticks, Stop, false);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
if (CrossAbove(Stochastics(7, 14, 3).K, Stochastics(7, 14, 3).D, 1)
&& Stochastics(7, 14, 3).D[0] <= Variable0
&& Stochastics(7, 14, 3).K[0] <= Variable0
&& Historical == false)
{
EnterLongLimit(DefaultQuantity, GetCurrentBid(), "");
}
if (CrossBelow(Stochastics(7, 14, 3).K, Stochastics(7, 14, 3).D, 1)
&& Stochastics(7, 14, 3).D[0] >= 85.0
&& Stochastics(7, 14, 3).K[0] >= 85.0
&& Historical == false)
{
EnterShortLimit(DefaultQuantity, GetCurrentAsk(), "");
}
}
Comment