I need to create a EnterLongStopMarket with stop Loss and Profit target, here is my code:
-----------------------------------------------------------------------------------------------------------------------------------
else if (State == State.Configure)
{
SetProfitTarget("", CalculationMode.Pips, 20);
SetStopLoss("", CalculationMode.Pips, 20, false);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 2)
return;
// Set 1
if ((Close[0] > Open[0])
&& (Close[1] > Open[1])
&& (Close[2] > Open[2]))
{
EnterLongStopMarket(Convert.ToInt32(DefaultQuantit y), 1.0845 , "");
}
}
-------------------------------------------------------------------------------------------------------------------------------------
When strategy meets the condition, the EnterLongStopMarket is created ok!
When price is 1.0845 the Long position fills ok! the stop loss fills ok! and the profit target fills ok ! (see attached "one").
But.... when price is == profit target, gives me an error and the strategy is turned off ( see attached two)
Im running the strategy on a PlayBack connection.
What is the problem? Could you help me please?
Comment