IOrders - ExitOrders problem - NinjaTrader Programming | futures io social day trading
futures io futures trading


IOrders - ExitOrders problem
Updated: Views / Replies:546 / 7
Created: by FILIP88 Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

IOrders - ExitOrders problem

  #1 (permalink)
Elite Member
Ostrava, Czech Republic
 
Futures Experience: Beginner
Platform: Ninja trader
Favorite Futures: currency
 
Posts: 9 since Mar 2015
Thanks: 4 given, 0 received

IOrders - ExitOrders problem

Hello everybody,

i would like to ask some experienced programmer for a help with IOrders.

I have programmed simple strategy that should set profit target and stop loss by ExitLongStop and Exit longLimit. After entering a position, TP should be set 50 ticks above entry and SL should be set 50ticks bellow entry. Unfortunately when I apply strategy in a chart and position is entered, sometimes, the strategy omit exit orders, please see chart bellow.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


ENTRY
 
Code
entryOrderLong = EnterLongStop(0, false, 1, High[0] + 1 * TickSize, "LONG");
				
Print("LONG TRADE" + High[0] + 1 * TickSize );
IORDERS

 
Code
if (entryOrderLong != null && entryOrderLong == order)
		{
			if (order.OrderState == OrderState.Filled)
			{

				exitLimitLong = ExitLongLimit(0, true, 1, entryOrderLong.AvgFillPrice + 50 * TickSize, "PROFIT TARGET",entryOrderLong.FromEntrySignal);
				
				exitStopLong = ExitLongStop(0, true, 1, entryOrderLong.AvgFillPrice - 50 * TickSize, "STOP LOSS", entryOrderLong.FromEntrySignal); 	
			
			}
		}
LOG:

 
Code
24.3.2015 19:20:00 Entered internal PlaceOrder() method at 24.3.2015 19:20:00: BarsInProgress=0 Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=953,00 SignalName='LONG' FromEntrySignal=''
LONG TRADE952,750,25
24.3.2015 19:20:00 Entered internal PlaceOrder() method at 24.3.2015 19:20:00: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=965,50 StopPrice=0 SignalName='PROFIT TARGET' FromEntrySignal=''
24.3.2015 19:20:00 Amended open order: Action=Sell OrderType=Limit Quantity=1 LimitPrice=965,50 StopPrice=0 SignalName=PROFIT TARGET' FromEntrySignal=''
24.3.2015 19:20:00 Entered internal PlaceOrder() method at 24.3.2015 19:20:00: BarsInProgress=0 Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=940,50 SignalName='STOP LOSS' FromEntrySignal=''
24.3.2015 19:20:00 Amended open order: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=940,50 SignalName=STOP LOSS' FromEntrySignal=''
25.3.2015 19:20:00 Cancelled pending exit order, since associated position is closed: Order='NT-00020/Sim101' Name='PROFIT TARGET' State=Working Instrument='ZS 11-15' Action=Sell Limit price=965,5 Stop price=0 Quantity=1 Strategy='StrategyThree' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='44966be7f6ce492689259716b66ab447' Gtd='1.12.2099 0:00:00'


I am quite confused, since sometimes it set stop orders correctly, sometimes it ommits... :s

Could please somebody tell me what is wrong with the code?

Thank you

Reply With Quote
 
  #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.

 
  #3 (permalink)
Elite Member
Ostrava, Czech Republic
 
Futures Experience: Beginner
Platform: Ninja trader
Favorite Futures: currency
 
Posts: 9 since Mar 2015
Thanks: 4 given, 0 received


problem fixed

Reply With Quote
 
  #4 (permalink)
Elite Member
Muscat, Oman
 
Futures Experience: Intermediate
Platform: Ninja and MT4
Favorite Futures: Forex
 
Posts: 17 since Apr 2012
Thanks: 4 given, 3 received

Can you share what you did to fix so we could learn as well?

Sent from my HUAWEI MT7-TL10 using Tapatalk

Reply With Quote
 
  #5 (permalink)
Elite Member
Ostrava, Czech Republic
 
Futures Experience: Beginner
Platform: Ninja trader
Favorite Futures: currency
 
Posts: 9 since Mar 2015
Thanks: 4 given, 0 received


stearno View Post
Can you share what you did to fix so we could learn as well?

Sent from my HUAWEI MT7-TL10 using Tapatalk

i had wrongly set exit orders and entryhandling

When i entered in the 1st trade, my exitorders were set according to ExitLimitLong and ExitLimitStops in block OnOrderUpdate. The problem was, when i entered in the 2nd trade and had still opened 1st position, i called again the same IOrders from OnOrderUpdates which have already set SL/TP for the 1st position, so that my exit orders were amended.
 
Code
24.3.2015 19:20:00 Entered internal PlaceOrder() method at 24.3.2015 19:20:00: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=965,50 StopPrice=0 SignalName='PROFIT TARGET' FromEntrySignal=''
24.3.2015 19:20:00 Amended open order: Action=Sell OrderType=Limit Quantity=1 LimitPrice=965,50 StopPrice=0 SignalName=PROFIT TARGET' FromEntrySignal=''
24.3.2015 19:20:00 Entered internal PlaceOrder() method at 24.3.2015 19:20:00: BarsInProgress=0 Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=940,50 SignalName='STOP LOSS' FromEntrySignal=''
24.3.2015 19:20:00 Amended open order: Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=940,50 SignalName
Also my entryhandlig was set as 100entries per direction

 
Code
EntriesPerDirection = 100;
 EntryHandling = EntryHandling.AllEntries;

I changed entryhandling as i can be only in one trade in a time and then everything was ok.

Reply With Quote
 
  #6 (permalink)
Elite Member
Muscat, Oman
 
Futures Experience: Intermediate
Platform: Ninja and MT4
Favorite Futures: Forex
 
Posts: 17 since Apr 2012
Thanks: 4 given, 3 received

Thank you. I don't know much on this system of order handling so it helps to read your words.

Sent from my HUAWEI MT7-TL10 using Tapatalk

Reply With Quote
 
  #7 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,859 since Jun 2009
Thanks: 480 given, 3,254 received

It'd be easier to just use SetProfitTarget() and SetStopLoss() at 50 ticks each.

Reply With Quote
 
  #8 (permalink)
Elite Member
Ostrava, Czech Republic
 
Futures Experience: Beginner
Platform: Ninja trader
Favorite Futures: currency
 
Posts: 9 since Mar 2015
Thanks: 4 given, 0 received


shodson View Post
It'd be easier to just use SetProfitTarget() and SetStopLoss() at 50 ticks each.

Yes, SetStopLoss and SetProfitTarget would be easier, but i used IOrders to be more flexible in my exit orders.

Reply With Quote

Reply



futures io > > > > > IOrders - ExitOrders problem

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
IOrders not firing correctly? SodyTexas NinjaTrader 1 October 16th, 2014 12:36 PM
Increasing Traded Quantity AND IORDERS benwincky NinjaTrader Programming 1 September 29th, 2013 09:06 AM
Using IOrders and setting stops problems spinnybobo NinjaTrader Programming 4 June 6th, 2013 05:30 PM
IOrders TrailStop MXASJ NinjaTrader Programming 3 January 13th, 2012 08:58 AM
could be a problem websouth Off-Topic 11 February 1st, 2010 02:04 PM


All times are GMT -4. The time now is 03:25 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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 2017-12-13 in 0.10 seconds with 20 queries on phoenix via your IP 54.226.132.197