OPEN-SOURCE SCRIPT

Fibonacci Levels Strategy with High/Low Criteria-AYNET

This code represents a TradingView strategy that uses Fibonacci levels in conjunction with high/low price criteria over specified lookback periods to determine buy (long) and sell (short) conditions. Below is an explanation of each main part of the code:

Explanation of Key Sections
User Inputs for Higher Time Frame and Candle Settings

Users can select a higher time frame (timeframe) for analysis and specify whether to use the "Current" or "Last" higher time frame (HTF) candle for calculating Fibonacci levels.
The currentlast setting allows flexibility between using real-time or the most recent closed higher time frame candle.
Lookback Periods for High/Low Criteria

Two lookback periods, lowestLookback and highestLookback, allow users to set the number of bars to consider when finding the lowest and highest prices, respectively.
This determines the criteria for entering trades based on how recent highs or lows compare to current prices.
Fibonacci Levels Configuration

Fibonacci levels (0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, and 100%) are configurable. These are used to calculate price levels between the high and low of the higher time frame candle.
Each level represents a retracement or extension relative to the high/low range of the HTF candle, providing important price levels for decision-making.
HTF Candle Calculation

HTF candle data is calculated based on the higher time frame selected by the user, using the newbar check to reset htfhigh, htflow, and htfopen values.
The values are updated with each new HTF bar or as prices move within the same HTF bar to track the highest high and lowest low accurately.
Set Fibonacci Levels Array

Using the calculated HTF candle's high, low, and open, the Fibonacci levels are computed by interpolating these values according to the user-defined Fibonacci levels.
A fibLevels array stores these computed values.
Plotting Fibonacci Levels

Each Fibonacci level is plotted on the chart with a different color, providing visual indicators for potential support/resistance levels.
High/Low Price Criteria Calculation

The lowest and highest prices over the specified lookback periods (lowestLookback and highestLookback) are calculated and plotted on the chart. These serve as dynamic levels to trigger long or short entries.
Trade Signal Conditions

longCondition: A long (buy) signal is generated when the price crosses above both the lowest price criteria and the 50% Fibonacci level.
shortCondition: A short (sell) signal is generated when the price crosses below both the highest price criteria and the 50% Fibonacci level.
Executing Trades

Based on the longCondition and shortCondition, trades are entered with the strategy.entry() function, using the labels "Long" and "Short" for tracking on the chart.
Strategy Use
This strategy allows traders to utilize Fibonacci retracement levels and recent highs/lows to identify trend continuation or reversal points, potentially providing entry points aligned with larger market structure. Adjusting the lowestLookback and highestLookback along with Fibonacci levels enables a customizable approach to suit different trading styles and market conditions.
Bands and ChannelseducationalFundamental Analysis

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?


และใน:

คำจำกัดสิทธิ์ความรับผิดชอบ