Advanced Strategy Writing - futures io
futures io futures trading



Advanced Strategy Writing


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zeller4 with 4 posts (1 thanks)
    2. looks_two gregid with 2 posts (0 thanks)
    3. looks_3 traderwerks with 1 posts (0 thanks)
    4. looks_4 midasman with 1 posts (0 thanks)
    1. trending_up 4,493 views
    2. thumb_up 1 thanks given
    3. group 6 followers
    1. forum 8 posts
    2. attach_file 0 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
 

Advanced Strategy Writing

(login for full post details)
  #1 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Hello all,

I've been reading (and re-reading) the sections in the NT support helpguide in the Advance Event Driven Programming Section. ie: http://ww25.ninjatrader-support.com/HelpGuideV6/helpguide.html?OnExecution&subid1=20210301-1007-565a-a8c3-d32043d5126f

Does anyone have a comprehensive sample strategy that you could share which incorporates the various functions:

IOrder
IExecution
IPosition
OnOrderUpdate

Here's a snippet from the NT website which tells me I need to understand the use of these advanced functions together:
Quoting 

/*CRITICAL: If you want to drive your strategy logic based on order fills
you must use OnExecution() instead of OnOrderUpdate().
OnExecution() is always triggered after OnOrderUpdate().
There is internal strategy logic that is triggered after
OnOrderUpdate() is called but before OnExecution()
that can adversely affect your strategy if you are relying on
tracking fills within OnOrderUpdate(). */

The samples on the NT fileshare are the "Lite" version which typically only include the small sample of the syntax with the tie-in to the OnBarUpdate main section. Finding the "Needle In The Haystack" of how orders flow in one file is what i'm hoping someone will share. I understand there is an order flow with priorities of the internal workings of NT that are not revealed.

Any help or reference you can provide is much appreciated.

Regards,
Kirk

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)
  #2 (permalink)
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 320 given, 620 received

I definitely wouldn't seek advice from myself in this matter, but have you checked some sample strategies here at futures.io (formerly BMT)?:



If I remember it correctly they include OnOrderUpdate and OnPositionUpdate but they are not really well commented (and most of the comments are in Italian anyway)

Good luck and if you would find anything helpful please post!

Reply With Quote
 
(login for full post details)
  #3 (permalink)
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received


Hey let me know if this helps ....

#region Variables
private IOrder myLongorder = null;
private IOrder myShortorder = null;

#endregion


protected override void OnExecution(IExecution execution) //
{
//oderhandling(IOrder order);



if (execution.MarketPosition == MarketPosition.Long )
{

CancelOrder(myAskorder);
}

else
{

CancelOrder(myBidorder);
}



}

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

thanks gregid,
all of those files (from the Italian connection!) had some good script on IPosition and one had an IOrder section -i'll check them out further... I did a quick market replay and didn't have any orders placed so I'm not sure how to get some results to verify....

The other thing that makes me wonder is if IExecution were added to any of these files, what would be the manner to tie them all together???

Any other leads or assistance is greatly appreciated.
kz

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 320 given, 620 received

Hi Kirk

Were you able to find any other sample strategies with IOrders? I still struggle trying to making these work as I need them.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Hi gregid,

Not yet - nothing new with IOrder....

I've been working with a trailing stop strat that actually moves the trailing stop with a visual marker and now i'm trying to emulate the breakeven feature of ATMs.

hope to be able to share more soon.

kz

Started this thread Reply With Quote
The following user says Thank You to zeller4 for this post:
 
(login for full post details)
  #7 (permalink)
lexinton, sc
 
Experience: Intermediate
Platform: ninjatrader
Broker: mirus/zen-fire
Trading: ES
 
Posts: 5 since Oct 2009
Thanks: 4 given, 3 received

Hello, interested in trailing stop in ninja strategy... i have been struggling with it for awhile, is there a way to set a trailing stop that adjusts with an indicator, say parabolicSAR +/- 1 tick on ES. I can't seem to get trailing stop to reset after the first order is executed. Also, you mentioned a visual way to see trailing stop, where or how do you track a trailing stop while order is running? I looked at ninja support/help but just don't get it, not a programmer, just trying to simulate/test my strategy performance.
thanks

Reply With Quote
 
(login for full post details)
  #8 (permalink)
Taipei Taiwan
 
Experience: Advanced
Platform: NinjaTrader
Broker: AMP Clearing
Trading: TW
 
Posts: 693 since Jun 2009
Thanks: 434 given, 464 received

IOrder, IExecution, IPosition, OnOrderUpdate

These are all great for advanced risk management. Just work through the examples, and it will get pretty easy.

I have written crazy risk management stuff using the advanced features so there is a lot of flexibility there.

Reply With Quote
 
(login for full post details)
  #9 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received


traderwerks View Post
IOrder, IExecution, IPosition, OnOrderUpdate

These are all great for advanced risk management. Just work through the examples, and it will get pretty easy.

I have written crazy risk management stuff using the advanced features so there is a lot of flexibility there.

Thanks traderwerks

If I remember right, you're a programmer from Chicago??? . I spoke to you about a project last year....

I guess the thing that would eliminate the confusion for me is if a template including all four of these in basic form is available. for example, is the sequence critical? Do I need to use return statements within the different functions? Does OnBarUpdate include only a couple lines with the bulk of the code going in the other I...xyz functions?
thanks for any basic format you could offer.
Kirk

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Advanced Strategy Writing


Last Updated on December 27, 2009


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