@andreas: First of all your question is not clear to me. A trailing stop that trails 2 ticks above the high of the previous n bars. Are you talking about a short position? I am not sure what you want to achieve.
The standard procedure - which is not necessarily the best - would be to enter a position, define a profit target and an initial stop for the first half of the position, and then have the second position trailed (without profit target) by adjusting the initial stop. This is typically done via a Chandelier Stop, that is the trailing stop for a long position will be adjusted, when a new high is made.
The standard procedure has been implemented with the ATM feature if NinjaTrader.
Now, if you have any other - so far obscure - method to trail you second position, then you would have to explain it here. I did not get it from your description.
In this case two other options would be available.
(1) Code an indicator that exits all positions, when the trailing stop is hit. Attention: Exiting all positions means exiting all strategies across all accounts, as this is what the NinjaScript method does, which can be used in an indicator.
(2) Code a strategy, which is used to open and exit your positions. For opening a position via that strategy, you would have to code an add-on with separate buttons to enter the position via a market or limit order. When the strategy is activated the buttons appear somewhere on the panel. Once you hit the button the strategy will enter the position and take care of your profit target and trailing stops.
i am sorry, the whole idea was not clearly described..
what i am looking for is:
lets assume we enter a short position through a "sell stop" set by right clicking and select stop sell (or would i need my own menu?) with 10c.
initial stop loss is x ticks (works with ninja atm)
exit 8c at a profit target of x ticks (works with ninja atm)
set stop of remaining 2c to b/e + y ticks as an option "set to b/e" and "b/e + y ticks" in settings or by "enabling" it on demand with a button "set to b/e" (works sort of with ninja atm as it can only be done with a strategy on the fly or with overwriting the existing strategy)
once we have the stop at b/e(+y ticks) it should trail the stop z ticks above the highs of the n previous candles if they are making lower highs as an option in settings "trailing enabled" and "trailing margin in ticks" or by "enabling" it on demand with a button "Enable Trailing" (does not work in ninja atm)
regarding your post, it seems that i would need a strategy with buttons and stuff. However, as i am not able to code, i would need a coder to do that for me then...
If anyone could roughly estimate the effort needed to do this or even would code that for me, that would be awesome. in this case, please send me a p.m. with a price (if any ) and i am sure we can sort this out.
This is pretty clear now, and it can not be done with the available ATM settings. With an ATM strategy you can set the stop for the remaining contracts to breakeven + y ticks, but you can not trail the stop in the way you have described. For a short position NinjaTrader/ATM calculates the trailing amount from the lows (similar to a chandelier stop), and not from the high of the last N bars as you are doing.
I think the only option here would be to code a strategy with an interface that would allow you to enter your position manually via that strategy. The strategy would then take care of the profit target, initial stop, breakeven stop and trailing the stop for the last 2 contracts.