Etherist![]() Member ![]() Posts: 25 Joined: 6/9/2024 Location: South Australia ![]() | Here's a potential exit strategy using the RhinoHull Moving Average (RHMA) with a parameter of 10, where the exit condition is based on a change in the RhinoHull indicator from up (blue) to down (red). Exit Long Trade Using RhinoHull Indicator: ======================================================================== ' Define the RhinoHull parameters Dim RHMAPeriod As Integer RHMAPeriod = 10 ' Calculate the RhinoHull Moving Average Dim RhinoHullMA As Series RhinoHullMA = RhinoHull(Close, RHMAPeriod) ' Check the color change condition for RhinoHull MA Dim CurrentColor As String Dim PreviousColor As String If RhinoHullMA > RhinoHullMA[1] Then CurrentColor = "Blue" Else CurrentColor = "Red" End If If RhinoHullMA[1] > RhinoHullMA[2] Then PreviousColor = "Blue" Else PreviousColor = "Red" End If ' Exit long trade condition: Change from Blue to Red If PreviousColor = "Blue" And CurrentColor = "Red" Then ExitLong("Exit Long Trade", "RhinoHull Color Change") End If ====================================================================== Explanation 1. Define Parameters: - `RHMAPeriod`: The period for the RhinoHull Moving Average. In this case, it is set to 10. 2. Calculate RhinoHull Moving Average: - `RhinoHullMA`: Calculate the RhinoHull MA using the `RhinoHull` function with the close prices and specified period. 3. Determine Current and Previous Color: - `CurrentColor`: Assign "Blue" if the current RhinoHull MA is greater than the previous value, otherwise assign "Red". - `PreviousColor`: Assign "Blue" if the previous RhinoHull MA is greater than the value before it, otherwise assign "Red". 4. Exit Long Trade Condition: - Exit the long trade if the `PreviousColor` was "Blue" and the `CurrentColor` is "Red". This indicates a change from up (blue) to down (red). Customisation and Use: - Customisation: Adjust the `RHMAPeriod` to suit your specific trading strategy. - Use: Implement this script in OmniTrader to automatically exit long trades based on the RhinoHull MA color change. This script will ensure that you exit a long trade when the trend detected by the RhinoHull Moving Average changes from up to down, helping manage risk and potentially improve trading performance. [Edited by Etherist on 6/10/2024 5:57 AM] |