Prevent the stop loss from being updated after the trade has been entered
This commit is contained in:
parent
55b6abf526
commit
fdba098f52
@ -50,15 +50,18 @@ namespace NinjaTrader.NinjaScript.Strategies
|
|||||||
|
|
||||||
protected override void OnBarUpdate()
|
protected override void OnBarUpdate()
|
||||||
{
|
{
|
||||||
|
if (PrimaryBars != BarsInProgress)
|
||||||
|
return;
|
||||||
|
|
||||||
// TODO: Make this timezone-agnostic.
|
// TODO: Make this timezone-agnostic.
|
||||||
if (ToTime(Time[0]) <= 70000)
|
if (ToTime(Time[0]) <= 70000)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PrimaryBars != BarsInProgress)
|
if (Position.MarketPosition != MarketPosition.Flat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Open[0] < OR.ORH[0] && Close[0] > OR.ORH[0])
|
if (Open[0] < OR.ORH[0] && Close[0] > OR.ORH[0])
|
||||||
{
|
{
|
||||||
SetStopLoss(CalculationMode.Price, Low[0]);
|
SetStopLoss(CalculationMode.Price, Low[0]);
|
||||||
EnterLong();
|
EnterLong();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user