NexusFi: Find Your Edge


Home Menu

 





code to calculate distance to orders


Discussion in NinjaTrader

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




 
Search this Thread

code to calculate distance to orders

  #1 (permalink)
ycomp
Europe-ish
 
Posts: 177 since Sep 2013
Thanks Given: 12
Thanks Received: 58

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?
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #2 (permalink)
 iantg 
charlotte nc
 
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148

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


© 2024 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 - Privacy Policy - Downloads - Top
no new posts