Add currency filter parameter to News indicator
This commit is contained in:
parent
4c0ebfe12b
commit
29f6f32934
@ -48,6 +48,7 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
VerticalPadding = 5;
|
VerticalPadding = 5;
|
||||||
YOffset = 0;
|
YOffset = 0;
|
||||||
CellBackgroundColor = Brushes.Transparent;
|
CellBackgroundColor = Brushes.Transparent;
|
||||||
|
CurrencyFilter = "USD";
|
||||||
}
|
}
|
||||||
else if (State == State.Configure)
|
else if (State == State.Configure)
|
||||||
{
|
{
|
||||||
@ -103,6 +104,9 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
|
|
||||||
string time = eventTime.ToString("hh:mmtt").ToLower();
|
string time = eventTime.ToString("hh:mmtt").ToLower();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(CurrencyFilter) && !currency.Equals(CurrencyFilter, StringComparison.OrdinalIgnoreCase))
|
||||||
|
continue; // Skip events that do not match the filter.
|
||||||
|
|
||||||
newsEvents.Add(new NewsEvent { Time = time, Currency = currency, Title = title });
|
newsEvents.Add(new NewsEvent { Time = time, Currency = currency, Title = title });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,6 +307,10 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
get { return Serialize.BrushToString(CellBackgroundColor); }
|
get { return Serialize.BrushToString(CellBackgroundColor); }
|
||||||
set { CellBackgroundColor = Serialize.StringToBrush(value); }
|
set { CellBackgroundColor = Serialize.StringToBrush(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Display(Name = "Currency Filter", GroupName = "News", Order = 10)]
|
||||||
|
public string CurrencyFilter { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user