Thanks.
protected override void OnBarUpdate()
{
// Will stop the strategy after a loss of $300...
if (Performance.AllTrades.TradesPerformance.Currency. CumProfit < -300)
Disable();
// Condition set 1 norm 10...
if (GetCurrentBid() >= PRC2(3, 105, 1.62, 2, 34, 34).Sqh[2] + 0 * TickSize)
if ((CrossBelow(Stochastics(Closes[0],2, 14, 4).K, Stochastics(Closes[0],2, 14, 4).D, 1)))
if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Market, 0, 0, TimeInForce.Day, orderId, "Oil", atmStrategyId);
}
// Condition set 2 norm 6...
if (GetCurrentAsk() < PRC2(3, 105, 1.62, 2, 34, 34).Sql[0] + 0 * TickSize)
if ((CrossAbove(Stochastics(Closes[0],2, 14, 4).K, Stochastics(Closes[0],2, 14, 4).D, 1)))
if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Market, 0, 0, TimeInForce.Day, orderId, "Oil", atmStrategyId);
}
}
Comment