mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-22 12:38:06 +00:00
style patterns
This commit is contained in:
@@ -41,7 +41,10 @@ public class SlopeIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
protected override void OnUpdate(UpdateArgs args)
|
||||
{
|
||||
if (_slope == null || _selector == null) return;
|
||||
if (_slope == null || _selector == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var item = HistoricalData[0, SeekOriginHistory.End];
|
||||
double value = _selector(item);
|
||||
@@ -60,11 +63,18 @@ public class SlopeIndicator : Indicator, IWatchlistIndicator
|
||||
double slope = _slope.Last.Value;
|
||||
Color color;
|
||||
if (slope > 0)
|
||||
{
|
||||
color = Color.Green;
|
||||
}
|
||||
else if (slope < 0)
|
||||
{
|
||||
color = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.Gray;
|
||||
}
|
||||
|
||||
LinesSeries[0].SetMarker(0, new IndicatorLineMarker(color));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user