Advertisement
xmd79

Haut/Bas/Clotûre_Annuel/Semestriel/Trimestriel/Mensuel

Jan 4th, 2024
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. //@version=5
  2. indicator("Haut/Bas/Clotûre_Annuel/Semestriel/Trimestriel/Mensuel", shorttitle="HBC", overlay=true)
  3.  
  4. // Fonction pour calculer le haut, bas et clôture des périodes spécifiées
  5. getPreviousData(timeframe, length) =>
  6. highData = request.security(syminfo.tickerid, timeframe, high)
  7. lowData = request.security(syminfo.tickerid, timeframe, low)
  8. closeData = request.security(syminfo.tickerid, timeframe, close)
  9. [highData[1], lowData[1], closeData[1]]
  10.  
  11. // Paramètres pour les périodes temporelles
  12. yearly = input(true, title="Afficher Annuel")
  13. semesterly = input(true, title="Afficher Semestriel")
  14. quarterly = input(true, title="Afficher Trimestriel")
  15. monthly = input(true, title="Afficher Mensuel")
  16.  
  17. // Calcul des données pour les périodes temporelles spécifiées
  18. [yearlyHigh, yearlyLow, yearlyClose] = getPreviousData("12M", 1)
  19. [semesterlyHigh, semesterlyLow, semesterlyClose] = getPreviousData("6M", 1)
  20. [quarterlyHigh, quarterlyLow, quarterlyClose] = getPreviousData("3M", 1)
  21. [monthlyHigh, monthlyLow, monthlyClose] = getPreviousData("1M", 1)
  22.  
  23. // Tracé des lignes de support et de résistance
  24. plot(yearly ? barstate.islast ? yearlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Annuel")
  25. plot(yearly ? barstate.islast ? yearlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Annuel")
  26. plot(yearly ? barstate.islast ? yearlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Annuelle")
  27.  
  28. plot(semesterly ? barstate.islast ? semesterlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Semestriel")
  29. plot(semesterly ? barstate.islast ? semesterlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Semestriel")
  30. plot(semesterly ? barstate.islast ? semesterlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Semestrielle")
  31.  
  32. plot(quarterly ? barstate.islast ? quarterlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Trimestriel")
  33. plot(quarterly ? barstate.islast ? quarterlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Trimestriel")
  34. plot(quarterly ? barstate.islast ? quarterlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Trimestrielle")
  35.  
  36. plot(monthly ? barstate.islast ? monthlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Mensuel")
  37. plot(monthly ? barstate.islast ? monthlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Mensuel")
  38. plot(monthly ? barstate.islast ? monthlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Mensuelle")
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement