Click here to Login




How to plot arrows below/above candlesticks on a chart

Updated on 2012-02-11





In order to add arrows on a chart, you have to update the chart's formula.


Steps:

- Right click on a chart then select "Edit Formula"
- "PlotArrow" is the function we must use to plot arrows

PlotArrow Parameters:

Time-Series: Plots an arrow above/below a candlestick when the value of the time series is different from zero
Description: Text to display above/below arrows
TopBottom: A constant that specify whether to plot the arrows below or above candlesticks
Color: The color used to draw the different arrows


Example:

cross1 = cross(sma(10), sma(30));
PlotArrow(cross1, "Last Cross: ".barssince(cross1[1]), AboveHigh, colorRed);


The above example plots an arrow on the bar where the 10-bar simple moving average (SMA) crosses above the 30-bar SMA.
Above each arrow, we display the number of bars since the last crossover. This is calculated using the "barssince" function and the "cross1" variable one bar ago (cross1[1]).




If you want to create arrows with different colors, you can call the "PlotArrow " function several times and use a different color each time.

Example:

Plots a green arrow when the stock is trading at a 75-bar high
Plots a red arrow when the stock is trading at a 75-bar low

PlotArrow(close == hhv(close, 75), "", AboveHigh, colorGreen);
PlotArrow(close == llv(close, 75), "", BelowLow, colorRed);









4 comments (Log in)

Back







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.