I am trying to develop a simple indicator which will test Stochastics value on multiple time frames and Draw something on my main chart (5 min.)
I have gone through help and forum and I am still stuck. My code below compiles OK, but I see no DrawText written in my chart.
Could you kindly point out what is wrong with my code? Thanks a lot.
protected override void Initialize()
{
Add(PeriodType.Month, 1);
Add(PeriodType.Week, 1);
Add(PeriodType.Minute, 1440);
Add(PeriodType.Minute, 240);
Add(PeriodType.Minute, 60);
Add(PeriodType.Minute, 30);
Overlay = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (BarsInProgress == 0);
{
if (Stochastics(BarsArray[1], 7, 14, 3).D[0] < 20)
{
DrawText("My text" + CurrentBar, "M", 0, Low[0] + (TickSize*14), Color.Blue);
}
else if (Stochastics(BarsArray[2], 7, 14, 3).D[0] < 20)
{
DrawText("My text" + CurrentBar, "W", 0, Low[0] + (TickSize*12), Color.Blue);
}
else if (Stochastics(BarsArray[3], 7, 14, 3).D[0] < 20)
{
DrawText("My text" + CurrentBar, "D", 0, Low[0] + (TickSize*10), Color.Blue);
}
else if (Stochastics(BarsArray[4], 7, 14, 3).D[0] < 20)
{
DrawText("My text" + CurrentBar, "240", 0, Low[0] + (TickSize*8), Color.Blue);
}
else if (Stochastics(BarsArray[5], 7, 14, 3).D[0] < 20)
{
DrawText("My text" + CurrentBar, "60", 0, Low[0] + (TickSize*6), Color.Blue);
}
else if (Stochastics(BarsArray[6], 7, 14, 3).D[0] < 20)
{
DrawText("My text" + CurrentBar, "30", 0, Low[0] + (TickSize*4), Color.Blue);
}
else
{
}
}
}
Comment