Price channel
Price channel
23 May 2013, 01:45
Hello,
I'm looking for a simple and popular indicator - price channel (tipically it plot in the chart a channel with the 20-period high and low).
I didn't find it on cTrader nor in the forum.
Could you please?
Thanks
Replies
lec0456
24 May 2013, 06:18
I am really glad you asked this question and that it was answered in the way it was. I followed the link and read a very important requirement for the price channel.
It said, "The Price Channel formula does not include the most recent period. Price Channels are based on prices prior to the current period. A 20-day Price Channel for October 21 would be based on the 20-day high and 20-day low ending the day before, October 20. A channel break would not be possible if the most recent period was used."
I had created a price channel indicator like the one posted by "adaled". it used the maximun and minimum fuctions. But this is incorrect because they use the current period in there calculations. Actually, there is a sample indicator included with the installation of cAlgo called Sample Price Channels, it calculates the channel correctly like described on the Stock Charts.Com website:
using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; namespace cAlgo.Indicators { [Indicator(IsOverlay = true)] public class SamplePriceChannels : Indicator { [Parameter(DefaultValue = 20)] public int Periods { get; set; } [Output("Upper", Color = Colors.Pink)] public IndicatorDataSeries Upper { get; set; } [Output("Lower", Color = Colors.Pink)] public IndicatorDataSeries Lower { get; set; } [Output("Center", Color = Colors.Pink)] public IndicatorDataSeries Center { get; set; } public override void Calculate(int index) { double upper = double.MinValue; double lower = double.MaxValue; for (int i = index - Periods; i <= index - 1; i++) { upper = Math.Max(MarketSeries.High[i], upper); lower = Math.Min(MarketSeries.Low[i], lower); } Upper[index] = upper; Lower[index] = lower; Center[index] = (upper + lower) / 2; } } }
@lec0456
cAlgo_Fanatic
24 May 2013, 12:52
Parabolic SAR is already included. We will add more indicators in the platform in the future.
@cAlgo_Fanatic
cAlgo_Fanatic
24 Jul 2013, 15:20
RE:
Many thanks. It works just perfectly!
To support: I believe it should be part of he platform, together with many other standard and popular indicators (ichimoku, PSAR, ..)
Three new standard indicators have been added to cTrader/cAlgo: Average True Range, Ichimoku Kinko Hyo and Donchian Channel.
@cAlgo_Fanatic
adaled
23 May 2013, 10:51
/algos/indicators/show/275
@adaled