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 varsha, Today, 06:33 PM
    0 responses
    9 views
    0 likes
    Last Post varsha
    by varsha
     
    Started by NtFan, Today, 04:12 PM
    1 response
    8 views
    0 likes
    Last Post NtFan
    by NtFan
     
    Started by futurenow, Today, 01:44 PM
    2 responses
    38 views
    0 likes
    Last Post voltation  
    Started by Gerik, Today, 12:44 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by autogenix, Today, 01:01 PM
    3 responses
    20 views
    0 likes
    Last Post NinjaTrader_Emily  
    Working...
    X