************************************************** **************************
else if (State == State.Configure)
{
AddDataSeries(HTFPeriodType, HTFPeriod);
}
}
protected override void OnBarUpdate()
{
if(CurrentBar < 50 || CurrentBars[1] < 50) return;
if(string.IsNullOrEmpty(period_string))
{
Print("BarType: " + Bars.BarsType.ToString() + " BarsPeriod: " + Bars.BarsPeriod.BarsPeriodType.ToString());
if(Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Second)
{
period_string = Bars.BarsPeriod.Value + "S";
}
else if(Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Minute)
{
period_string = Bars.BarsPeriod.Value + "M";
}
else if(Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Day)
{
period_string = Bars.BarsPeriod.Value + "D";
}
else if(Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Month)
{
period_string = Bars.BarsPeriod.Value + "MN";
}
Print(period_string);
}
double macdhtf = MACD(MACDFast, MACDSlow, MACDLine).Avg[1];
double macd = MACD(MACDFast, MACDSlow, MACDLine).Avg[0];
if(macdhtf > 0 && macd > 0 && Close[0] > High[1])
{
if(AlertsOn)
{
Alert("DP_UP", AlertPriority, period_string + " " + AlertText + " BULL ALERT", alertfile, 10, BullAlertBackgroundBrush, BullAlertForegroundBrush);
}
}
if(macdhtf < 0 && macd < 0 && Close[0] < Low[1])
{
if(AlertsOn)
{
Alert("DP_DOWN", AlertPriority, period_string + " " + AlertText + " BEAR ALERT", alertfile, 10, BearAlertBackgroundBrush, BearAlertForegroundBrush);
}
}
************************************************** ***************************
Comment