Header Ads

  • Ticker News

    Robo Scanner How to Use 123 Reversal Pattern in Trading


    The "123 Rule" strategy is a simple yet effective approach in forex trading that involves identifying specific price patterns after a decline. The pattern consists of three consecutive lower lows, followed by two consecutive higher lows. This strategy aims to capture potential trend reversals or the beginning of an upward movement. 

    Here's a brief overview of the "123 Rule" strategy:

    Strategy Components:

    • Three Lower Lows: The first part of the pattern involves identifying three consecutive lower lows. This indicates a downtrend or price decline.
    • Two Higher Lows: After the three lower lows, the pattern forms when two consecutive higher lows occur. This suggests that the downtrend might be losing momentum and a potential reversal or upward movement could be underway.

    Strategy Implementation:

    • Identify the Pattern: Look for the sequence of three lower lows followed by two higher lows on the price chart.
    • Pattern Confirmation: The "123 Rule" pattern is more reliable when combined with other technical indicators or candlestick patterns that suggest a potential reversal.
    • Entry Point: Once the pattern is confirmed, traders often enter a long (buy) position at or above the second higher low. This is considered a potential point of reversal.
    • Stop Loss: Place a stop loss below the lowest low within the pattern. This aims to limit potential losses if the price continues to decline.
    • Take Profit: Determine a take profit level based on technical analysis, recent price movements, or predefined risk-to-reward ratios.


    • Simplicity: The "123 Rule" strategy is easy to identify on price charts, making it accessible for traders of different experience levels.
    • Potential Trend Reversal: The pattern suggests a potential reversal in the prevailing downtrend, allowing traders to enter the market early in an emerging uptrend.


    • Confirmation: Combining the "123 Rule" pattern with other technical analysis tools or candlestick patterns can enhance its reliability.
    • False Signals: Not every "123 Rule" pattern leads to a successful trade. It's important to practice prudent risk management to protect capital.
    • Practice: Like any trading strategy, the "123 Rule" requires practice and experience to identify and execute effectively.

    As with any trading strategy, traders should thoroughly backtest the "123 Rule" on historical data, practice it on a demo account, and consider risk management principles before applying it in a live trading environment.

    Explain the code

    The code is written in Pine Script, which is a programming language specifically designed for creating trading strategies on the TradingView platform.

    The strategy is named "123 rules" and has some initial configuration settings such as title, commission, slippage, etc.

    The code defines some variables, including lowest_price (lowest price of the past 200 bars), highest_price (highest price of the past 200 bars), min_800 (lowest price of the past 800 bars), max_800 (highest price of the past 800 bars), tp_target (take profit target calculated based on the range between min_800 and max_800 using the 1.618 Fibonacci extension), sl (stop loss calculated as 0.5% below the lowest price), and rrr (risk-reward ratio calculated as the difference between tp_target and sl divided by sl).

    Moving averages are also calculated using the ta.sma function for a period of 10 and 20.

    The Ichimoku Cloud's Base Line is calculated using the donchian function for a specified period length (26 by default) and plotted on the chart.

    The code determines the current trend based on whether the closing price is above the Base Line.

    Several conditions (con_a to con_e) are defined for the entry signal. These conditions check whether the current price is higher than the lowest price, highest price, 200-period simple moving average, and if the current trend is an uptrend. Additionally, it checks if the calculated risk-reward ratio is greater than 3.

    A boolean variable LongOpen is set to true if at least 4 of the entry conditions are met.

    If there is no open position (strategy.position_size == 0) and the LongOpen condition is true, a long position is opened using the strategy.entry function. The quantity of shares to be bought is calculated as strategy.initial_capital/close[0].

    If there is an open position (strategy.position_size > 0), the code checks the exit conditions. If the take profit condition (con_h > 0) is met, a take profit order is placed using the strategy.exit function. If the conditions for closing the position (con_f or con_g) are met (prices below SMA10 and SMA20 or below the lowest price minus 0.5%), the position is closed using the strategy.close_all function.

    Finally, the moving average for the 200-period simple moving average is plotted on the chart.

    This code implements a basic trading strategy based on the "123 Rule," where multiple conditions are checked for entry and exit signals to generate buy and sell signals.

    Copypaste code to your Tradingview Strategy Tester

    // ©Myo
     title                  =   "123 rules",
     shorttitle             =   "123 rules",
     overlay                =   true, 
     max_lines_count        =   500, 
     max_labels_count       =   500, 
     precision              =   3, 
     default_qty_type       =   strategy.cash, 
     commission_value       =   0.05, 
     commission_type        =   strategy.commission.percent, 
     slippage               =   0, 
     currency               =   currency.USD, 
     default_qty_value      =   100, 
     initial_capital        =   100)
    // var
    lowest_price = ta.lowest(low, 200)
    highest_price = ta.highest(high, 200)
    min_800 = ta.lowest(low, 800)
    max_800 = ta.highest(high, 800)
    tp_target = min_800 + (max_800 - min_800) * math.rphi
    sl = lowest_price * (1 - 0.005)
    rrr = tp_target - sl / sl
    int share_number = input.int (3, "number of shares")
    SMA10 = ta.sma(close, 10)
    SMA20 = ta.sma(close, 20)
    basePeriods = input.int(26, minval=1, title="Base Line Length")
    donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
    baseLine = donchian(basePeriods)
    plot(baseLine, color=#B71C1C, title="Base Line")
    // Trend
    trend = request.security(syminfo.tickerid, "D", baseLine)
    isUptrend = false
    isDowntrend = false
    if close[0] > baseLine
        isUptrend := true
    // Condition
    // entry
    con_a = low > lowest_price ? 1 : 0
    con_b = high > highest_price ? 1 : 0
    con_c = close[0] > ta.sma(close, 200) ? 1 : 0
    con_d = isUptrend ? 1 : 0
    con_e = rrr > 3 ? 1 : 0
    // close
    con_f = close < SMA10 and close < SMA20 ? 1 : 0
    con_g = close < ta.lowest(low, 200)[1] * (1 - 0.005) ? 1 : 0
    // exit
    con_h = tp_target
    // Main calculation
    LongOpen = false
    AddPosition = false
    if con_a + con_b + con_c + con_d + con_e >= 4
        LongOpen := true
    // execute
    if strategy.position_size == 0
        if LongOpen
            strategy.entry("Long Open" , strategy.long , comment= "Long Open " + str.tostring(close[0]), qty=strategy.initial_capital/close[0])
    if strategy.position_size > 0
        if con_h > 0
            strategy.exit("TP", comment="TP" + str.tostring(close[0]), qty=strategy.initial_capital*(1/share_number)/close[0], limit = tp_target)
        if con_f > 0 or con_g > 0
            strategy.close_all(comment="Close Long " + str.tostring(close[0]))
    plot(ta.sma(close, 200), color=#e5c212, title="ShortTermTrendLine")
    This script functions as an Expert Advisor (EA) and automatically executes trades based on the "123 Rule" pattern. If the pattern is detected, a buy order is placed on the fifth lowest low in the sequence. Take profit and stop loss levels are set based on the user-defined pip values.

    Keep in mind that this is a simplified example for illustrative purposes. When using EAs in live trading, be sure to conduct thorough testing on a demo account and consider implementing appropriate risk management practices to protect your trading capital.

    Copy this code to your MT4 Editor

    //|                         123RuleExpertAdvisor                    |
    //|                       Copyright 2023, YourNameHere              |
    //|                         http://www.yourwebsite.com               |
    //| This Expert Advisor implements the 123 Rule strategy for buying  |
    //| with take profit and stop loss levels.                          |
    extern int TakeProfitPips = 50;       // Take profit in pips
    extern int StopLossPips = 30;         // Stop loss in pips
    void OnStart()
       double low1 = Low[4]; // 1st lowest low
       double low2 = Low[3]; // 2nd lowest low
       double low3 = Low[2]; // 3rd lowest low
       double low4 = Low[1]; // 4th lowest low
       double low5 = Low[0]; // 5th lowest low
       // Check for the 123 pattern
       if (low1 > low2 && low2 > low3 && low4 < low5)
          double entryPrice = low5; // Buy on the 5th lowest low
          double takeProfitPrice = entryPrice + TakeProfitPips * Point;
          double stopLossPrice = entryPrice - StopLossPips * Point;
          int ticket = OrderSend(Symbol(), OP_BUY, 1, entryPrice, 2, stopLossPrice, takeProfitPrice, "123 Rule Buy", 0, clrNONE);
          if (ticket > 0)
             Print("Buy order opened at price:", entryPrice);

    No comments

    Post Bottom Ad

    Powered by Blogger.