English
Back
No matches yet
Operations too frequent. Please try again later.
Please check network settings and try again Refresh Refresh
Loading
History record delete
    Quotes All >
      News All >
        Log in to access Online Inquiry
        Back to the Top

        How to build a strategy as a newbie

        If you have a good idea, you may wonder how to realize it and quickly build a strategy on the canvas.


        1. How to build a simple strategy to open and close positions only

        First of all, we must identify the conditions under which we want the strategy to open and close positions.

        Let's take the Double Moving Average (Double MA) strategy as an example. The Double MA strategy is to buy when the shorter-term moving average (MA) above the longer-term MA, and sell when the shorter-term MA crosses below the longer-term MA.

        With this idea in mind, let's quickly figure out the paths to open and close positions. The upper path is to determine when to open positions, while the lower path, to close positions.

        When MA(5) is above MA(10), open a position; when MA(5) is below MA(10), close all positions.

        But this strategy is not yet perfect. There is a serious problem:

        MA(5) may be continuously above MA(10) (golden cross) when the stock price is rising. If a position is opened every time it is determined that this condition is met, it won’t be long before your cash is used up(and margin may even be used), which is not what we expected.

        If MA(5) is above MA(10) all the time, we would like to buy once only. Similarly, if MA(5) is always below MA(10) (dead cross), we also wish to close positions only once.

        How can we achieve this?

        All we need is to add a condition to determine whether there is any position: The strategy determines whether to open a position only when there is no position, and whether to close a position only when there is a position.

        In this way, when the condition to open a position is met and the position is opened, we will hold the underlying stock in our position, and then the yellow path will run and there will be no repeated opening of positions.

        In order to make the whole strategy more robust, we add a condition on buying power before opening a position to ensure that the order will not fail due to insufficient buying power.

        With this idea in mind, you may find our Double MA strategy not so hard to understand.

        By summarizing the above idea into a methodology, we get a general template for simple strategies to open and close positions.

        To create similar strategies later, you only need to apply the template and fill in the corresponding conditions to open and close positions.


        2. How to set an adding-to-positions condition

        It is very simple to build a strategy to add to positions. Just add the green part to the original strategy. When the condition to close positions is not met, the strategy will determine whether the condition to add to positions is met. If this condition is met, an order can be placed to add to positions.

        Of course, don’t forget to make this condition to iterateat the end in case it is continuously met and the strategy will soon use up our cash.


        3. How to set take-profit and stop-loss conditions

        It is also very simple to build a strategy to take profit and stop loss. Just replace the condition to close positions with the condition to take profit and close position as shown in the yellow part, and then add a similar path as shown in the purple part.

        When the condition to take profit and close position is not met, the strategy will determine whether the condition to stop loss is met. If this condition is met, all positions can be closed.


        4. How to set an adding-to-positions condition and take-profit and stop-loss conditions

        By integrating the purple part (stop-loss condition) and the green part (adding-to-positions condition) above, we get a template for a strategy that can not only add to positions, but also take profit and stop loss.

        When there is a position, the strategy first determines whether the condition to take profit and close positions is met; if so, it will take profit (close all positions). If that condition is not met, the strategy determines whether the condition to stop loss and close positions is met; if so, it will stop loss (close all positions). If that condition is not met, the strategy determines whether the condition to add to positions is met; if so, it will place an order to add to the positions and make theadding-to-positions condition to iterate.


        This presentation is for informational and educational use only and is not a recommendation or endorsement of any particular investment or investment strategy. Investment information provided in this content is general in nature, strictly for illustrative purposes, and may not be appropriate for all investors.  It is provided without respect to individual investors’ financial sophistication, financial situation, investment objectives, investing time horizon, or risk tolerance. You should consider the appropriateness of this information having regard to your relevant personal circumstances before making any investment decisions. Past investment performance does not indicate or guarantee future success. Returns will vary, and all investments carry risks, including loss of principal. Moomoo makes no representation or warranty as to its adequacy, completeness, accuracy or timeliness for any particular purpose of the above content.