Last active
October 23, 2023 03:12
-
-
Save syuraj/0017d3c7b1288070f200c0df108359d2 to your computer and use it in GitHub Desktop.
HTF Candle R1.2 by JustUncleL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=5 | |
indicator("HTF Candle R1.2 by JustUncleL", shorttitle="HTF Candle", overlay=true) | |
// | |
// Author: JustUncleL | |
// Date: 9-Nov-2017 | |
// Version: R1.2 | |
// | |
// Description: | |
// This indicator creates a representation of a Higher Time Frame (HFT) which is overlayed | |
// onto the Current chart. You can optionally show Body and/or Wicks. | |
// | |
// Warning: Be aware the current HTF candle does not back update the bar representaion | |
// and chart needs be refreshed to update properly. I don't know of a way around | |
// this issue. | |
// | |
// | |
// Mofidifications: | |
// | |
// R0.# : Original alpha unpublished versions. | |
// | |
// R1.2 : Original beta published version. | |
// | |
// R2.0 : Original Published versions. | |
// | |
// | |
// References: | |
// | |
// | |
// ----------------------------------------------------------------------------- | |
// Copyright 2017 JustUncleL | |
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// any later version. | |
// | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// GNU General Public License for more details. | |
// | |
// The GNU General Public License can be found here | |
// <http://www.gnu.org/licenses/>. | |
// | |
// ----------------------------------------------------------------------------- | |
// | |
// | |
// === INPUTS === | |
resoln = input.timeframe("240", title="HTF Candle Resolution") | |
sBody = input.bool(true, title="Show HTF Candle Body ") | |
sWick = input.bool(true, title="Show HTF Candle Wick ") | |
// === /INPUTS === | |
// === SERIES === | |
// | |
open_ = request.security(syminfo.tickerid, resoln, open,barmerge.gaps_off, barmerge.lookahead_on) | |
close_ = request.security(syminfo.tickerid, resoln, close,barmerge.gaps_off, barmerge.lookahead_on) | |
high_ = request.security(syminfo.tickerid, resoln, high,barmerge.gaps_off, barmerge.lookahead_on) | |
low_ = request.security(syminfo.tickerid, resoln, low,barmerge.gaps_off, barmerge.lookahead_on) | |
hl2_ = (high_+low_)/2.0 | |
// | |
newBar = ta.change(open_) == 1 | |
// | |
// === /SERIES === | |
// === PLOTTING === | |
// | |
// Build HTF body representation | |
colour = close_ >= open_ ? color.new(color.green,80) : color.new(color.red,80) | |
po = plot(sBody?open_:na, color=newBar?na:colour, title="HTF Open") | |
pc = plot(sBody?close_:na, color=newBar?na:colour, title="HTF Close") | |
fill(po, pc, color=colour, title="Fill Colour Body") | |
// Build HTF top Wick | |
top_ = sBody? close_ >= open_ ? close_ : open_ : hl2_ | |
pt = plot(sWick?top_ :na, color=newBar?na:color.new(color.gray, transp=100), title="HFT Top Body Line") | |
ph = plot(sWick?high_:na, color=newBar?na:color.new(color.gray, transp=20), title="HTF High Line") | |
fill(pt, ph, color=color.new(color.gray, transp=90), title="Fill Top Wick") | |
// Build HTF bottom Wick | |
bot_ = sBody? close_ <= open_ ? close_ : open_ : hl2_ | |
pb = plot(sWick?bot_:na, color=newBar?na:color.new(color.gray, transp=100), title="HTF Bottom Body Line") | |
pl = plot(sWick?low_:na, color=newBar?na:color.new(color.gray, transp=20), title="HTF Low Line") | |
fill(pb, pl, color=color.new(color.gray, transp=90), title="Fill Bottom Wick") | |
// === /PLOTTING === | |
//eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment