Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # New_Highs_New_Lows_Percentual
- #
- # Muestra el porcentaje de nuevos máximos de 52 semanas menos nuevos mínimos de 52 semanas por día para la bolsa
- # seleccionada. Si el número de mínimos es mayor que el de máximos, el valor será negativo. Si los máximos son
- # mayores, el porcentaje será positivo. Bolsa = "ETF" muestra la diferencia neta entre máximos y mínimos para todos los ETF
- # cotizadosen las 4 bolsas.
- #
- # Los símbolos de TOS no parecen funcionar como se espera cuando el período de agregación es SEMANAL, por lo que este
- # estudio es solo para gráficos diarios.
- #
- # Interpretación: si ve fondo rojo, la amplitud de mercado está mal, si ve fondo verde hay amplitud de mercado
- # ¿Cómo lo uso yo? 1) sobre NYSE, 2) si se pone verde largo en SPX, 3) si se pone rojo voy a liquidez.
- #
- # Shows the percentage of new 52-week highs - new 52-week lows by day for the selected exchange. If the
- # number of lows is greater than the number of highs, the value will be negative. If highs are
- # greater, the number will be positive. Exchange = "ETF" shows net highs - lows for all ETFs listed
- # on the 4 exchanges.
- #
- # The TOS symbols don't appear to work at expected when the aggregation period is WEEK so this
- # study is only for daily charts.
- #
- declare lower;
- declare hide_on_intraday ; # most functions are only relevant for daily aggregation
- input exchange = {default "ALL STOCKS","NYSE+NASDAQ", "NYSE", "NASDAQ", "AMEX", "ARCA", "ETF"};
- def diff;
- def nydiff = (close("$NYHGH") - close("$NYLOW"))/(close("$NYHGH") + close("$NYLOW"));
- def nadiff = (close("$NAHGH") - close("$NALOW"))/(close("$NAHGH") + close("$NALOW"));
- def nyse_y_nasdaq = ((close("$NYHGH")+close("$NAHGH"))-(close("$NYLOW")+close("$NALOW"))) / (close("$NYHGH")+close("$NAHGH")+close("$NYLOW")+close("$NALOW"));
- def amdiff = (close("$AMHGH") - close("$AMLOW"))/(close("$AMHGH") + close("$AMLOW"));
- def ardiff = (close("$ARHGH") - close("$ARLOW"))/(close("$ARHGH") + close("$ARLOW"));
- def alldiff = ((close("$NYHGH") - close("$NYLOW")) + (close("$NAHGH") - close("$NALOW"))
- + (close("$AMHGH") - close("$AMLOW")) + (close("$ARHGH") - close("$ARLOW")))
- / ((close("$NYHGH") + close("$NYLOW")) + (close("$NAHGH") + close("$NALOW"))
- + (close("$AMHGH") + close("$AMLOW")) + (close("$ARHGH") + close("$ARLOW")))
- ;
- # nydiff+nadiff+amdiff+ardiff;
- def etfdiff = (close("$ETFHIGH") - close("$ETFLOW"))/(close("$ETFHIGH") + close("$ETFLOW"));
- switch (exchange){
- case "NYSE":
- diff = nydiff;
- case "NASDAQ":
- diff =nadiff;
- case "NYSE+NASDAQ":
- diff = nyse_y_nasdaq;
- case "AMEX":
- diff = amdiff;
- case "ARCA":
- diff = ardiff;
- case "ETF":
- diff = etfdiff;
- case "ALL STOCKS":
- diff = alldiff;
- }
- # Show trend cloud
- def uptrend = diff > 0 and diff[1] > 0 and diff[2] > 0;
- def downtrend = diff < 0 and diff[1] < 0 and diff[2] < 0;
- def hiLevel = if uptrend then Double.POSITIVE_INFINITY else if downtrend then Double.NEGATIVE_INFINITY else 0;
- AddCloud(hiLevel, -hiLevel, Color.LIGHT_GREEN, Color.LIGHT_RED);
- # show net new highs/lows bars
- plot hlp = diff;
- hlp.EnableApproximation();
- hlp.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
- hlp.SetLineWeight(5);
- hlp.AssignValueColor(if hlp < 0 then Color.RED
- else if hlp > 0 then Color.GREEN
- else Color.CYAN);
- # show zero line
- plot zero = 0.0;
- zero.SetDefaultColor(Color.WHITE);
- zero.SetLineWeight(1);
- zero.HideBubble();
- zero.HideTitle();
- def muestra_alerta;
- if GetAggregationPeriod() == AggregationPeriod.DAY {
- muestra_alerta = 0;
- } else {
- muestra_alerta = 1;
- }
- AddLabel(muestra_alerta, "ALERT this indicator only gives correct information at DAILY", Color.Downtick);
Advertisement
Add Comment
Please, Sign In to add comment