Add the ability to configure price range high / low levels
This commit is contained in:
parent
5a052ebb1b
commit
3c339ecb56
@ -94,6 +94,9 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
UseFixedRiskReward = true;
|
||||
Risk = 25.0;
|
||||
Reward = 75.0;
|
||||
|
||||
PriceRangeHigh = new Stroke(Brushes.LimeGreen, DashStyleHelper.Solid, 3);
|
||||
PriceRangeLow = new Stroke(Brushes.Red, DashStyleHelper.Solid, 3);
|
||||
}
|
||||
else if (State == State.Configure)
|
||||
{
|
||||
@ -304,13 +307,17 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
int startX = chartControl.GetXByTime(priceRange.Key + rangeStartTime);
|
||||
int endX = chartControl.GetXByTime(priceRange.Key + rangeEndTime);
|
||||
|
||||
SharpDX.Direct2D1.Brush priceRangeHighBrush = PriceRangeHigh.Brush.ToDxBrush(RenderTarget);
|
||||
int highY = chartScale.GetYByValue(priceRange.Value.High);
|
||||
RenderTarget.DrawLine(new SharpDX.Vector2(startX, highY), new SharpDX.Vector2(endX, highY),
|
||||
Brushes.LimeGreen.ToDxBrush(RenderTarget), 3);
|
||||
RenderTarget.DrawLine(new SharpDX.Vector2(startX, highY), new SharpDX.Vector2(endX, highY),
|
||||
priceRangeHighBrush, PriceRangeHigh.Width, PriceRangeHigh.StrokeStyle);
|
||||
priceRangeHighBrush.Dispose();
|
||||
|
||||
SharpDX.Direct2D1.Brush priceRangeLowBrush = PriceRangeLow.Brush.ToDxBrush(RenderTarget);
|
||||
int lowY = chartScale.GetYByValue(priceRange.Value.Low);
|
||||
RenderTarget.DrawLine(new SharpDX.Vector2(startX, lowY), new SharpDX.Vector2(endX, lowY),
|
||||
Brushes.Red.ToDxBrush(RenderTarget), 3);
|
||||
RenderTarget.DrawLine(new SharpDX.Vector2(startX, lowY), new SharpDX.Vector2(endX, lowY),
|
||||
priceRangeLowBrush, PriceRangeLow.Width, PriceRangeLow.StrokeStyle);
|
||||
priceRangeLowBrush.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,6 +405,16 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
public double Reward
|
||||
{ get; set; }
|
||||
|
||||
[NinjaScriptProperty]
|
||||
[Display(Name = "Range High", GroupName = "Price Range Window", Order = 1)]
|
||||
public Stroke PriceRangeHigh
|
||||
{ get; set; }
|
||||
|
||||
[NinjaScriptProperty]
|
||||
[Display(Name = "Range Low", GroupName = "Price Range Window", Order = 2)]
|
||||
public Stroke PriceRangeLow
|
||||
{ get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user