NexusFi: Find Your Edge


Home Menu

 





Manage orders with dictionary TryGetValue in levels


Discussion in NinjaTrader

Updated
    1. trending_up 2,706 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?
Post-Summit Scorecard: $36M in May 15 Bets Settle Near-Z …
Prediction Markets & Event Contracts
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
Victory Day Delivers: Russia-Ukraine Ceasefire Market Cl …
Prediction Markets & Event Contracts
Khamenei Vetoes Uranium Transfer as Peace Odds Surge to …
Prediction Markets & Event Contracts
Hormuz Completely Closed: US Strikes Day 2, Iran Shoots …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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