I have the following Problem: My strategy has entries per direction = 1. However, sometimes the strategy didn't exit the whole position or the strategy entered multiple times when trading real time (no sim account!). See attatched the real time trade performance report where you can see the problems.
For example: The strategy entered on 19 July 2018 with 8 GER30 Short and made an Exit on 20 July 2018 with only 7 GER30 Long instead of 8 GER30 Long. I don't understand how that is possible because I have only "ExitShort()" in the code with no specification with size or anything.
Also afterwards the positions went up to 32 GER30 short which shouldn't be possible when having entries per direction = 1.
In the strategy analyzer everything was fine. I checked the parameteres and they are identical in both the strategy analyzer and the real time trade performance report. So these problems only occur when trading real time.
The code of the strategy is basically as follows:
double entryPrice = Close[0];
int size = (int) (this.Capital / entryPrice);
// Long
if (IsFlat)
{
if (CONDITION)
EnterLong(size, "Buy");
}
if (CONDITION)
ExitLong();
//Short
if (IsFlat)
{
if (CONDITION)
EnterShort(size, "Sell");
}
if (CONDITION)
ExitShort();
}
bool IsFlat { get { return base.Position.MarketPosition == MarketPosition.Flat; }}
bool IsLong { get { return base.Position.MarketPosition == MarketPosition.Long; }}
Can anyone help me with this problem? I want the strategy to exit the whole position and not to enter multiple times in the same direction.
Thanks!
Comment