Skip to main content Skip to footer
Exit OnBarUpdate Event Handler

 

The Exit OnBarUpdate event handler allows the strategy to break execution within the OnBarUpdate method, effectively acting as a return statement. This functionality is essential for controlling the flow of the strategy, enabling it to exit early under certain conditions.

 

Functionality

 

By using the Exit OnBarUpdate event handler, traders can introduce logic to terminate the OnBarUpdate procedure when specific criteria are met. This is useful for scenarios where continuing the execution would be unnecessary or could lead to undesired outcomes.

 

Example Use Case

 

Consider a situation where the strategy should stop processing if a certain condition is met, such as the IsDisabled parameter being true. By placing an Exit OnBarUpdate event handler at the appropriate point in the algo tree, the strategy can exit the OnBarUpdate method as soon as this condition is detected.

Implementation

 

To implement the Exit OnBarUpdate event handler:

  1. Identify the Condition: Determine the condition under which the OnBarUpdate execution should be exited.

  2. Insert the Exit Handler: Place the Exit OnBarUpdate event handler in the algo tree at the point where the condition should be checked.

  3. Define the Condition: Use an if-then statement or similar logic to check the condition. If the condition is met, the Exit OnBarUpdate event handler will break the execution.

 

Conclusion

 

The Exit OnBarUpdate event handler is a powerful tool for managing the execution flow within the OnBarUpdate method of a strategy. By allowing early termination based on specific conditions, it enhances the strategy's control and efficiency, ensuring that unnecessary processing is avoided. This feature is particularly valuable for creating robust and responsive trading strategies in FinStudio.

Cookies Notice

We use cookies to improve your experience, personalize content, and analyze our traffic. By clicking "Accept All Cookies," you agree to the storing of cookies on your device. You can manage your cookie preferences at any time by visiting our Cookie Settings.