Advertisement
xmd79

Media Móvil Ponderada con Desviaciones

Aug 27th, 2023
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © aprenderainvertirenbolsa.es
  3.  
  4. //@version=5
  5. indicator("Media Móvil Ponderada con Desviaciones", shorttitle="MMPD", overlay=true)
  6.  
  7. // Entradas
  8. length = input(200, title="Longitud de la Media")
  9. deviation_upper = input(10.0, title="Desviación Superior (%)")
  10. deviation_lower = input(10.0, title="Desviación Inferior (%)")
  11.  
  12. // Medias Móviles Ponderadas
  13. wma_central = ta.wma(close, length)
  14. wma_upper = ta.wma(close, length) * (1 + deviation_upper / 100)
  15. wma_lower = ta.wma(close, length) * (1 - deviation_lower / 100)
  16.  
  17. // Trama de la Media Central
  18. plot(wma_central, color=color.blue, title="Media Central")
  19.  
  20. // Trama de la Media Superior
  21. plot(wma_upper, color=color.green, title="Media Superior")
  22.  
  23. // Trama de la Media Inferior
  24. plot(wma_lower, color=color.red, title="Media Inferior")
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement