A "Golden Cross" is simple a bullish crossover between a short term moving average and and long term moving average, the most commonly used period is 50 and 200 days respectively.
A "Death Cross" is the opposite, a bearish crossover of the same period settings as the Golden Cross. A cross in either direction means that prices are either bullish or bearish.
A caveat is that while the common 50-200 period crossovers are strong trend indicators, they happen infrequently and would always lag the market.
To use this script, simply copy and paste the code below in your VAI Script Editor, save it and run! You can run it in the charts module to display the signals on the chart or run it in the screener module, which will show all the signals for that day.
You can find more tutorials here https://www.vaianalytics.com/knowledge-base/
//Golden Cross Signal
//Set Variables
// sma means simple moving average
// syntax would be as follows: sma(parameter,period)
// You can change the parameter from the usual close price to high or low.
// You can also change the period to any number
Set SMA50 = sma(close,50)
Set SMA200 = sma(close,200)
// Set definition of your "buy and sell" conditions which we'll rename to golden and death cross
Set Golden Cross = crossover(sma50, sma200)
Set Death Cross = crossover(sma200,sma50)
// This script will plot it in the charts
plot(sma50,line,red,main)
plot(sma200,line,Green,main)
plot(Golden Cross,buy,green,main)
plot(Death Cross,sell,red,main)
// The signal function will allow VAI to read your "buy" and "sell" conditions.
signals(golden cross,Death cross)
//end
