Click here to Login





                                                   Can you share your main (candlestick chart) formula? Here's mine!

  1

0
Josh McCormick
2020-07-22 16:42:48


Do you mind sharing the formula for your stock price chart?

I'm hoping to get some ideas and see what everyone else is using for their main stock price chart. I guess it wouldn't be fair if I didn't start off by sharing my own, so here it is.

MY MAIN CANDLESTICK CHART (as of July 22, 2020):
=======================================

// REMOVE THE EXTRA PADDING (MARGINS) AT THE TOP AND BOTTOM OF THE GRAPH

UpdateSettings("Top-Bottom Chart Margin", 0);

// LABEL THE CENTER-BOTTOM OF THE GRAPH WITH THE NAME/FUNCTION OF THE CURRENT FORMULA
// This labels the graph with the currently active symbol's name followed by "STOCK CHART".
// EXAMPLE: SPY STOCK CHART
// FYI: Every chart uses PrintChart to display their name and any major settings at the bottom/center.

PrintChart(Name()." STOCK CHART","", BottomCenter, colorBlack, colorBlack, colorWhite, 255);

// OPTIONAL: DISPLAY PERCENTAGE CHANGE ABOVE EVERY CANDLESTICK
// Calculates each bar's % change and displays it above each candlestick.
// This is used when a tracking spreadsheet needs to be manually updated.
// NOTE: Visually noisy. Except when needed, this should be commented out.
// CHANGES: There are two formulas below. The first compares previous close to current close.
// CHANGES: The second compares open to close (which matches how candles are colored)

//mychange=Round(100*(ref (close,0)-ref(close,1))/ref (close,1),3); // Calculation for a special spreadsheet
//mychange=Round(100*(ref (close,0)-ref(open,0))/ref (open,0),3); // Calculation for everyday use
//Plot(mychange, "Change %", colorBlack, ChartNone, StyleNoScale|StyleHideYAxisValue);
//PlotArrow (1,mychange."%", AboveHigh,colorRed);
//UpdateColor (mychange==0,colorBlack);
//UpdateColor (mychange>0,colorGreen);

// OPTIONAL: PLAYS WINDOWS BELL WHEN A NEW BAR IS GENERATED (DOWNLOAD: "Beep on a New Bar")
// NOTE: Based on personal preference, this should be commented out except when needed.

a=beepnewbar();

// OPTIONAL: LOWER-LEFT INFOBOX WITH SYMBOL INFORMATION (DOWNLOAD: "Symbol Information on Chart")

p = SymbolInformation();

// ZERO-LAG EXPONENTIAL MOVING AVERAGE OF THE CLOSING PRICE (DOWNLOAD: "Zero-Lag Exponential Moving Average")
// Tightly hugs the closing price except for extreme moves, which are smoothed.
// Graph the output and store it in the variable "series" to be used with Hilbert Transform (HT) functions.
// The HT functions appear to work better when working with data that has been lightly smoothed.

series = Zlema(close, 5);
plot(series, "Zlema", colorBlack, ChartLine, StyleDotted|StyleWidth4);

// DOTTED LINE WITH OPENING PRICE (DISPLAYED ONLY WHILE ON THE *INTRADAY CHARTS*)
// Continuously plots each day's opening price across the Intraday chart.
// POTENTIAL ISSUE: Can widen the plot's scale when intraday prices move away from the opening price.

todayopened = HistoPrice(_open, 0);
plot(max(todayopened,(IsEoD()==1)*close), "OPEN",colorDeepSkyBlue,ChartLine,StyleWidth2|StyleDotted|StyleHideValues);
UpdateColor (IsEoD()==1, ColorTransparent);

// OBTAIN DEFAULT PERIOD FROM THE HILBERT TRANSOFRM DOMINANT CYCLE PERIOD
// Use half of the Hilbert Transform's Dominant Cycle Period as our own default period length.

//period=Round (Ht_DCPeriod(series),0); // Result will be an integer between 10 and 50. (Full value.)
//period=Round (Ht_DCPeriod(series)/4,0); // Result will be an integer between 3 and 12. (Quarter value.)
period=Round (Ht_DCPeriod(series)/2,0); // Result will be an integer between 5 and 25. (Half value.)

// SUPERTREND currently under evaluation. (DOWNLOAD: "Supertrend Indicator")
// Disabled by default to reduce visual clutter.

supert = supertrend(period, 3);
plot(supert, "supertrend", colorLightGreen, ChartLine, StyleDotted|StyleWidth3|StyleHideYAxisValue);
UpdateColor (supert>series, colorlightcoral); // Optional coloring of medium/long-term trend

// ENHANCED CANDLESTICKS (DOWNLOAD: None required.)
// Candlesticks will be lightened/darkened based on volume.
// Other lines (such as ZLEMA) will be plotted BEHIND the candlesticks.
// The script below comes from the AddCandleStickVol add-on (no need to download).
// The thickness of the wicks above/below the candles is set with the StyleWidth2 argument.
// The foreground/background status of the candles is set with the StyleBringToFront argument.

PlotCandleStick("Quotes", colorBrown|255|colorViolet|255|0, StyleWidth2|StyleBringToFront);
UpdateColor(((volume >= Ref(volume, 1)) + (close > open)) == 2, colorGreen);
UpdateColor(((volume < Ref(volume, 1)) + (close > open)) == 2, colorLightGreen);
UpdateColor(((volume >= Ref(volume, 1)) + (close <= open)) == 2, colorRed);
UpdateColor(((volume < Ref(volume, 1)) + (close <= open)) == 2, colorLightCoral);

// ENHANCED VOLUME GRAPH AT QUARTER-SIZE SCALE (DOWNLOAD: None required.)
// Volume bars are partially transparent and are plotted BEHIND the rest of the graph.
// Volume bars will grow lighter/darker as volume increases/decreases versus the previous bar.
// Volume bars will only occupy the bottom 1/4th of the available space in the graph.
// The script comes from "Enhanced Candlestick Chart with Volume Variation" add-on (no need to download).
// Thanks to the QuantShare Team for the magic which further limits the vertical size of these bars.

plot(volume, "Volume", colorLime|50|colorLime|50|0, ChartBar, StyleOwnScale|StyleHideValues|StyleHideYAxisValue);
UpdateColor(((volume >= Ref(volume, 1)) + (close > open)) == 2, ColorGreen|40);
UpdateColor(((volume < Ref(volume, 1)) + (close > open)) == 2, ColorLightGreen|40);
UpdateColor(((volume >= Ref(volume, 1)) + (close <= open)) == 2, ColorRed|40);
UpdateColor(((volume < Ref(volume, 1)) + (close <= open)) == 2, ColorLightCoral|40);
Plot(volume *4, "Volume", colorTransparent, ChartNone, StyleOwnScale|StyleHideYAxisValue);
UpdateSettings("MergeWithPreviousOwnScale", 1);





Beep on a New Bar (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item
Symbol Information on Chart (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item
Zero-Lag Exponential Moving Average (by Tom Huggens, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item
Supertrend Indicator (by Juliettpapa, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Euronext Paris - Realtime Share Prices Data
Disable or Enable your Stop Rules
Watchlists on Your Chart
Reinvest Dividends in Your Trading System
Stop Trading Based on Your Portfolio Equity Return

How-to Lessons
How to optimize an indicator in your trading system
How to backup your databases (EOD, Intraday, Tick and Custom) and...
How to import your own list of stocks/symbols
How to quickly add several positions to your portfolio
How to quickly download the most recent EOD data for your stocks

Related Forum Threads
Can you access custom functions from the downloader script events...
Analyse your own data ?
SCRIPT: Set current symbol as your benchmark!
How can I associate a field (value) to a trade in a MM script?
Where can I get global historical stock and bond index prices?

Blog Posts
5 position sizing techniques you can use in your trading system
4 original breadth indicators you should consider in your market ...
How to create custom databases in your trading software
How to Create Your First Meta-Strategy
Create Your Own Tactical Asset Allocation Strategies









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.