Description
This indicator is inspired by Donchian channel.
However, instead of periods, it draws the channel based on the price information of the bar of the selected timeframe, including high, low, open, close, median, typical, and weighted prices.
No need to put all the lines into the chart. The high, low, and median price lines are good enough and may help to see these lines as a support / resistance.
These are how I use it:
1) On trend following trade, I wait for the price correction into the median line (or high/low price line). Enter the trade on that pullback breakout.
2) On reversal trend trade, once the price crosses the median, wait for the price to break the latest swing of the prevail trend and then new swing low is created (or swing high on down trend reversal). Trade entry is similar as (1).
Cheers.
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None, AutoRescale = false)]
public class MultiTimeframePriceChannel : Indicator
{
private Bars _Series;
private int _TimeframeIndex;
[Parameter("Timeframe", DefaultValue = "Daily")]
public TimeFrame _Timeframe { get; set; }
[Output("High", LineColor = "#FFFF0000", LineStyle = LineStyle.Solid)]
public IndicatorDataSeries _High { get; set; }
[Output("Low", LineColor = "#FF008000", LineStyle = LineStyle.Solid)]
public IndicatorDataSeries _Low { get; set; }
[Output("Open", LineColor = "#FF02AFF1", LineStyle = LineStyle.Solid)]
public IndicatorDataSeries _Open { get; set; }
[Output("Close", LineColor = "#FFFF00C5", LineStyle = LineStyle.Solid)]
public IndicatorDataSeries _Close { get; set; }
[Output("Median", LineColor = "#FFB3B3B3", LineStyle = LineStyle.Solid)]
public IndicatorDataSeries _Median { get; set; }
[Output("Typical", LineColor = "#FF3F3F3F", LineStyle = LineStyle.Dots)]
public IndicatorDataSeries _Typical { get; set; }
[Output("Weighted", LineColor = "#FF3F3F3F", LineStyle = LineStyle.DotsRare)]
public IndicatorDataSeries _Weighted { get; set; }
protected override void Initialize()
{
_Series = MarketData.GetBars(_Timeframe);
}
public override void Calculate(int index)
{
_TimeframeIndex = _Series.OpenTimes.GetIndexByTime(Bars.OpenTimes[index]);
_TimeframeIndex--;
if (_Series.Count == Bars.Count)
{
index--;
}
_Low[index] = _Series.LowPrices[_TimeframeIndex];
_High[index] = _Series.HighPrices[_TimeframeIndex];
_Open[index] = _Series.OpenPrices[_TimeframeIndex];
_Close[index] = _Series.ClosePrices[_TimeframeIndex];
_Median[index] = _Series.MedianPrices[_TimeframeIndex];
_Typical[index] = _Series.TypicalPrices[_TimeframeIndex];
_Weighted[index] = _Series.WeightedPrices[_TimeframeIndex];
}
}
}
dadi
Joined on 17.10.2020
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Multi Timeframe Price Channel.algo
- Rating: 0
- Installs: 1460
- Modified: 25/03/2022 07:05