IOrders - ExitOrders problem - futures io
futures io futures trading



IOrders - ExitOrders problem


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one FILIP88 with 4 posts (0 thanks)
    2. looks_two stearno with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 shodson with 1 posts (0 thanks)
    1. trending_up 1,027 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

IOrders - ExitOrders problem

(login for full post details)
  #1 (permalink)
Ostrava, Czech Republic
 
Experience: Beginner
Platform: Ninja trader
Trading: currency
 
Posts: 9 since Mar 2015
Thanks: 4 given, 0 received

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.



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

Started this thread Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
Ostrava, Czech Republic
 
Experience: Beginner
Platform: Ninja trader
Trading: currency
 
Posts: 9 since Mar 2015
Thanks: 4 given, 0 received


problem fixed

Started this thread Reply With Quote
 
(login for full post details)
  #4 (permalink)
Muscat, Oman
 
Experience: Intermediate
Platform: Ninja and MT4
Trading: Forex
 
Posts: 15 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
 
(login for full post details)
  #5 (permalink)
Ostrava, Czech Republic
 
Experience: Beginner
Platform: Ninja trader
Trading: 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.

Started this thread Reply With Quote
 
(login for full post details)
  #6 (permalink)
Muscat, Oman
 
Experience: Intermediate
Platform: Ninja and MT4
Trading: Forex
 
Posts: 15 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
 
(login for full post details)
  #7 (permalink)
OC, California, USA
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,958 since Jun 2009
Thanks: 528 given, 3,648 received

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

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #8 (permalink)
Ostrava, Czech Republic
 
Experience: Beginner
Platform: Ninja trader
Trading: 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.

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > IOrders - ExitOrders problem


Last Updated on September 21, 2015


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 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