PseudoPlotLibrary "PseudoPlot"
PseudoPlot: behave like plot and fill using polyline
This library enables line plotting by polyline like plot() and fill().
The core of polyline() is array of chart.point array, polyline() is called in its method.
Moreover, plotarea() makes a box in main chart, plotting data within the box is enabled.
It works so slowy to manage array of chart.point, so limit the target to visible area of the chart.
Due to polyline specifications, na and expression can not be used for colors.
1. pseudoplot
pseudoplot() behaves like plot().
//use plot()
plot(close)
//use pseudoplot()
pseudoplot(close)
Pseudoplot has label. Label is enabled when title argument is set.
In the example bellow, "close value" label is shown with line.
The label is shown at right of the line when recent bar is visible.
It is shown at 15% from the left of visible area when recent bar is not visible.
Just set "" if you don't need label.
//use plot()
plot(close,"close value")
//use pseudoplot
pseudoplot(close, "close value")
Arguments are designed in an order as similar as possible to plot.
plot(series, title, color, linewidth, style, trackprice, histbase, offset, join, editable, show_last, display, format, precision, force_overlay) → plot
pseudoplot(series, title, ,linecolor ,linewidth, linestyle, labelbg, labeltext, labelsize, shorttitle, format, xpos_from_left, overlay) → pseudo_plot
2. pseudofill
pseudofill() behaves like fill().
The label is shown(text only) at right of the line when recent bar is visible.
It is shown at 10% from the left of visible area when recent bar is not visible.
Just set "" if you don't need label.
//use plot() and fill()
p1=plot(open)
p2=plot(close)
fill(p1,p2)
//use pseudofill()
pseudofill(open,close)
Arguments are designed in an order as similar as possible to fill.
fill(hline1, hline2, color, title, editable, fillgaps, display) → void
pseudofill(series1, series2, fillcolor, title, linecolor, linewidth, linestyle, labeltext, labelsize, shorttitle, format, xpos_from_left, overlay) → pseudo_plot
3. plotarea and its methods
plotarea() makes a box in main chart. You can set the box position to top or bottom, and
the box height in percentage of the range of visible high and low prices.
x-coordinate of the box is from chart.left_visible_bar_time to chart.right_visible_bar_time,
y-coordinate is highest and lowest price of visible bars.
pseudoplot() and pseudofill() work as method of plotarea(box).
Usage is almost same as the function version, just set min and max value, y-coodinate is remapped automatically.
hline() is also available. The y-coordinate of hline is specified as a percentage from the bottom.
plotarea() and its associated methods are overlay=true as default.
Depending on the drawing order of the objects, plot may become invisible, so the bgcolor of plotarea should be na or tranceparent.
//1. make a plotarea
// bgcolor should be na or transparent color.
area=plotarea("bottom",30,"plotarea",bgcolor=na)
//2. plot in a plotarea
//(min=0, max=100 is omitted as it is the default.)
area.pseudoplot(ta.rsi(close,14))
//3. draw hlines
area.hline(30,linestyle="dotted",linewidth=2)
area.hline(70,linestyle="dotted",linewidth=2)
4. Data structure and sub methods
Array management is most imporant part of using polyline.
I don't know the proper way to handle array, so it is managed by array and array as intermediate data.
(type xy_arrays to manage bar_time and price as independent arrays.)
method cparray() pack arrays to array, when array includes both chart.left_visible_bar_time and chart.right_visible_bar.time.
Calling polyline is implemented as methods of array of chart.point.
Method creates polyline object if array is not empty.
method polyline(linecolor, linewidth, linestyle, overlay) → series polyline
method polyline_fill(fillcolor, linecolor, linewidth, linestyle, overlay) → series polyline
Also calling label is implemented as methods of array of chart.point.
Method creates label ofject if array is not empty.
Label is located at right edge of the chart when recent bar is visible, located at left side when recent bar is invisible.
label(title, labelbg, labeltext, labelsize, format, shorttitle, xpos_from_left, overlay) → series label
label_for_fill(title, labeltext, labelsize, format, shorttitle, xpos_from_left, overlay) → series label
visible_xyInit(series)
make arrays of visible x(bar_time) and y(price/value).
Parameters:
series (float) : (float) series variable
Returns: (xy_arrays)
method remap(this, bottom, top, min, max)
Namespace types: xy_arrays
Parameters:
this (xy_arrays)
bottom (float) : (float) bottom price to ajust.
top (float) : (float) top price to ajust.
min (float) : (float) min of src value.
max (float) : (float) max of src value.
Returns: (xy_arrays)
method polyline(this, linecolor, linewidth, linestyle, overlay)
Namespace types: array
Parameters:
this (array)
linecolor (color) : (color) color of polyline.
linewidth (int) : (int) width of polyline.
linestyle (string) : (string) linestyle of polyline. default is line.style_solid("solid"), others line.style_dashed("dashed"), line.style_dotted("dotted").
overlay (bool) : (bool) force_overlay of polyline. default is false.
Returns: (polyline)
method polyline_fill(this, fillcolor, linecolor, linewidth, linestyle, overlay)
Namespace types: array
Parameters:
this (array)
fillcolor (color)
linecolor (color) : (color) color of polyline.
linewidth (int) : (int) width of polyline.
linestyle (string) : (string) linestyle of polyline. default is line.style_solid("solid"), others line.style_dashed("dashed"), line.style_dotted("dotted").
overlay (bool) : (bool) force_overlay of polyline. default is false.
Returns: (polyline)
method label(this, title, labelbg, labeltext, labelsize, format, shorttitle, xpos_from_left, overlay)
Namespace types: array
Parameters:
this (array)
title (string) : (string) label text.
labelbg (color) : (color) color of label bg.
labeltext (color) : (color) color of label text.
labelsize (int) : (int) size of label.
format (string) : (string) textformat of label. default is text.format_none("none"). others text.format_bold("bold"), text.format_italic("italic"), text.format_bold+text.format_italic("bold+italic").
shorttitle (string) : (string) another label text for recent bar is not visible.
xpos_from_left (int) : (int) another label x-position(percentage from left of chart width), when recent bar is not visible. default is 15%.
overlay (bool) : (bool) force_overlay of label. default is false.
Returns: (label)
method label_for_fill(this, title, labeltext, labelsize, format, shorttitle, xpos_from_left, overlay)
Namespace types: array
Parameters:
this (array)
title (string) : (string) label text.
labeltext (color) : (color) color of label text.
labelsize (int) : (int) size of label.
format (string) : (string) textformat of label. default is text.format_none("none"). others text.format_bold("bold"), text.format_italic("italic"), text.format_bold+text.format_italic("bold+italic").
shorttitle (string) : (string) another label text for recent bar is not visible.
xpos_from_left (int) : (int) another label x-position(percentage from left of chart width), when recent bar is not visible. default is 10%.
overlay (bool) : (bool) force_overlay of label. default is false.
Returns: (label)
pseudoplot(series, title, linecolor, linewidth, linestyle, labelbg, labeltext, labelsize, shorttitle, format, xpos_from_left, overlay)
polyline like plot with label
Parameters:
series (float) : (float) series variable to plot.
title (string) : (string) title if need label. default value is ""(disable label).
linecolor (color) : (color) color of line.
linewidth (int) : (int) width of line.
linestyle (string) : (string) style of plotting line. default is "solid", others "dashed", "dotted".
labelbg (color) : (color) color of label bg.
labeltext (color) : (color) color of label text.
labelsize (int) : (int) size of label text.
shorttitle (string) : (string) another label text for recent bar is not visible.
format (string) : (string) textformat of label. default is text.format_none("none"). others text.format_bold("bold"), text.format_italic("italic"), text.format_bold+text.format_italic("bold+italic").
xpos_from_left (int) : (int) another label x-position(percentage from left of chart width), when recent bar is not visible. default is 15%.
overlay (bool) : (bool) force_overlay of polyline and label.
Returns: (pseudo_plot)
method pseudoplot(this, series, title, linecolor, linewidth, linestyle, labelbg, labeltext, labelsize, shorttitle, format, xpos_from_left, min, max, overlay)
Namespace types: series box
Parameters:
this (box)
series (float) : (float) series variable to plot.
title (string) : (string) title if need label. default value is ""(disable label).
linecolor (color) : (color) color of line.
linewidth (int) : (int) width of line.
linestyle (string) : (string) style of plotting line. default is "solid", others "dashed", "dotted".
labelbg (color) : (color) color of label bg.
labeltext (color) : (color) color of label text.
labelsize (int) : (int) size of label text.
shorttitle (string) : (string) another label text for recent bar is not visible.
format (string) : (string) textformat of label. default is text.format_none("none"). others text.format_bold("bold"), text.format_italic("italic"), text.format_bold+text.format_italic("bold+italic").
xpos_from_left (int) : (int) another label x-position(percentage from left of chart width), when recent bar is not visible. default is 15%.
min (float)
max (float)
overlay (bool) : (bool) force_overlay of polyline and label.
Returns: (pseudo_plot)
pseudofill(series1, series2, fillcolor, title, linecolor, linewidth, linestyle, labeltext, labelsize, shorttitle, format, xpos_from_left, overlay)
fill by polyline
Parameters:
series1 (float) : (float) series variable to plot.
series2 (float) : (float) series variable to plot.
fillcolor (color) : (color) color of fill.
title (string)
linecolor (color) : (color) color of line.
linewidth (int) : (int) width of line.
linestyle (string) : (string) style of plotting line. default is "solid", others "dashed", "dotted".
labeltext (color)
labelsize (int)
shorttitle (string)
format (string) : (string) textformat of label. default is text.format_none("none"). others text.format_bold("bold"), text.format_italic("italic"), text.format_bold+text.format_italic("bold+italic").
xpos_from_left (int) : (int) another label x-position(percentage from left of chart width), when recent bar is not visible. default is 15%.
overlay (bool) : (bool) force_overlay of polyline and label.
Returns: (pseudoplot)
method pseudofill(this, series1, series2, fillcolor, title, linecolor, linewidth, linestyle, labeltext, labelsize, shorttitle, format, xpos_from_left, min, max, overlay)
Namespace types: series box
Parameters:
this (box)
series1 (float) : (float) series variable to plot.
series2 (float) : (float) series variable to plot.
fillcolor (color) : (color) color of fill.
title (string)
linecolor (color) : (color) color of line.
linewidth (int) : (int) width of line.
linestyle (string) : (string) style of plotting line. default is "solid", others "dashed", "dotted".
labeltext (color)
labelsize (int)
shorttitle (string)
format (string) : (string) textformat of label. default is text.format_none("none"). others text.format_bold("bold"), text.format_italic("italic"), text.format_bold+text.format_italic("bold+italic").
xpos_from_left (int) : (int) another label x-position(percentage from left of chart width), when recent bar is not visible. default is 15%.
min (float)
max (float)
overlay (bool) : (bool) force_overlay of polyline and label.
Returns: (pseudo_plot)
plotarea(pos, height, title, bordercolor, borderwidth, bgcolor, textsize, textcolor, format, overlay)
subplot area in main chart
Parameters:
pos (string) : (string) position of subplot area, bottom or top.
height (int) : (float) percentage of visible chart heght.
title (string) : (string) text of area box.
bordercolor (color) : (color) color of border.
borderwidth (int) : (int) width of border.
bgcolor (color) : (string) color of area bg.
textsize (int)
textcolor (color)
format (string)
overlay (bool) : (bool) force_overlay of polyline and label.
Returns: (box)
method hline(this, ypos_from_bottom, linecolor, linestyle, linewidth, overlay)
Namespace types: series box
Parameters:
this (box)
ypos_from_bottom (float) : (float) percentage of box height from the bottom of box.(bottom is 0%, top is 100%).
linecolor (color) : (color) color of line.
linestyle (string) : (string) style of line.
linewidth (int) : (int) width of line.
overlay (bool) : (bool) force_overlay of polyline and label.
Returns: (line)
pseudo_plot
polyline and label.
Fields:
p (series polyline)
l (series label)
xy_arrays
x(bartime) and y(price or value) arrays.
Fields:
t (array)
p (array)
FILL
Will my limit order be filled ?Hi
This is a small script that tries to assess the probability that a limit order sent at x % from the last close will be filled in the next y bars.
It is based on historical data and can be useful to decide where to place your limit orders and to determine how far from the price you can put the limit order to get an X% chance of getting filled.
It displays this result for both long and short entries and you can specify if you want to fill orders with wicks or not.
Composite Cosmetic CandlesThis is effectively version 2 of my script "Candle Fill % Meter", with a few different/more options available in a more compact form. Choose between multiple oscillator sources, # of dividing lines, and solid or gradient candle fill. Once again this script is intended for use with hollow candles! This script enables you to see more information with less screen space taken up, not to mention it looks nice. Labels by last bar also toggleable in the settings.
heikin ashi calculation call with higher timeframe
Hello, guys
This indicater displays the previous value of higher timeframe without request.security() function.
You can change the candle style ( heikinashi or normal) on the set box.
you can choose the higher timeframe also.
I made this to avoid the repainting.
Without Box() function, i only used plotcandle and fill.
It was good fun.
Good luck !!
SUPER Alligator[Gabbo]this indicator serves to differentiate the classic type Line and source of Alligator
There are the classic inputs for the 3 lines ( Jaw , Teeth and Lips ) in addition to the choice of the normal source and the type of line, the choices are:
SMA = Simple moving average
EMA = Exponential moving average
WMA = Weighted moving average
RMA = Rolling moving average
HMA = Hull moving average
JMA = Jurik moving average
DEMA = Double exponential moving average
TEMA = Triple exponential moving average
LSMA = Least squares moving average
VWMA = Volume-weighted moving average
SMMA = Moving average Smoothed
KAMA = Kaufman Moving Average Adaptive
ALMA = Arnaud Legoux moving average
FRAMA = Fractal Adaptive moving average
VIDYA = Variable Index Dynamic Average
There are also Inputs that are valid only for some styles such as:
JMA = "Phase" and "Power"
ALMA = "Offset" and "Sigma"
FRAMA = "Lower shift ( FC )" and "Upper shift ( SC )"
VIDYA = "Fixed CMO Lenght (9)?" and "Calculation Method: CMO/StDev?"
Selecting the input: "Use Different Source ???" you can use a source with multiple elements of your choice:
2 = (Source 1 + Source 2) / 2
3 = (Source 1 + Source 2 + Source 3) / 3
4 = (Source 1 + Source 2 + Source 3 + Source 4) / 4
5 = (Source 1 + Source 2 + Source 3 + Source 4 + Source 5) / 5
These are the editable Inputs for Plots:
"Jaw/ Teeth/ Lips ???" = to arm / disarm the Lines
"Fill Line???" = to insert / de-sensitize the fill of the Long and Short Lines - Long = Lips> Teeth> Jaw - Short = Jaw> Teeth> Jaw - Neutral = rest
"Fill Background???" = to insert / desensit the background of the Long and Short Lines - Long = Lips> Teeth> Jaw - Short = Jaw> Teeth> Jaw - Neutral = rest
Candle Fill % MeterFor use with Hollow Candles
Fills Candles based on either the value of the RSI or coppock scaled to fit properly between the open and close. Makes for a compact visual with lot's of information given. Toggle bells and whistles in settings such as arrows to indicate the direction of the value being measured, dividing levels, fill from candle open all the time instead of the bottom up and more.
RSI - colour fillThis script showcases the new (overload) feature regarding the fill() function! 🥳
2 plots could be filled before, but with just 1 colour per bar, now the colour can be a gradient type.
In this example we have 2 plots
- rsiPlot , which plots the rsi value
- centerPlot, which plots the value 50 ('centre line')
Explanation of colour fill in the zone 50-80
Default when rsi > 50
- a bottom value is set at 50 (associated with colour aqua)
- and a top value is set at 80 (associated with colour red)
This zone (bottom -> top value) is filled with a gradient colour (50 - aqua -> 80 - red)
When rsi is towards 80, you see a red coloured zone at the rsi value,
while when rsi is around 50, you'll only see the colour aqua
The same principle is applied in the zone 20-50 when rsi < 50
Cheers!
Educational: FillThis script showcases the latest feature of colour fill between lines with gradient
There are 17 ema's, all with adjustable lengths.
In the settings there are 3 options: '1' , '2' , and '1 & 2' :
Option '1'
Here the highest - lowest lines are filled with a gradient colour,
dependable where the 3rd highest/lowest ema is situated in regard of these 2 lines:
Option '2'
Here the colour fill is applied between every ema and the one next to it.
The gradient colour is dependable where the ema is situated in regard of the highest - lowest line:
Option '1 & 2'
A combination of both options:
The setting 'switch colours at ema x' regulates the switch between bullish and bearish colours.
When close is above the chosen ema -> bullish colours, when below -> bearish colours.
Examples of other settings of 'switch colours at ema x' :
Colour switch when close above/below:
ema 14
ema 11
ema 8
ema 5
ema 2
The colours can be set below, both for option '1' and '2'
Cheers!
MTF Custom Moving AveragesThis user-friendly indicator allows up to 8 moving averages ( EMA or SMA ) from any timeframe, on any time frame. There are plenty of other MTF MA indicators, each with their own pros and cons. I wanted to make one without the cons:
- Independently set each MA to Exponential or Simple
- No preset lengths
- No preset timeframes
- Optional labels to help keep track of the period/length/type of each plot
- Clean, intuitive input layout
- More than enough MAs available to use one indicator for several use cases... just check/uncheck the ones that are relevant to each chart
Watch for death crosses on the 4hr while monitoring the "Bull Market Support band" (Weekly 21 EMA and 20 SMA ) and checking the Monthly 10 EMA for major support or resistance. Toggle between half of the available MAs for long term BTC trends and use the others for your alts. Use this one indicator to support multiple strategies.
Please leave a comment if you find it useful or have suggestions!
Inspired by the first MTF indicator I found: Weekly Moving Average by TommyTompsen.
Gap Absorption StrategyLike the nature, markets don't like the void, and this is something we can take advantage of by trading gaps on some markets.
This technique is well known, so I wanted to write a tiny script based on this strategy to get a bit more comfortable with it.
IMPORTANT: Default parameters wont give you good trades on every markets, you need to modify these parameters to see which proportions correspond to the stock you're trading.
This script triggers signals on predefined variation of a stock price after a gap, and allows its user to configure TP and SL prices corresponding to a specific percentage of this gap movement.
Note: We can observe that opening gaps are often the most interesting.
Options
Trigger: the price variation you want to trigger on (in % of the price)
Stop Loss : in % of the gap
Take profit : in % of the gap
A small table is displayed in the top right corner of the chart to give you TP/SL/Signal prices for each opportunity
SL (red line) and TP (green line) are also displayed on the chart when a signal is triggered
Information concerning the current opportunity is given at the bottom of the chart
Note: This script is based on the Gap-Size-Indicator that I published a few weeks ago.
Fill Strength Gradient [BigBitsIO]This script plots two moving averages but is mostly designed to highlight a fill strength gradient. The fill strength gradient shows a more opaque fill based on the current percentage difference of the current difference to the maximum difference in two MAs in a trend.
Citation: PinceCoders - Slight modification on color functions
Triple Moving Average HeatmapHi everyone
I didn't publish on Friday because I was working on an Expert Advisor in MT4. The day I don't publish, some scripts spamming guys published many (not useful) scripts the same to kick me out of the TOP #1 ranking.
So what I'm going to do about it? crying or sharing more quality scripts than before? :)
I guess you know the answer :) I'm gonna share a few quality scripts that I have in my library. I noticed that you guys tend to like more the scripts useful for your trading actually making you money rather than a copy-paste (of another copy-paste)
Alright, enough for the trolling now let's introduce the Three MA heatmap which is an upgrade of that script : MA-heatmap-Double-cross-edition/
The challenge was to keep the heatmap not rolling and to make it match with the MA cross. I did it using this
```
since_ma_buy = barssince(macrossover)
since_ma_sell = barssince(macrossunder)
heatmap_color() =>
since_ma_buy < since_ma_sell ? color.new(color.green, 20) : since_ma_buy > since_ma_sell ? color.new(color.red, 20) : na
```
This is a technique that I found after drinking three glasses of red wine (#french) to keep the heatmap stable and not rolling.
To get what I'm saying I invite you to replace the piece of code above by what everyone would normally do
```
heatmap_color() =>
macrossunder() ? color.new(color.green, 20) : macrossover() ? color.new(color.red, 20) : na
```
Ah and I'm not done sharing for the day, a few scripts are coming also after that one and tonight !!!!! I want to live in a world where you guys can enjoy quality scripts (mostly) :)
PS
____________________________________________________________
Feel free to hit the thumbs up as it shows me that I'm not doing this for nothing and will motivate to deliver more quality content in the future.
- I'm an officially approved PineEditor/LUA/MT4 approved mentor on codementor. You can request a coaching with me if you want and I'll teach you how to build kick-ass indicators and strategies
Jump on a 1 to 1 coaching with me
- You can also hire for a custom dev of your indicator/strategy/bot/chrome extension/python
MA heatmap (Double cross edition)Hello my friends
Sorry yesterday I couldn't post an indicator because I was travelling. So here's the today indicator inspired from that one Moving-Average-Heatmap-Visualization/
This will gives an interesting representation of a Double Moving Average cross
That's all for me
Let's resume the free indicators publishing next Monday with the MA heatmap (Triple cross edition) and then the 4 cross ... until the 100 cross edition .... "wait are you joking sir ?"... Totally YES :)
But the Triple cross edition will be released as it's interesting from a Pine script perspective
Enjoy your weekend and stay safe
Dave
EMA ZoneIndicator to fill the ZONE between two EMAs (9 and 21 is the default)
RULES of completion:
CLOSE above "EMAs" and "EMA SLOW", and "EMA FAST" > "EMA SLOW" = green fill
CLOSE below "EMAs" and "EMA SLOW" ,and "EMA FAST" < "EMA SLOW" = red fill
CLOSE between EMAs = white fill
Moving Average Shaded Fill Area Crossover EMA Color - EditableMoving Average Shaded Fill Area Crossover EMA Color with option to change EMA value