Last active
February 11, 2025 00:40
-
-
Save SCodify/6e61b29002e1de6c8b7b2c2d72a1e4df to your computer and use it in GitHub Desktop.
Este es un indicador técnico para realiza un análisis completo utilizando 6 indicadores diferentes para proporcionar una vista general del mercado
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=5 | |
indicator("Análisis OPTRADE", overlay=true, max_labels_count=500) | |
// ———— Configuración ———— // | |
string assetType = input.string("Crypto", "Tipo de Activo", options=["Crypto", "Otros"]) | |
// ———— Cálculos ———— // | |
// 1. SMA50 | |
sma50 = ta.sma(close, 50) | |
cond_sma = close > sma50 ? "Sí" : "No" | |
sma_emoji = cond_sma == "Sí" ? "🟢" : "🔴" | |
// 2. RSI | |
rsiThreshold = assetType == "Crypto" ? 75 : 70 | |
rsi = ta.rsi(close, 14) | |
cond_rsi = rsi >= rsiThreshold ? "Sobrecompra" : rsi <= 30 ? "Sobreventa" : "Neutral" | |
rsi_emoji = cond_rsi == "Sobrecompra" ? "🔴" : cond_rsi == "Sobreventa" ? "🟢" : "🟡" | |
// 3. MACD | |
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9) | |
cond_macd = macdLine > signalLine ? "Sí" : "No" | |
macd_emoji = cond_macd == "Sí" ? "🟢" : "🔴" | |
// 4. Bollinger Bands | |
lengthBB = 20 | |
multBB = 2.0 | |
basis = ta.sma(close, lengthBB) | |
dev = multBB * ta.stdev(close, lengthBB) | |
upperBB = basis + dev | |
lowerBB = basis - dev | |
distanciaABandaSuperior = upperBB - close | |
distanciaABandaInferior = close - lowerBB | |
bandRange = upperBB - lowerBB | |
threshold = bandRange * 0.33 | |
cond_bb = distanciaABandaSuperior <= threshold ? "Banda Superior" : | |
distanciaABandaInferior <= threshold ? "Banda Inferior" : | |
"En el Medio" | |
bb_emoji = cond_bb == "Banda Superior" ? "🔴" : cond_bb == "Banda Inferior" ? "🟢" : "🟡" | |
// 5. Estocástico | |
lengthStoch = 14 | |
k = ta.sma(ta.stoch(close, high, low, lengthStoch), 3) | |
cond_stoch = k >= 80 ? "Sobrecompra" : k <= 20 ? "Sobreventa" : "Neutral" | |
stoch_emoji = cond_stoch == "Sobrecompra" ? "🔴" : cond_stoch == "Sobreventa" ? "🟢" : "🟡" | |
// 6. Volumen | |
//cond_vol = volume > volume[1] ? "Aumentando" : volume < volume[1] ? "Disminuyendo" : "Neutral" // Respecto al volumen anterior | |
volMedia = ta.sma(volume, 10) | |
cond_vol = volume > volMedia * 1.2 ? "Aumentando" : volume < volMedia * 0.8 ? "Disminuyendo" : "Neutral" // Respecto a la media de volumen | |
vol_emoji = cond_vol == "Aumentando" ? "🟢" : cond_vol == "Disminuyendo" ? "🔴" : "🟡" | |
// 7. Ichimoku Cloud | |
tenkan = (ta.highest(high, 9) + ta.lowest(low, 9)) / 2 | |
kijun = (ta.highest(high, 26) + ta.lowest(low, 26)) / 2 | |
senkouA = (tenkan + kijun) / 2 | |
senkouB = (ta.highest(high, 52) + ta.lowest(low, 52)) / 2 | |
chikou = close | |
// 8. ATR x 1.5 | |
atrLength = 14 | |
atr = ta.atr(atrLength) | |
atrMultiplier = 1.5 | |
atrStopLossLong = close - atr * atrMultiplier // Stop Loss para compra | |
atrStopLossShort = close + atr * atrMultiplier // Stop Loss para venta | |
// Determinar posición respecto a la nube | |
aboveCloud = close > senkouA and close > senkouB | |
belowCloud = close < senkouA and close < senkouB | |
insideCloud = not aboveCloud and not belowCloud | |
cond_ichimoku = aboveCloud ? "Por encima" : belowCloud ? "Por debajo" : "Dentro" | |
ichimoku_emoji = cond_ichimoku == "Por encima" ? "🟢" : cond_ichimoku == "Por debajo" ? "🔴" : "🟡" | |
// ———— Interfaz ———— // | |
var table t = table.new(position.bottom_right, 3, 10, frame_color=color.black, frame_width=1, border_width=1) | |
bgDark = color.rgb(40, 40, 40) | |
headerSize = size.large // Simular negrita con tamaño grande | |
if barstate.islast | |
// Encabezados (texto más grande) | |
table.cell(t, 0, 0, " ⚪ ", bgcolor=bgDark, text_color=color.white, text_size=headerSize) | |
table.cell(t, 1, 0, " Indicador ", bgcolor=bgDark, text_color=color.white, text_size=headerSize) | |
table.cell(t, 2, 0, " Estado ", bgcolor=bgDark, text_color=color.white, text_size=headerSize) | |
// SMA50 | |
table.cell(t, 0, 1, sma_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 1, "Precio > SMA50", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 1, cond_sma, bgcolor=bgDark, text_color=color.white) | |
// RSI | |
table.cell(t, 0, 2, rsi_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 2, "RSI", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 2, cond_rsi, bgcolor=bgDark, text_color=color.white) | |
// MACD | |
table.cell(t, 0, 3, macd_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 3, "Cruce alcista en MACD", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 3, cond_macd, bgcolor=bgDark, text_color=color.white) | |
// Bandas Bollinger | |
table.cell(t, 0, 4, bb_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 4, "Bandas Bollinger", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 4, cond_bb, bgcolor=bgDark, text_color=color.white) | |
// Estocástico | |
table.cell(t, 0, 5, stoch_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 5, "Estocástico", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 5, cond_stoch, bgcolor=bgDark, text_color=color.white) | |
// Volumen | |
table.cell(t, 0, 6, vol_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 6, "Volumen", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 6, cond_vol, bgcolor=bgDark, text_color=color.white) | |
// Ichimoku Cloud | |
table.cell(t, 0, 7, ichimoku_emoji, bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 7, "Ichimoku Cloud", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 7, cond_ichimoku, bgcolor=bgDark, text_color=color.white) | |
// ATR x 1.5 (Compra) | |
table.cell(t, 0, 8, "📈", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 8, "1.5 x ATR\nposición comprada", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 8, str.tostring(atrStopLossLong, "#.##"), bgcolor=bgDark, text_color=color.white) | |
// ATR x 1.5 (Venta) | |
table.cell(t, 0, 9, "📉", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 1, 9, "1.5 x ATR\nposición vendida", bgcolor=bgDark, text_color=color.white) | |
table.cell(t, 2, 9, str.tostring(atrStopLossShort, "#.##"), bgcolor=bgDark, text_color=color.white) | |
// --------------------------// | |
// OPTRADE ChatBot // | |
// Developed by SoftCodify // | |
//---------------------------// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment