NexusFi: Find Your Edge


Home Menu

 





Manage orders with dictionary TryGetValue in levels


Discussion in NinjaTrader

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




 
Search this Thread

Manage orders with dictionary TryGetValue in levels

  #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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Quant vue
Trading Reviews and Vendors
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 




Last Updated on June 17, 2012


© 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