Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

event handling between indicators and strategies

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    event handling between indicators and strategies

    Hi Guys,

    Is it possible to implement the event delegation pattern between an indicator and a strategy?
    If an indicator shows a trend change e.g. I will be informed in a running strategy.

    I have tried this:

    (indicator class, called "MyCallback")

    ...
    public delegate void CallMe(string message);
    ...
    ...
    public event CallMe CallHandler;


    in the "OnBarUpdate"-method I send via event a message like this:
    if(CallHandler != null)
    {
    CallHandler("something is going on");
    }

    in the strategy class I do this:

    ....
    (Variables)
    private MyCallback callBackMe;

    protected override void Initialize()
    {
    callBackMe = new MyCallback();
    callBackMe += new CallMe(this.GetCalled);
    }

    private void GetCalled(string message)
    {
    Print(...)
    }

    I think that is correct, but ther is no messag eat all!
    Any idea?

    Thanks a lot
    Markus

    #2
    Hi Markus,

    I do not think you need to use delegation. In your indicator you can just expose some properties that contain information on the state of the trend. From your strategy you can access those properties and get the information you need. Please check out this reference sample: http://www.ninjatrader-support.com/v...ead.php?t=4991
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    125 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    105 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    84 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    104 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    83 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X