TriggerCustomEvent in another running object - NinjaTrader Programming | futures io social day trading
futures io futures trading


TriggerCustomEvent in another running object
Updated: Views / Replies:1,661 / 5
Created: by vantojo 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
 

TriggerCustomEvent in another running object

  #1 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

TriggerCustomEvent in another running object

This is outside the range of Ninja Support, but perhaps someone here knows and will post....


TriggerCustomEvent(CustomEvent customEvent, int barsIndex, object state)

Is normally used to trigger a user defined method (custom event) inside the same Strategy or Indicator.

However would it be possible for an Indicator running on a Chart to trigger a custom event in a strategy running in Strategy Analyzer?

(I used to code object oriented client server applications, and this was a standard way of executing code in another object., so there must be something in C# that would allow this?)

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
Atkinson, NH USA
 
Futures Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker/Data: NinjaTrader Brokerage
Favorite Futures: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,925 since Dec 2010
Thanks: 2,962 given, 2,294 received



vantojo View Post
This is outside the range of Ninja Support, but perhaps someone here knows and will post....


TriggerCustomEvent(CustomEvent customEvent, int barsIndex, object state)

Is normally used to trigger a user defined method (custom event) inside the same Strategy or Indicator.

However would it be possible for an Indicator running on a Chart to trigger a custom event in a strategy running in Strategy Analyzer?

(I used to code object oriented client server applications, and this was a standard way of executing code in another object., so there must be something in C# that would allow this?)

Thank you

Hi @vantojo,

I have looked for a simple way to do this in the past and thought more about what I was trying to do. I was thinking the Strategy is the controller not the indicator. So I poll or call public functions back to the Indicators to accomplish actions such as that which avoids the "child" driving the parent if you will seemed to make things more complex for me, but I think a new set of standard functions.

If you really wanted to do this, you could use public functions in the Indicator to pass values need for the Callback functions. You can see more about that structure from @anachronist here:
https://futures.io/elite-automated-ninjatrader-trading/15563-njamc-local-order-manager-lom-collaboration-20.html#post244406

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Reply With Quote
 
  #4 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

Signal Generator / Trade Manager relationship

Hi NJAMC,

Thank you...lots to study, it looks like. Will dig into LOM examples it this week.

From a conceptual level:

In my mind I don't see the need to have a parent-child tightly coupled relationship between the Signal Generator and the Trade Manager.

In a way the Signal Generator should be driving the Trade Manager. The Trade Manager should be in a sleep state until it has something to do...that is, a signal wakes it up or it has an active trade to manage.

Otherwise it is wasting CPU cycles doing nothing.

In the case where the Trade Manager is submitting an ATM it has only to submit an order, and perhaps cancel an unfilled order (if a new signal comes in). The ATM would be doing the actual trade management, leaving the Trade Manager to do nothing.

This is not the way Ninja works, of course.

Just some thoughts.

Reply With Quote
 
  #5 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received


vantojo View Post
Hi NJAMC,

Thank you...lots to study, it looks like. Will dig into LOM examples it this week.

From a conceptual level:

In my mind I don't see the need to have a parent-child tightly coupled relationship between the Signal Generator and the Trade Manager.

In a way the Signal Generator should be driving the Trade Manager. The Trade Manager should be in a sleep state until it has something to do...that is, a signal wakes it up or it has an active trade to manage.

Otherwise it is wasting CPU cycles doing nothing.

In the case where the Trade Manager is submitting an ATM it has only to submit an order, and perhaps cancel an unfilled order (if a new signal comes in). The ATM would be doing the actual trade management, leaving the Trade Manager to do nothing.

This is not the way Ninja works, of course.

Just some thoughts.

This is the way I trade exclusively for the past 4 years. All the buttons on the chart are from an indicator. Every button I click sends a text command to the strategy, and the strategy performs that command. Fore example, Pressing the 'Next Bar' button on the chart sends the following command to the strategy '<ATMmgrCmd> CL 09-12, BuyNextBar 1 @ 93.57 +12-93.51~0=9 @6:-3 @12:+6 NoFillCancel_2</ATMmgr>'. This means, put a buy stoplimit for 1 contract at the next bar open (93.57) and manage in the following way stop at 93.51 target +12 ticks At 6 ticks in profit move stop to -3 ticks (@6:-3), at 9 ticks profit move stop to break even (=9) at 12 ticks profit move stop to +6 ticks (@12:+6), if order is not filled after 2 bars cancel the stoplimit entry order (NoFillCancel_2), etc. I can add unlimited number of ATM style trade management just by adding a series of '@x:x' clauses to the command, or changing an open trade management the same way, etc. The communication just using a global style string variable that both the indicator and the strategy can poll and read.

In your Strategy put this code:

public class TradeManagerGlobal {
public static string command = "";
}
...
if ( TradeManagerGlobal.command.Contains("BuyLimit")) ) {
... Parse the string
... Execute commands
TradeManagerGlobal.command=""; // Clear the command, or send back results
}

In your Strategy put this code:

public class TradeManagerGlobal {
public static string command = "";
}
...
if ( TradeManagerGlobal.command.Contains("BuyLimit")) ) {
... Parse the string
... Execute commands
TradeManagerGlobal.command=""; // Clear the command, or send back results
}

In your Indicator put this code:

TradeManagerGlobal.command = "BuyLimit CL 09-12 @ 92.40 Stop=-10 Target=+20 BE=+10.... etc., etc ";

I also add a 1 second wake up timer to my strategy to insure that the strategy execute any command within 1 second of a button press on the chart.

And of course the strategy can communicate any results back to the strategy using the same TradeManagerGlobal.command string, or different similarly defined string variable. Anything can communicate with that strategy, even a chart for a different instrument, if desired.

Attached Thumbnails
TriggerCustomEvent in another running object-cl.jpg  

Last edited by monpere; August 13th, 2012 at 12:04 PM.
Reply With Quote
The following 6 users say Thank You to monpere for this post:
 
  #6 (permalink)
Elite Member
Melbourne
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: MB Trading, Kinetick
Favorite Futures: Forex, AUD/USD
 
Posts: 14 since Aug 2011
Thanks: 9 given, 6 received

Hi Monpere,

Thanks so much for sharing your approach on this.
It works well.


monpere View Post
I also add a 1 second wake up timer to my strategy to insure that the strategy execute any command within 1 second of a button press on the chart.

It would be great if you could provide some more detail on that 1 sec. wake up timer. I don't even know where to start on that one. If you could share the code that would be awesome!

Cheers
Frank

Reply With Quote

Reply



futures io > > > > > TriggerCustomEvent in another running object

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
Error: Object reference not set to an instance of an object. gomad NinjaTrader Programming 11 December 22nd, 2014 09:09 AM
Using Account Object in NinjaTrader maxi NinjaTrader Programming 26 November 20th, 2012 11:49 AM
object name ? sam028 NinjaTrader Programming 3 March 14th, 2011 10:55 AM
Draw object Properties kenz987 NinjaTrader Programming 1 November 10th, 2010 10:48 AM
need help :: cant fix :: Object reference not set to an instance of an object Trader.Jon NinjaTrader Programming 9 November 3rd, 2010 11:55 AM


All times are GMT -4. The time now is 09:22 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-16 in 0.16 seconds with 20 queries on phoenix via your IP 54.83.122.227