ninjatrader platform order execution in automatic trading - NinjaTrader | futures io social day trading
futures io futures trading


ninjatrader platform order execution in automatic trading
Updated: Views / Replies:753 / 5
Created: by pepbosch Attachments:0

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
 

ninjatrader platform order execution in automatic trading

  #1 (permalink)
Elite Member
Madrid - Spain
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: CONTINUUM
Favorite Futures: ES, Currency Futures, Forex, oil, gold, EUR/USD, Stocks
 
Posts: 278 since Jun 2014
Thanks: 350 given, 108 received

ninjatrader platform order execution in automatic trading

Hi , I am trying to understand how ninjatrader platform executes the order in automatic trading. Are the orders executed when the signal appears or at the end of the bar?
example: automatic trading in 60 minute chart , I get a buy signal at the middle of the bar, When will the buy order be executed? at next available offer or 30 minutes later when the close of the 60 minute bar?
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
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,501 since Sep 2013
Thanks: 1,706 given, 3,708 received
Forum Reputation: Legendary


If you generate the order when the signal is there (in your case middle of the bar) then the order will be executed at that moment, it means that your piece of code in your strategy should not only be called upon bar close, that is an option you can choose...

The answer is, yes it's possible

The execution of your order will depend on the type of order (market order, or limit order) and what is available at the bid/ask at that moment

Reply With Quote
 
  #4 (permalink)
Elite Member
Madrid - Spain
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: CONTINUUM
Favorite Futures: ES, Currency Futures, Forex, oil, gold, EUR/USD, Stocks
 
Posts: 278 since Jun 2014
Thanks: 350 given, 108 received


rleplae View Post
If you generate the order when the signal is there (in your case middle of the bar) then the order will be executed at that moment, it means that your piece of code in your strategy should not only be called upon bar close, that is an option you can choose...

The answer is, yes it's possible

The execution of your order will depend on the type of order (market order, or limit order) and what is available at the bid/ask at that moment

Fantastic, thank you very much.
Pep

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,501 since Sep 2013
Thanks: 1,706 given, 3,708 received
Forum Reputation: Legendary

Answer
This post has been selected as an answer to the original posters question Answer


pepbosch View Post
Hi , I am trying to understand how ninjatrader platform executes the order in automatic trading. Are the orders executed when the signal appears or at the end of the bar?
example: automatic trading in 60 minute chart , I get a buy signal at the middle of the bar, When will the buy order be executed? at next available offer or 30 minutes later when the close of the 60 minute bar?
thank you

While the bar is building your strategy can be called anytime there is an update in price. This allows you to fire an order 'inside the bar' that is building.

Like : (be carefull as this needs to be efficient and can generate a lot of calls)

 
Code
	protected override void OnMarketData (MarketDataEventArgs e)
		{
			System.TimeSpan NewDuration;			
			
			// ***************************************************
			
			if (e.MarketDataType == MarketDataType.Last)
			{
			if (mylong ==1)
			{
				// e.Time 
				myLastBarTime = e.Time;
				NewDuration = myLastBarTime - myEntryTime;

				// mfe ticks berekenen
				// new MFE ?
			
				if (e.Price > mylongentry)
				{
				if (Math.Min(e.Price,mylongtarget) > mfeval)
					mfeval = Math.Min(e.Price,mylongtarget);
				}
				if (mfeval > mylongentry)
					 mfeticks = Convert.ToInt32 ((mfeval-mylongentry)*myMULTIPLYER);
				
				// 5 minutes passed and never been positive
				// kick out
    			if (NewDuration.Minutes >= 5 && mfeticks == 0)
				{
	
				if (mfeticks == 0)
			    {			
					DebugPrint ("Kill : 5 minutes without any positive ticks *long*");
					ExitLong("Exit trade LU","ATM LU");
					
				}
				} // > 5 minutes and mfe 0
				
				// trade -5 and never been positive
				// kick-out
				if ( (e.Price <= (mylongentry - (7.0 * TickSize))) && mfeticks ==0 )
				{
					DebugPrint ("Kill : -7 ticks without any positive ticks *short*");
					ExitLong("Exit trade LU","ATM LU");

				}
				
				 
			} // we are in long
			
			if ( myshort ==1)
			{
				myLastBarTime = e.Time;
				NewDuration = myLastBarTime - myEntryTime;

     			// mfe ticks berekenen
				// new MFE ?
				if (e.Price < myshortentry)
				{
				 if (Math.Max(e.Price,myshorttarget) < mfeval)
					mfeval = Math.Max(e.Price,myshorttarget);
				}
				if (mfeval < myshortentry)
					 mfeticks = Convert.ToInt32 ((myshortentry - mfeval)*myMULTIPLYER);

    			if (NewDuration.Minutes >= 5 && mfeticks == 0)
				{
			
				if (mfeticks == 0)
			    {			
					DebugPrint ("Kill : 5 minutes without any positive ticks *short*");
			
									// new MAE ?
				    if (e.Price > myshortentry)
			 	    {
					 if (Math.Min(e.Price,myshortstop) > maeval)
						maeval = Math.Min(e.Price,myshortstop);
				    }

					ExitShort("Exit trade LD","ATM LD");

					
				}
				}

				// trade -5 and never been positive
				// kick-out
				if ( e.Price >= (myshortentry + (7.0 * TickSize)) && mfeticks ==0 )
				{
					DebugPrint ("Kill : -7 ticks without any positive ticks *short*");
					
  					if (Math.Min(e.Price,myshortstop) > maeval)
						maeval = Math.Min(e.Price,myshortstop);

					ExitShort("Exit trade LD","ATM LD");
				}
		
				
			} // we are in short
			} // new quote
			
		}
alternatively you can set

CalculateOnBarClose = false;
in your initialize section, then the onBarUpdate will be called on every tick


and then the

 
Code
      /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			
			if (BarsInProgress == 1)
			{
				DebugPrint ("5 minute bar update...");
				return;
			}

	
			// Make sure this strategy does not execute against historical data
			if (Historical)
				return;
		
	
			BarCount++;
			
			
// ............
          // do your logic here -> and set myTradeCondition =1;

			if (myTradeCondition == 1)
			{
   			    DebugPrint("We go short");
			     if (myEntryOrder == null)
				 {
					//myReentry++;

				    // Set order parameters
					DebugPrint ("myEntryOrder == null");
				    SetStopLoss (CalculationMode.Ticks,mySTOPSHORT);
				    SetProfitTarget(CalculationMode.Ticks,myTARGETSHORT);
					myEntryOrder = 	EnterShort("ATM LD");
					barNumberOfOrder = CurrentBar;
					myshortorder = 1;			
				    StoreDataSnapShot ();
				    TradePuntC = myABCD_C;		
			 	 } 
								
				}
			
			
        } // on barupdate

Reply With Quote
The following user says Thank You to rleplae for this post:
 
  #6 (permalink)
Elite Member
Madrid - Spain
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: CONTINUUM
Favorite Futures: ES, Currency Futures, Forex, oil, gold, EUR/USD, Stocks
 
Posts: 278 since Jun 2014
Thanks: 350 given, 108 received


rleplae View Post
While the bar is building your strategy can be called anytime there is an update in price. This allows you to fire an order 'inside the bar' that is building.

Like : (be carefull as this needs to be efficient and can generate a lot of calls)

 
Code
	protected override void OnMarketData (MarketDataEventArgs e)
		{
			System.TimeSpan NewDuration;			
			
			// ***************************************************
			
			if (e.MarketDataType == MarketDataType.Last)
			{
			if (mylong ==1)
			{
				// e.Time 
				myLastBarTime = e.Time;
				NewDuration = myLastBarTime - myEntryTime;

				// mfe ticks berekenen
				// new MFE ?
			
				if (e.Price > mylongentry)
				{
				if (Math.Min(e.Price,mylongtarget) > mfeval)
					mfeval = Math.Min(e.Price,mylongtarget);
				}
				if (mfeval > mylongentry)
					 mfeticks = Convert.ToInt32 ((mfeval-mylongentry)*myMULTIPLYER);
				
				// 5 minutes passed and never been positive
				// kick out
    			if (NewDuration.Minutes >= 5 && mfeticks == 0)
				{
	
				if (mfeticks == 0)
			    {			
					DebugPrint ("Kill : 5 minutes without any positive ticks *long*");
					ExitLong("Exit trade LU","ATM LU");
					
				}
				} // > 5 minutes and mfe 0
				
				// trade -5 and never been positive
				// kick-out
				if ( (e.Price <= (mylongentry - (7.0 * TickSize))) && mfeticks ==0 )
				{
					DebugPrint ("Kill : -7 ticks without any positive ticks *short*");
					ExitLong("Exit trade LU","ATM LU");

				}
				
				 
			} // we are in long
			
			if ( myshort ==1)
			{
				myLastBarTime = e.Time;
				NewDuration = myLastBarTime - myEntryTime;

     			// mfe ticks berekenen
				// new MFE ?
				if (e.Price < myshortentry)
				{
				 if (Math.Max(e.Price,myshorttarget) < mfeval)
					mfeval = Math.Max(e.Price,myshorttarget);
				}
				if (mfeval < myshortentry)
					 mfeticks = Convert.ToInt32 ((myshortentry - mfeval)*myMULTIPLYER);

    			if (NewDuration.Minutes >= 5 && mfeticks == 0)
				{
			
				if (mfeticks == 0)
			    {			
					DebugPrint ("Kill : 5 minutes without any positive ticks *short*");
			
									// new MAE ?
				    if (e.Price > myshortentry)
			 	    {
					 if (Math.Min(e.Price,myshortstop) > maeval)
						maeval = Math.Min(e.Price,myshortstop);
				    }

					ExitShort("Exit trade LD","ATM LD");

					
				}
				}

				// trade -5 and never been positive
				// kick-out
				if ( e.Price >= (myshortentry + (7.0 * TickSize)) && mfeticks ==0 )
				{
					DebugPrint ("Kill : -7 ticks without any positive ticks *short*");
					
  					if (Math.Min(e.Price,myshortstop) > maeval)
						maeval = Math.Min(e.Price,myshortstop);

					ExitShort("Exit trade LD","ATM LD");
				}
		
				
			} // we are in short
			} // new quote
			
		}
alternatively you can set

CalculateOnBarClose = false;
in your initialize section, then the onBarUpdate will be called on every tick


and then the

 
Code
      /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			
			if (BarsInProgress == 1)
			{
				DebugPrint ("5 minute bar update...");
				return;
			}

	
			// Make sure this strategy does not execute against historical data
			if (Historical)
				return;
		
	
			BarCount++;
			
			
// ............
          // do your logic here -> and set myTradeCondition =1;

			if (myTradeCondition == 1)
			{
   			    DebugPrint("We go short");
			     if (myEntryOrder == null)
				 {
					//myReentry++;

				    // Set order parameters
					DebugPrint ("myEntryOrder == null");
				    SetStopLoss (CalculationMode.Ticks,mySTOPSHORT);
				    SetProfitTarget(CalculationMode.Ticks,myTARGETSHORT);
					myEntryOrder = 	EnterShort("ATM LD");
					barNumberOfOrder = CurrentBar;
					myshortorder = 1;			
				    StoreDataSnapShot ();
				    TradePuntC = myABCD_C;		
			 	 } 
								
				}
			
			
        } // on barupdate

Thank you very much. I really appreciate this.
Best.
Pep

Reply With Quote

Reply



futures io > > > > ninjatrader platform order execution in automatic trading

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic stop loss order aha123 eSignal 3 September 10th, 2016 12:58 AM
Profit Target and Stop Loss execution sounds on platform Big Mike Traders Hideout 5 February 20th, 2015 03:20 AM
What is the best trading platform for automatic strategy? banana Platforms and Indicators 6 December 9th, 2012 01:58 PM
Broker for order execution using MC auto+manual trading SPTrading MultiCharts 18 July 9th, 2011 09:40 AM
ORDER FLOW TRADING PLATFORM astrading Platforms and Indicators 4 March 14th, 2011 10:47 PM


All times are GMT -4. The time now is 05:55 PM.

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-15 in 0.10 seconds with 29 queries on phoenix via your IP 54.145.16.43