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, ticks, points, or dollars 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_STOPWe've added functionality to define any of the above variables in terms of %, ticks-value, point-value, or dollar-value from the underlying price.
It is important to note that %, tick, point, and dollar values are translated to a price level and not, for instance, have anything to do with the value of position.
How to define 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.
You can also use the point-value or dollar-value of a move in the underlying, like so:
take_profit=15 points;
stop_loss=250 dollars;
limit_price=2.5%;
stop_price=12 ticks;Price Formatting
Percentages
Any of the following representations of % are valid:
Ticks
Any of the following representations of tick(s) are valid:
Points
Any of the following representations of point(s) are valid:
Dollars
Any of the following representations of $ are valid:
How it works
Orders submitted to NT8 have to be in price of the underlying, which means ticks away from the underlying, for example, have to be translated into price. If a price field is presented as a %, tick, point, or dollar value, then:
CrossTrade will use the data feed connection from your NT8 to quote the instrument.
The last price and/or tick size of the instrument will be used to define the price level that represents that value.
The price field is swapped with the real value. CrossTrade will calculate the actual price level, rounded to nearest tick.
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=ES 12-25; 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=ES 12-25; action=BUY; qty=1; order_type=LIMIT; TIF=DAY; limit_price=15 ticks;
Last updated