Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator("Haut/Bas/Clotûre_Annuel/Semestriel/Trimestriel/Mensuel", shorttitle="HBC", overlay=true)
- // Fonction pour calculer le haut, bas et clôture des périodes spécifiées
- getPreviousData(timeframe, length) =>
- highData = request.security(syminfo.tickerid, timeframe, high)
- lowData = request.security(syminfo.tickerid, timeframe, low)
- closeData = request.security(syminfo.tickerid, timeframe, close)
- [highData[1], lowData[1], closeData[1]]
- // Paramètres pour les périodes temporelles
- yearly = input(true, title="Afficher Annuel")
- semesterly = input(true, title="Afficher Semestriel")
- quarterly = input(true, title="Afficher Trimestriel")
- monthly = input(true, title="Afficher Mensuel")
- // Calcul des données pour les périodes temporelles spécifiées
- [yearlyHigh, yearlyLow, yearlyClose] = getPreviousData("12M", 1)
- [semesterlyHigh, semesterlyLow, semesterlyClose] = getPreviousData("6M", 1)
- [quarterlyHigh, quarterlyLow, quarterlyClose] = getPreviousData("3M", 1)
- [monthlyHigh, monthlyLow, monthlyClose] = getPreviousData("1M", 1)
- // Tracé des lignes de support et de résistance
- plot(yearly ? barstate.islast ? yearlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Annuel")
- plot(yearly ? barstate.islast ? yearlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Annuel")
- plot(yearly ? barstate.islast ? yearlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Annuelle")
- plot(semesterly ? barstate.islast ? semesterlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Semestriel")
- plot(semesterly ? barstate.islast ? semesterlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Semestriel")
- plot(semesterly ? barstate.islast ? semesterlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Semestrielle")
- plot(quarterly ? barstate.islast ? quarterlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Trimestriel")
- plot(quarterly ? barstate.islast ? quarterlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Trimestriel")
- plot(quarterly ? barstate.islast ? quarterlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Trimestrielle")
- plot(monthly ? barstate.islast ? monthlyHigh : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Haut Mensuel")
- plot(monthly ? barstate.islast ? monthlyLow : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Bas Mensuel")
- plot(monthly ? barstate.islast ? monthlyClose : na : na, color=color.new(#ffffff, 0), linewidth=1, title="Clôture Mensuelle")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement