AL
Prevent cBot to send double order in a specific Symbol
09 Jul 2019, 17:45
Please help me to prevent cBot to send double order in a specific Symbol.
My code is like below which do not work.
if ((RSI.Result.LastValue > 50) & (Positions.Where(x => x.SymbolName == Symbol.Name) == 0))
{
if (!IsPositionOpenByType(TradeType.Buy))
{
OpenPosition(TradeType.Buy);
}
ClosePosition(TradeType.Sell);
}
if ((RSI.Result.LastValue < 50) & (Positions.Where(x => x.SymbolName == Symbol.Name) == 0))
{
if (!IsPositionOpenByType(TradeType.Sell))
{
OpenPosition(TradeType.Sell);
}
ClosePosition(TradeType.Buy);
}

alexsanramon
10 Jul 2019, 01:51
I think I got it.
((Positions.Count(x => x.SymbolCode == Symbol.Code)) == 0))
@alexsanramon