code to avoid overfills - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

code to avoid overfills
Started:October 27th, 2012 (11:56 AM) by minsalaco Views / Replies:886 / 2
Last Reply:August 27th, 2013 (08:04 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

code to avoid overfills

Old October 27th, 2012, 11:56 AM   #1 (permalink)
Elite Member
new york, ny
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: eur/usd
Posts: 5 since Jan 2011
Thanks: 0 given, 7 received

code to avoid overfills

Here you do ("tradesize1" is a defined term under the Variables part of your strat; currently have mine set to default 2 (e.g., "private int tradesize1 = 2;"). You can just drop this into your strats:

protected override void OnMarketData(MarketDataEventArgs e)


if (Position.Quantity>tradeSize1)


int x = Position.Quantity-tradeSize1;

if (Position.MarketPosition==MarketPosition.Long)


else if (Position.MarketPosition==MarketPosition.Short)




Reply With Quote
The following user says Thank You to minsalaco for this post:

Old October 27th, 2012, 11:56 AM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old August 27th, 2013, 08:04 AM   #3 (permalink)
Elite Member
Lubbock TX
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Stage 5 Trading
Favorite Futures: CL
MWinfrey's Avatar
Posts: 1,878 since Jul 2009
Thanks: 1,448 given, 3,290 received

Here is another solution for NT overfills.

Reply With Quote
The following user says Thank You to MWinfrey for this post:

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > code to avoid overfills

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you avoid boredom and stay focused? SammyD Traders Hideout 11 August 5th, 2015 01:18 PM
How to avoid eye fatigue / eyestrain HighRise1202 Traders Hideout 10 October 10th, 2012 04:04 PM
How can I avoid this trade arjfca The Elite Circle 11 January 20th, 2011 07:24 AM
Problem with Order Overfills with NinjaTrader. What about Multicharts? lawtan MultiCharts 7 October 5th, 2010 07:33 AM
Avoid being whipsawed on the entry candle. koganam NinjaTrader Programming 1 January 5th, 2010 03:57 AM

All times are GMT -4. The time now is 01:04 AM.

Copyright © 2016 by 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.
no new posts

Page generated 2016-10-25 in 0.07 seconds with 19 queries on phoenix via your IP