I created a strategu based on insidebar and violating its low or high. Deponds on direction of market.
There is no problem w long transaction, but short transactions aren't opened by strategy. Why? A think that conditions and actions are correctly.
This is the code.
protected override void Initialize()
{
SetStopLoss("dluga", CalculationMode.Ticks, 36, false);
SetProfitTarget("dluga", CalculationMode.Ticks, 72);
SetStopLoss("krotka", CalculationMode.Ticks, 36, false);
SetProfitTarget("krotka", CalculationMode.Ticks, 72);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (High[0] < High[1]
&& Low[0] > Low[1])
{
DrawDot("My dot" + CurrentBar, false, 0, High[1] + 1 * TickSize, Color.Blue);
}
// Condition set 2
if (High[0] < High[1]
&& Low[0] > Low[1])
{
EnterLongStop(DefaultQuantity, High[0] + 1 * TickSize, "dluga");
}
// Condition set 3
if (High[0] < High[1]
&& Low[0] > Low[1])
{
EnterShortStop(DefaultQuantity, Low[0] + -1 * TickSize, "krotka");
Please help.

Comment