I'm hoping to code up a strategy to test based around MACD crosses.
I'm not a developer so am finding my way through as best as I can. I'm editing the C# code using visual studio, all going ok.
I've had a skim through the forum & found something similar to what I was looking to do, looking to build an indicator first before then creating a strategy so that I can test it.
I wanted to create the indicator myself from scratch which I've done, but for some reason it is not adding the arrows to the chart in the same way, which I can't understand now sorry, the code looks the same to me & everything compiles no problem
Please see an snippet below, but I've attached the 2 indi files as well
protected override void OnBarUpdate()
{
//Add your custom indicator logic here.
if (CurrentBars[0] < 1)
return;
// Up Arrows
if (CrossAbove(MACD1.Avg, 0, 1))
{
Draw.ArrowUp(this, "above1" +CurrentBar, false, 1, Low[1], Brushes.LimeGreen);
}
// Down Arrows
if (CrossBelow(MACD1.Default, MACD1.Avg, 1))
{
Draw.ArrowDown(this, "below1" +CurrentBar, false, 1, High[1] + TickSize * 5, Brushes.Red);
}
}
Cheers
Gav

Comment