EMA inside stochastic oscilator

 

Subject: Can the built-in Moving Average overlay on Stochastic be reproduced in a custom MQL5 indicator?

Hi everyone,

I'm trying to recreate the exact behavior of MetaTrader 5 when you drag the built-in Moving Average indicator onto the built-in Stochastic Oscillator.

My goal is not to calculate an EMA of the stochastic values, and not to normalize or convert the EMA into a 0–100 oscillator.

What I want is the exact behavior of the built-in MT5 overlay:

  • The Moving Average is still calculated from Close prices.
  • The MA is displayed inside the Stochastic subwindow.
  • As I scroll or zoom the chart, the MA moves visually but always remains aligned with the corresponding price history.
  • I want to reproduce this exact display behavior in a custom indicator, because I eventually want to use the crossover between the MA and the Stochastic %K line in an Expert Advisor.

My questions are:

  1. Is this exact behavior possible to reproduce in MQL5?
  2. Does MetaTrader expose the rendering/scaling method used by the built-in MA overlay?
  3. Is there an API or technique for drawing a price-based indicator inside another indicator's subwindow while preserving the original MA calculation?
  4. Or is this behavior implemented internally by the MT5 terminal and therefore unavailable to custom indicators?

If anyone has implemented this before, or knows whether it is technically possible, I would really appreciate your guidance.

Thank you.

 
Derrick Liebenberg:


search codebase. there is one that you can select all of the different mas over stochastic, and the visual is 100% same as if you drag and drop the standard ma over the stochastic chart.