Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TriggerCustomEvent()

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

    TriggerCustomEvent()

    Hello,

    what does this method do? Can you write me an example (not a code, but situation)?

    The other question: is that true that MyCustomHandler method is not called only in backtest? It meand that in other mode (like simulation data feed) it is called. (It seems to be like this for me in my sample ... i used it in strategy, not in indicator)

    I have read the help, refenrence sample, i made my sample. I see what is happening, but dont understand when it is good to use.

    thank you

    #2
    tamas,

    It is used for if you have very specific needs to trigger events as you define it. If you have no such specific need you do not need to use this method.

    The reference we have is here: http://www.ninjatrader-support2.com/...ead.php?t=5965
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by tamas View Post
      ...Can you write me an example (not a code, but situation)?...
      Here is one Tamas:

      Times ago I wrote an indicator which stored data extracted from the live-stream in an internal data structure. In addition I could save that database to a file, or override/complete it by reading from that file. I initiated this procedure by a context menu. I implemented this functionality with the TriggerCustomEvent to avoid access conficts between the file operation and the live-data stream.

      Regards
      Ralph

      Comment


        #4
        Going From Type "Object" to "Double"

        I'm Trying to use the TriggerCustomEvent in a multi-instrument Strategy that has an indicator in it. What I want to do is, pass the Value of SymbolClose into the MyCustomHandler Function. The Problem is that it won't let me take the value from type "object" to type "double" with the method I'm using.

        Here is a screen shot below of what happens when I try to compile it:

        Can anyone suggest a work-around for this, or is it even possible?

        Yam Digger
        Attached Files

        Comment


          #5
          If your object is a double then you can cast it: (double)state

          Regards
          Ralph

          Comment


            #6
            Originally posted by Ralph View Post
            I implemented this functionality with the TriggerCustomEvent to avoid access conficts between the file operation and the live-data stream.
            Josh, Ralph thank you, but i dont understand

            I ask it inversely: if you dont use this method why will be there access conficts between the file operation and the live-data stream? What would happen?

            Comment


              #7
              Originally posted by tamas View Post
              if you dont use this method why will be there access conficts between the file operation and the live-data stream? What would happen?
              Hi Tamas,

              here are the 2 event chains I intend to syncronise with TriggerCustomEvent:
              - The live-data stream causes NT to call OnBarsUpdate. OnBarsUpdate calls a method which reads data from an internal data structure (IDS), then performs some calculations and writes back the result to the IDS.
              - I trigger a custom event with the context menu of the chart. This event reads data from a file and then calls the same method to process the IDS.

              It is important to prevent a parallel access to that method. Therefore I schedule the access caused by the context menu with TriggerCustomEvent.

              Regards
              Ralph

              Comment


                #8
                Originally posted by Ralph View Post
                Hi Tamas,

                here are the 2 event chains I intend to syncronise with TriggerCustomEvent:
                - The live-data stream causes NT to call OnBarsUpdate. OnBarsUpdate calls a method which reads data from an internal data structure (IDS), then performs some calculations and writes back the result to the IDS.
                - I trigger a custom event with the context menu of the chart. This event reads data from a file and then calls the same method to process the IDS.

                It is important to prevent a parallel access to that method. Therefore I schedule the access caused by the context menu with TriggerCustomEvent.
                I understand ... i think
                Thank you

                Comment


                  #9
                  Originally posted by Ralph View Post
                  If your object is a double then you can cast it: (double)state
                  Thanks Ralph. That did the trick.

                  Yam Digger

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  652 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  370 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  109 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  574 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  577 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X