Description
The fractals by Williams are a very useful reference in my trading, but I think they are often undervalued due their poor graphical representation, most of the time with a cue ball over or under the bar
I read some articles by Barry and I simple coded his different graphical approach as BOXES
As you know, nothing is sure in the forex, but this is a good chance for a sell when the price touch the upper border, with a take profit at least at mid line, and a buy from the lower border always till the mid line or even to the opposite border
// -------------------------------------------------------------------------------------------------
// BarryBox Indy
// powered by http://stealthForex.eu - http://stealthForex.it
//
// -------------------------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class BarryBoxIndyV02midLine : Indicator
{
[Parameter("Show mid line", DefaultValue = true)]
public bool showMidLine { get; set; }
[Parameter("Show prices", DefaultValue = true)]
public bool showPrice { get; set; }
[Output("BarryBox Upper", Color = Colors.Red, Thickness = 2)]
public IndicatorDataSeries barryUp { get; set; }
[Output("BarryBox Lower", Color = Colors.Lime, Thickness = 2)]
public IndicatorDataSeries barryDn { get; set; }
[Output("BarryBox mid line", Color = Colors.Yellow, Thickness = 1, LineStyle = LineStyle.Dots)]
public IndicatorDataSeries midLine { get; set; }
protected override void Initialize()
{
}
public override void Calculate(int index)
{
if (MarketSeries.High[index] > MarketSeries.High[index - 1] && MarketSeries.High[index] > MarketSeries.High[index - 2] && MarketSeries.High[index] > MarketSeries.High[index + 1] && MarketSeries.High[index] > MarketSeries.High[index + 2])
{
barryUp[index] = MarketSeries.High[index];
}
else
{
barryUp[index] = barryUp[index - 1];
}
if (MarketSeries.Low[index] < MarketSeries.Low[index - 1] && MarketSeries.Low[index] < MarketSeries.Low[index - 2] && MarketSeries.Low[index] < MarketSeries.Low[index + 1] && MarketSeries.Low[index] < MarketSeries.Low[index + 2])
{
barryDn[index] = MarketSeries.Low[index];
}
else
{
barryDn[index] = barryDn[index - 1];
}
if (showMidLine)
{
midLine[index] = (barryDn[index] + barryUp[index]) / 2;
}
else
{
midLine[index] = double.NaN;
}
if (IsRealTime && showPrice)
{
ChartObjects.DrawText("UPPER Price", "UPPER " + Math.Round(barryUp[index], Symbol.Digits).ToString().Replace(',', '.'), index, barryUp[index] + 2 * Symbol.PipValue, VerticalAlignment.Top, HorizontalAlignment.Left);
ChartObjects.DrawText("LOWER Price", "LOWER " + Math.Round(barryDn[index], Symbol.Digits).ToString().Replace(',', '.'), index, barryDn[index] - 2 * Symbol.PipValue, VerticalAlignment.Bottom, HorizontalAlignment.Left);
}
}
}
}
gainer
Joined on 24.01.2016
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: BarryBox Indy V02 midLine.algo
- Rating: 5
- Installs: 4433
- Modified: 13/10/2021 09:54
Comments
Hi there, nice indicator. Not sure if this is a problem with my setup but the upper and lower borders don't auto adjust to the candles with time. Should they as I'm manually having to switch between different timeframes for them to update?
Cheers
Hello Marco , this is fantastic as it gives much more clarity to the levels. Marco are you able to show me the code for a cbot to call and use the barryup & barrydn values from the cbot. I've been trying for a very long time but can not work it out. Any help would be appreciated.
thanks