Professional Documents
Culture Documents
Donchian Channel Reversal
Donchian Channel Reversal
Donchian Channel Reversal
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class DonchianChannelBot : Robot
{
if (Trade.IsExecuting) return;
if (!tradeTime)
return;
// Check if the current candle is the first bullish candle closing above the
Donchian Channel top
if (MarketSeries.High.Last(2) > donchianChannel.Top.Last(2) &&
MarketSeries.Close.Last(2) > MarketSeries.Open.Last(2))
{
// Check if the next candle is bearish
if (Positions.Count <= 0 && MarketSeries.Close.Last(1) <
MarketSeries.Open.Last(1) && distance > NumDist)
{
// Print relevant information for debugging
Print("Conditions met for Sell Order!");