how do i get this pro real code to show the numerical values as well as producing a chart
// Monthly MACD Indicator on Daily Chart
MACDFastPeriod = 12
MACDSlowPeriod = 26
MACDSignalPeriod = 9
// Switch to monthly timeframe to calculate MACD
TIMEFRAME(monthly)
imacd = MACD[MACDFastPeriod, MACDSlowPeriod, MACDSignalPeriod](close)
normalizedMACD = imacd / close
// Back to default (daily) timeframe
TIMEFRAME(default)
RETURN imacd AS “Monthly MACD”, normalizedMACD AS “MACD/Close”
Hi,
If wanting to see the value anywhere, and cursor details are not showed, you can go in the platform settings in the main window menu to activate them.
If wanting instead to display latest value on chart, rather than reading it inside the right side margin or in the cursor details, you can use the DRAWTEXT command, alongside drawonlastbaronly set on true. For example in green the added lines to try out, but you can change the drawtext parameters to display text somewhere else more convenient:
defparam drawonlastbaronly=true
// Monthly MACD Indicator on Daily Chart
MACDFastPeriod = 12
MACDSlowPeriod = 26
MACDSignalPeriod = 9
// Switch to monthly timeframe to calculate MACD
TIMEFRAME(monthly)
imacd = MACD[MACDFastPeriod, MACDSlowPeriod, MACDSignalPeriod](close)
normalizedMACD = imacd / close
// Back to default (daily) timeframe
TIMEFRAME(default)
DRAWTEXT(“NormalizedMACD #normalizedMACD#”, barindex, normalizedMACD)
RETURN imacd AS “Monthly MACD”, normalizedMACD AS “MACD/Close”
For reference:
DRAWTEXT
DrawOnLastBarOnly
Many thanks. is it possible to export straight to a text file