What is wrong, if cross line then onpe buy or sell repeatedly but I want only open position if close bar
What is wrong, if cross line then onpe buy or sell repeatedly but I want only open position if close bar
02 Jun 2017, 11:17
if (!isBuyPositions && isSOCBuySignal && _TMA1.Result.LastValue > _TMA2.Result.LastValue)
{
closePositions(TradeType.Sell);
Open(TradeType.Buy);
}
if (!isSellPositions && _SMA.Result.LastValue > MarketSeries.Close.LastValue && _TMA1.Result.LastValue > _TMA2.Result.LastValue)
{
closePositions(TradeType.Buy);
}
if (!isBuyPositions && _SMA.Result.LastValue < MarketSeries.Close.LastValue && _TMA1.Result.LastValue < _TMA2.Result.LastValue)
{
closePositions(TradeType.Sell);
}
if (!isSellPositions && isSOCSellSignal && _TMA1.Result.LastValue < _TMA2.Result.LastValue)
{
Open(TradeType.Sell);
closePositions(TradeType.Buy);
}
croucrou
03 Jun 2017, 01:31
Use "OnBar()" instead of "OnTick()".
@croucrou