Bollinger Bands BO Strategy Help
05 Dec 2016, 11:11
Hello I would very much appreciate if someone could help me with the code of a bot ive been editing all credit goes to [HJozan], im not very good with coding so im sorry if i get the wrong terminology i found the arrows show up to early and not when the bar closes i could normally fix the problem by adding the "OnBar();" identifyer
-----------
e.g. public OnBar(); override void Calculate(int index)
but when i do i get this change of code,
public override void OnBar();
BBREVERSALCODE(int index)
-----------
and if i try
override void Calculate(int index) OnBar();
I get 25 Errors so i know im way off
can anyone edit the code so it only displays an arrow ONLY IF the price CLOSES above/below the bollinger bands, but NO ARROW if it just touches the BB in the candles time.
Thankyou very much.
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
public class BBREVERSALCODE : Indicator
{
private BollingerBands bbds;
protected override void Initialize()
{
bbds = Indicators.BollingerBands(MarketSeries.Close, 30, 3, MovingAverageType.Simple);
}
public override void Calculate(int index)
{
if (bbds.Top[index + -0] < MarketSeries.High[index + -0])
{
ChartObjects.DrawText(index.ToString(), "▼", index, MarketSeries.High[index + -0] + Symbol.PipSize, VerticalAlignment.Top, HorizontalAlignment.Center, Colors.Red);
}
if (bbds.Bottom[index + -0] > MarketSeries.Low[index + -0])
{
ChartObjects.DrawText(index.ToString(), "▲", index, MarketSeries.Low[index + -0] - Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, Colors.Green);
}
}
}
}

cyfer
05 Dec 2016, 12:33
public override void Calculate(int index) { if (bbds.Top[index-1] < MarketSeries.Close[index-1]) { ChartObjects.DrawText(index.ToString(), "▼", index-1, MarketSeries.High[index-1] + Symbol.PipSize, VerticalAlignment.Top, HorizontalAlignment.Center, Colors.Red); } if (bbds.Bottom[index-1] > MarketSeries.Close[index-1]) { ChartObjects.DrawText(index.ToString(), "▲", index-1, MarketSeries.Low[index-1] - Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, Colors.Green); } }@cyfer