Percentage and Tick Prices

NinjaTrader commands only accept floating-point price levels. But as traders, it's often easier to define our trade logic in percentages or ticks as relative values to the underlying price.

There are 6 fields where a price can be explicitly set in a CrossTrade alert message:

TAKE_PROFIT, LIMIT_PRICE, STOP_PRICE, STOP_LOSS, STOP_LOSS_LIMIT, STOP_LOSS_STOP

We've added functionality to define any of the above variables in terms of % or "ticks" from the underlying price.

It is very important to note that these % and tick are translation to a price level and not, for instance, have anything to do with the value of position.

How to define % or tick price levels

Typically, a price level is defined as a floating-point number, e.g., 5349.25. You can also define a price level relative to the underlying price, like so:

take_profit=5%;
stop_loss=-25 ticks;
limit_price=-2.5%;
stop_price=12 ticks;

Any of the price fields can be defined as a positive or negative percentage or number of ticks. Positive numbers will result in a value above the spot price; negative numbers will result in a value below the spot price.

Price Formatting

Percentages

Any of the following representations of % are valid:

5%;
5 %;
5.2%;
5.5236 %;
-3%;
-3 %;
-3.2%;
-3.3129%;

Ticks

Any of the following representations of tick(s) are valid:

1 tick;
1 ticks;
1tick;
1ticks;
12tick;
12 ticks;
7.5 ticks;

How it works

Orders submitted to NT8 have to be in price of the underlying, which means ticks or % away from the underlying have to be translated into price. If a price field is presented as a % or tick value, then:

  1. CrossTrade will use the data feed connection from your NT8 to quote the instrument.

  2. The last price and/or tick size of the instrument will be used to define the price level that represents that value.

  3. The price field is swapped with the real value. CrossTrade will calculate the actual price level, rounded to nearest tick.

  4. CrossTrade sends the final order to NinjaTrader and lets NT8 round the price to the nearest value or tick, if necessary.

Prices are interpreted relative to the last price of the most recent quote. +10% is ten percent above the underlying price, -10 ticks is ten ticks below the underlying price.

The underlying price is quoted from your own NT8 feed. If, for whatever reason, the instrument fails to be quoted or the last quote time is greater than several seconds, the alert will error out.

Misspellings may not be caught by CrossTrade filters. If this happens, the value will be passed through unaffected. NT8 does not throw an error for non-numeric prices, e.g., -10 tic, and may result in unexpected behavior.

Example Payloads

The following command will set an OCO bracket order to take profit at 2.5% above the underlying price and stop loss at -5% below the underlying price:

key=your-secret-key; command=PLACE; account=sim101; instrument=NQ 12-24; action=BUY; qty=1; order_type=MARKET; TIF=DAY; take_profit=2.5%; stop_loss=-5%;

Similarly, we can set a buy limit order at 10 ticks below the current price:

key=your-secret-key; command=PLACE; account=sim101; instrument=NQ 12-24; action=BUY; qty=1; order_type=LIMIT; TIF=DAY; limit_price=-15 ticks;

Last updated