FisaWave Theory [FisaCrypto], [10/27/2024 12:35 AM]
Hello today you will help me to create complex tradingview indicator. I don't know about coding at all, so you should give me ready to use code. But listen the indicator is so detailed and complex and there are many phases. Don't do anything until i give you all the detail.

never jump ahead. Don't rush. I will tell you when i'm done. But before listen all the details i will give you.

before starting i should say, every detail is extremely important. And the indicator must strictly include each rule without missing even smallest one.

Swing Structure indicator.

Purpose:
This indicator should accurately identify swing highs and swing lows on the chart, label them, and draw a zigzag pattern based on specific, complex rules.

Key Definitions:

Candle/Bar:
Refers to a single candle or a group of up to 20 consecutive candles with identical high and low prices.
This group must be considered as one candle.

Inside Bar:
A smaller candle or group of up to 20 consecutive candles with identical high and low prices.
This group has a lower high price than the high of a mother larger candle and a higher low price than the low of that same mother larger candle.
The inside bar can be on either side of the larger candle, provided they are direct neighbors without any intervening candles.

Larger Candle:
The larger candle is the direct mother of its inside bar.

Phase 1: Identifying Swing Points.

Rules for Identifying Swing Highs:
Standard Condition:
A swing high is identified when it has one neighboring candle on each side, both with lower high prices than the swing high.
Chart's Beginning Condition:
If there is no left neighbor at the chart's beginning, only the right neighbor is checked.

Rules for Identifying Swing Lows:
Standard Condition:
A swing low is identified when it is surrounded by one neighboring candle on each side, both with higher low prices than the swing low.
Chart's Beginning Condition:
If there is no left neighbor at the chart's start, only the right neighbor is checked.

Inside Bar Rules:

Standard Conditions:
    The high and low of an inside bar must be strictly within the high and low of its mother larger candle.

Exceptions:
    When a Larger Candle on the Right or Left Side is Confirmed as Swing High:
        The inside bar's low can be equal to the same larger candle's low but must not be lower.
        Its high must be lower (not equal) to the larger candle's high.

    When a Larger Candle on the Right or Left Side is Confirmed as Swing Low:
        The inside bar's high can be equal to the same larger candle's high but must not be higher.
        Its low must be higher (not equal) to the larger candle's low.

Inside Bar as Swing High and Swing Low:

If Larger Candle on the Left and Inside Bar on the Right:
    For Swing High:
        The high of the next candle must be lower than the high of the inside bar.
    For Swing Low:
        The low of the next candle must be higher than the low of the inside bar.

If Larger Candle on the Right and Inside Bar on the Left:
    For Swing High:
        The high of the previous candle must be lower than the high of the inside bar.
    For Swing Low:
        The low of the previous candle must be higher than the low of the inside bar.

Special Condition at the Start of the Chart:
    If there is no previous candle to check:
        Both the high and low of the inside bar are identified as swing points.

Phase 2: Labeling Rules.

Rule 1: Dual Swing Points in the Same Candle
    A single candle can be labeled as both a swing high and a swing low if it meets the respective criteria for both swing high and swing low.

Rule 2: Group of Consecutive Candles
    When a swing point consists of a group of up to 20 consecutive candles with identical high and low prices, only the last candle in the group is labeled.

Phase 3: ZigZag Rules.

Rule 1: Handling Dual Swing Points
    If a specific candle is labeled as both a swing high and a swing low:
        Check the previous swing point:
            If the previous swing point is a Swing High:
                The zigzag line should first connect to the swing low of the specific candle and then to the swing high of the same candle.

            If the previous swing point is a Swing Low:
                The zigzag line should first connect to the swing high of the specific candle and then to the swing low of the same candle.

        If it is the first candle on the chart and there is no previous candle to check:
            Check the color of the first candle:
                If it is a bullish candle:
                    The zigzag line should first connect to the swing low of the candle and then to the swing high of the same candle.

                If it is a bearish candle:
                    The zigzag line should first connect to the swing high of the candle and then to the swing low of the same candle.