I Have this strategy:
#region Variables
// Wizard generated variables
privatedouble stop = 0.03; // Default setting for Stop
privatedouble target = 0.05; // Default setting for Target
// 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>
protectedoverridevoid Initialize()
{
Add (PeriodType.Day, 1);
Add (GetHighLowByTimeRange(10 , 15, 9, 30));
SetProfitTarget("", CalculationMode.Percent, Target);
SetStopLoss("", CalculationMode.Percent, Stop, false);
CalculateOnBarClose = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (BarsInProgress != 0)
return;
// Checks if the macd daily fast period is above 0 in the last bar
if (MACD(BarsArray[1], 12, 26, 9)[1] > 0)
{
EnterLongStop(DefaultQuantity, GetHighLowByTimeRange(10, 15, 9, 30).HighestHigh[0] + 1 * TickSize, "");
}
// Checks if the macd daily fast period is below 0 in the last bar
if (MACD(BarsArray[1], 12, 26, 9)[1] < 0)
{
EnterShortStop(DefaultQuantity, GetHighLowByTimeRange(10, 15, 9, 30).LowestLow[0] - 1 * TickSize, "");
}
}
And I Want not to make the entry and the stoploss on the same bar, How can I do that?
Here I let you an image that what is happenning on a chart

Comment