בחירות העורכיםOPEN-SOURCE SCRIPT

Flare

🔶 METHODS


• Pine Script™ introduces methods (1, 2)! Much kuddos for the developers, Tradingview, and all who has worked on it!
• This educational script will show the simplified way of writing built-in methods, not to create a new method.


🔹 Simplified way of writing built-in methods:

· Instead of:


· We now can write it like this:



                                                                  ——————————————————————————————————————————————————————————

· When using [1] sometimes brackets are necessary:

· ->


                                                                  ——————————————————————————————————————————————————————————



🔶 OVERVIEW OF SCRIPT


• The basic principles are:
· Find 1 point (close) x bars back from current bar (settings: 'x close back').
תמונת-בזק

· Create a 'Flare' shaped object from that point to current bar or further (dependable of "Width of Flare").
· Calculate where current close is located versus the Flare lines.
· On that bases, change colour and draw plotshapes.
      · Below bar if current close is located in the upper part of the Flare
      · Above bar if current close is located in the lower part of the Flare
      · Above & Below if located in the middle part of the Flare
         -> Above & Below colours has 3 different colours (adjustable), dependable on the position


🔶 EXAMPLES

· Neutral zone:
תמונת-בזק

תמונת-בזק

· Light Bullish zone:
תמונת-בזק

· Bullish zone:
תמונת-בזק

· Very Bullish / Overbought zone:
תמונת-בזק

· Light Bearish zone:
תמונת-בזק

· Bearish zone:
תמונת-בזק

· Very Bearish / Oversold zone:
תמונת-בזק


🔶 TECHNIQUES


🔹 I. Make a User Defined Type (UDT) Flare, with:

· 5x linefill[] - array of linefill
· int iDir, which captures the direction (current location of close in Flare)
· color cCol, this is a colour variable in relation to the direction.

🔹 II. Different functions will add a new Flare object, and update the values on each bar.

· Explanation of each function can be found in the script.


🔶 EXTRA's

· The input.color() is located in the function set_flare_B(flare obj)
· Best to put the inputs at the beginning of the script, I included this alternative just to show it is possible (but mostly not ideal)
· Background colour (settings: Bgcolor) can be enabled for better visibility of colours

educationalmethods

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

רוצה להשתמש בסקריפ זה בגרף?


LuxAlgo Dev: luxalgo.com
PineCoder: pinecoders.com

- We cannot control our emotions,
but we can control our keyboard -
גם על:

כתב ויתור