Plotting Trading Signals
VAI Script allows you to plot trading signals on your chart with a number of customizable options.
For plotting lines with shaded area:
Buy – draws series point values (if condition is true) as a triangle market below the LOW price
Sell – draws series point values (if condition is true) as an inverted triangle market above the HIGH price
line – draws series values in line chart
spline – draws series values in spline chart
bar – draws series values in bar chart
Red, Blue, Green, Orange, Violet, etc. Putting in “any” will let the chart decide on what color to apply according to the current theme.
Main – Draw the series values in the main page where the candle stick prices are plotted. Any other names will create an additional pane and group all series on the same name pane below the main pane.
Please note that Buy/Sell signals can be also plotted in other panes by extending the pane syntax with the variable.
It means Buy labels will be plotted in the MACD pane and attaching the Buy/Sell signals to MacdSignal values.
//Buy when MACD Line crossed up, otherwise sell
set macd_line = MACD(13, 26, 9, EXPONENTIAL)
set macd_signal = MACDSIGNAL(13, 26, 9, EXPONENTIAL)
set hist = macd_line – macd_signal
Set Buy= CROSSOVER(macd_line , macd_signal)
Set Sell = CROSSOVER(macd_signal, macd_line)
plot(macd_line, line, any, macd)
plot(macd_signal, line, any, macd)
plot(hist, bar, any, macd)
//Plot Buy and sell signals
Plot(Buy, Buy, Green, main)
Plot(Sell, Sell, Red, main)
//In the event of multiple succeeding buy signals, use this plot function if you want to only plot the signals per pair.
Plotbuysell (buy, sell, green, red, main)