Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TriggerCustomEvent different in NT8 from NT7?

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

    TriggerCustomEvent different in NT8 from NT7?

    I prefer the way I called a CustomEvent in NT7 because all the samples in NT8 I've seen, the custom event is in-line code.

    In NT7 I had TriggerCustom Event like this...

    protected override void OnMarketData(MarketDataEventArgs e)
    {
    TriggerCustomEvent (new CustomEvent(GetTradeSignal), e);
    }


    protected void GetTradeSignal (MarketDataEventArgs e)
    {
    }


    but I'm getting a compile error in NT8.

    I prefer this way because it makes the code cleaner and easier to read, if the event that is triggered has a lot of code in it...

    1) can I do this in NT8??

    2) looks like I'm missing a using (library)... ??

    #2

    Hello vantojo, thanks for your post.

    NinjaTrader 8's TriggerCustomEvent method takes an Action<object> instead of a CustomEvent. You can define the method then set it as the delegate e.g.

    public void MyMethod()
    {
    Print("here");
    }

    ...

    TriggerCustomEvent((o) => MyMethod(), null);

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Waxavi, Today, 02:10 AM
    0 responses
    3 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by TradeForge, Today, 02:09 AM
    0 responses
    7 views
    0 likes
    Last Post TradeForge  
    Started by Waxavi, Today, 02:00 AM
    0 responses
    2 views
    0 likes
    Last Post Waxavi
    by Waxavi
     
    Started by elirion, Today, 01:36 AM
    0 responses
    4 views
    0 likes
    Last Post elirion
    by elirion
     
    Started by gentlebenthebear, Today, 01:30 AM
    0 responses
    4 views
    0 likes
    Last Post gentlebenthebear  
    Working...
    X