I am trying to create a strategy using the ATR Trailing indicator found here https://ninjatraderecosystem.com/use...d/atrtrailing/
my code is as follows
---------------------
protected override void OnBarUpdate()
{
if (CurrentBar < ATRPeriod) return;
if (( IsFlat || IsLong ) && ( Low[0] > _atrTrail.Lower[0] ) && _atrTrail.Upper[0] != 0)
{
this.EnterShortStopMarket(lots, _atrTrail.Upper[0], "Short 1");
this.EnterShortStopMarket(lots, _atrTrail.Upper[0], "Short 2");
}
if ( (IsFlat || IsShort) && (High[0] < _atrTrail.Lower[0] ) && _atrTrail.Lower[0] != 0 )
{
EnterLongStopMarket(lots, _atrTrail.Lower[0], "Long 1");
EnterLongStopMarket(lots, _atrTrail.Lower[0], "Long 2");
}
}
------------------------
For some reason the 2nd order is only submitted in short direction and only once
All orders thereafter are only Long 1 and Short 1
I have
EntriesPerDirection = 1;
EntryHandling = EntryHandling.UniqueEntries;
The idea is to use some form of profit target for one order and use a protective trailing stop for the 2nd one
Any help is greatly appreciated.
Ioannis
Comment