NexusFi: Find Your Edge


Home Menu

 





code to calculate distance to orders


Discussion in NinjaTrader

Updated
    1. trending_up 1,158 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
ycomp
Europe-ish
 
Posts: 177 since Sep 2013
Thanks Given: 12
Thanks Received: 60

Does anyone have any code that calculates the distance (ticks or points) to the closest limit order? or something similar?


Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
White House Drops First Alien Files Today -- Market Says …
Prediction Markets & Event Contracts
Iran Talks Final Stages -- Two VLCCs Exit Hormuz, Record …
Traders Hideout
$4.5M Floods Russia Nuclear Contract in 24 Hours -- Krem …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
3 thanks
  #2 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Posts: 409 since Jan 2015
Thanks Given: 91
Thanks Received: 1,154

In NinjaTrader syntax this is just GetCurrentBid() and GetCurrentAsk(). This will give you the current bid / ask price that is transacting.

If you have a limit order you submitted on the DOM that is k ticks out and over time as the market moves, if you want to know how far away your resting order is from the current best bid / best ask, all you would do is something like.

MyAskOrder -GetCurrentAsk()
or GetCurrentBid() - MyBidOrder

The difference will be the total number of ticks.



Ian






ycomp View Post
Does anyone have any code that calculates the distance (ticks or points) to the closest limit order? or something similar?


In the analytical world there is no such thing as art, there is only the science you know and the science you don't know. Characterizing the science you don't know as "art" is a fools game.
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
TravelingSalesmen
Tucson arizona
 
Posts: 31 since Jun 2018
Thanks Given: 4
Thanks Received: 4



ycomp View Post
Does anyone have any code that calculates the distance (ticks or points) to the closest limit order? or something similar?

ya this is actually quite easy in NT8 even in the Strategy analyzer. just build it your self. you would want to set up a condition the first checks if there are any active orders or open positions which ever limit order your talking about. then set an action to take the absolute value of the difference of current price - that limit order. this will give you the distance in points. then you could divide by the tick value to get ticks.

hope that helps.


Reply With Quote




Last Updated on March 26, 2019


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts