return; goes where exactly ?
20.06.2020 21.10

Algorithmic Trading with NinjaTrader


? where leads return; to exactly.
* outside of the method (yellow)
* or outside of the if where return; was invoked (orange)

  • Yuri Zolotarev
    21.06.2020 08:38

    None, return will not the code pass down inside the method. You are getting confused of how the code is executed. The entry point is always the event that is called, in this case it is OnExecutionUpdate. It can also be OnStateChanged, OnBarUpdat etc. From there the code is read following the method calls inside the main even handler ie. OnBarUpdate etc. So the main point is that the code is not read from up to down like a book, it is read in a logical execution procedure.

    When the return is called it takes us out from the method where the return keyword was located, in this case return is located inside the event handler itself therefore the return will take us out of it back into NinjaTrader api.

  • Frank
    21.06.2020 12:09

    k thx i c.

    So when in this case of  OnExecutionUpdate return; brings back the code execution tip to the API of N8, where does it then after that will walk back into my script ?

  • Yuri Zolotarev
    21.06.2020 15:41

    On any other event that follows.