I want to do Label
I want to do Label
15 Jan 2017, 18:27
if (rsi.Result.LastValue < 25 && _position == null)
{
OpenPosition(TradeType.Buy);
}
if (rsi.Result.LastValue > 75 && _position == null)
{
OpenPosition(TradeType.Sell);
}
if (_position != null)
{
if (_position.TradeType == TradeType.Buy && rsi.Result.LastValue > 55)
{
}
if (_position.TradeType == TradeType.Sell && rsi.Result.LastValue < 45)
{
}
}
if (Account.Equity - Account.Balance > Profit)
{
foreach (var position in Account.Positions)
{
Trade.Close(position);
}
}
}
private void OpenPosition(TradeType command)
{
Trade.CreateMarketOrder(command, Symbol, Volume);
}
protected override void OnPositionOpened(Position openedPosition)
{
_position = openedPosition;
}
protected override void OnPositionClosed(Position closedPosition)
{
_position = null;
}
}
}