Skip to content

daichao0805Dev/pine-script-mastery-course

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pine-script-mastery-course

Pine Script Tutorial

    • library - like modules in JS.

    • Otherwise using either indicator() or strategy()

    • Example of powerful built-in functions:

      • The Average True Range (ATR) Formula

        • ATR Formula

        • Simply call with atrValue = ta.atr(14) bilt in function.

    • indicator Pine Script - designed for creating indicators & alerts. Oscillator or MA, etc.

      • Has access to alert functionality.
      • Shares all the same inbuilt functions & variables as strategy scripts.
        • But can not execute buy / sell like strategy.
    • strategy Pine Script - A specialized Pine Script type for backtesting strategies.

      • Does NOT have access to some indicator functions.
      • Limited alert functionality compared to indicators.
      • Better to use indicators for alerts/
      • Has access to strategy.* functions for placing and managing mock trades.
        • type strategy. + CTRL + SPACE (see full list of commands)
    • library - re-usable code of libraries, like modules in JS.

      • (~16:30).

    • User HPotter mentioned in tutorial.
    • Search People or Scripts to find useful indicators/strategies.

    • set shape with plotshape(_bool_, _title_, style=shape.*)

Swing High or Swing Low

// Prepare filters
// Is the current bar the lowest of the last 4  || was the last bar the lowest bar of the last four?
swingLow  = low == ta.lowest(low, 4) or low[1] == ta.lowest(low, 4)
// Is the current bar the highest of the last 4 || was the last bar the highest bar of the last four?
swingHigh = high == ta.highest(high, 4) or high[1] == ta.highest(high, 4)

His Main Indicators

Using Libraries to get Candles

  • Using the zen library, we can tap into candle types like hammer or star
  • Example from Ichimoku Cloud
// Import zen library
import ZenAndTheArtOfTrading/ZenLibrary/2 as zen

// Get candle patterns from zen library:
hammer = zen.isHammer()
star   = zen.isStar()

// Then combine with trade setups
longSignal = aboveIchy and hammer
shortSignal = belowIchy and star
  • Clear up clutter with user input and ternary operator on indicators to turn off
// user input:
displayFullCloud    = input.bool(title="Show Full Cloud?", defval=true)

// ================== Clear up clutter with ternary operator on displayFullCloud == false =========================== //
plot(displayFullCloud ? conversionLine : na, color=#2962FF, title="Conversion Line")
plot(displayFullCloud ? baseLine : na, color=#B71C1C, title="Base Line")
plot(displayFullCloud ? close : na, offset=-displacement + 1, color=#43A047, title="Lagging Span")
// ================== Clear up clutter with ternary operator on displayFullCloud == false =========================== //
    • get the current timeframe (15m, 4h, 1D, etc) of the user's choice with timeframe.period
    • use the time(_timeframe, _period-to-check) function to see if a the current bar is within the defined time range. Here it's used in our custom function isInSession()
      • isInSession(_session) => not na( time(timeframe.period, _session) )
    • array_shift() type method in pine. We get (potentially) a collection of bars and we want the FIRST bar in our "array" as follows:

      • ``
    • array_shift() type method in pine. We get (potentially) a collection of bars and we want the FIRST bar in our "array" as follows:

      • ``
    • How to Start and Stop a period to get the high and low in the desired period (8:05)

      • X

// ==================================================================================================//

To Do

  1. convert int to float.
  2. format open, high, low and close and inter into price param
  3. x
// ==================================================================================================//

git reset HEAD

When you have local changes you don't care about that are preventing you from git pulling down the most recent copy, you can force to ignore local changes and pull down the newest remote version.

To remove local uncommitted changes (even if staged) run these commands: From this Stackoverflow Article

  • git reset --hard HEAD
  • git pull

About

Pine Script Tutorial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors