NexusFi: Find Your Edge


Home Menu

 





Manage orders with dictionary TryGetValue in levels


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 je951 
Australia
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 2 since Apr 2011
Thanks Given: 1
Thanks Received: 0

I am working on managing orders on support and resistance levels, using unManaged order in Ninjatrader. In order to be in the front of the queue to get fill, I submit all orders on strategy start up. Then when price move in between 2 levels, orders will be cancelled and added under certain condition.

Can anyone help to correct my code? Thanks in advance!

 
Code
private IOrder es_0 = null;
private double SRHigh = 0;
private double SRLow = 0;
private double level_0 = 0;
private IOrder shortR1       = null;
private IOrder shortR11      = null;

private void Es_0()
		{es_0 = SubmitOrder(0, OrderAction.Sell, OrderType.Limit, DefaultQuantity, level_0, 0, "", "es_0");}
		private void Es_1()

listSR.Add(level_0);

protected void FindSR() //find top and bottom levels 
			{ 
				listSR.Sort();
				for (int x = 0; x < listSR.Count; x++)
				{
					if (listSR[x] > Close[0])
						{
							SRHigh = listSR[x];
							if (x != 0) SRLow = listSR[x - 1];
							break;
						}
					if (listSR[x] > Close[0]) SRLow = 0;
					if (listSR[x] < Close[0]) SRHigh = 0;
				}
			}

public class Orders
		{
			public IOrder Order1 { get; set; }
			public IOrder Order11 { get; set; }
		}
		protected void Dictionary()  //find orders on levels
		{
            Dictionary<double, Orders> dict = new Dictionary<double, Orders>();
            dict.Add(level_0, new Orders { Order1 = es_0, Order11 = ts_0 });
			
				if (dict.TryGetValue(level_0, out Orders(Order1)))
					shortR1 = Order1;
				if (dict.TryGetValue(level_0, out Orders(Order11)))
					shortR11 = Order11;
        }


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Hungary Called for Magyar at 97pct, Ending 16-Year Orban …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
Prediction Markets Expiry Day: Trump Eyes War Exit, $230 …
Prediction Markets & Event Contracts
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks




Last Updated on June 17, 2012


© 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