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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    549 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X