pine-scripttradingview-api

Oscillator, and moving average overlay


how can I overlay a moving average over the candlestick chart, while an oscillator is displayed below? Do I need to define a moving average to a variable, then create another variable with the ma variable as an input or source? Can I use plotchar to draw the moving average variable? Basically is it possible, and if so how do I go about it?

Pinescript version5 on trading view...


Solution

  • If your oscillator is on a separate pane, you cannot do that. You need two indicators here, one for the oscillator overlay=false and one for the ma overlay=true.