OPEN-SOURCE SCRIPT
3 VCT + SMA200

//version=5
indicator("3 VCT + SMA200", overlay=true)
// SMA200
smaLength = 200
sma200 = ta.sma(close, smaLength)
plot(sma200, "SMA200", color=color.orange, linewidth=2)
// Condiciones de velas
isBullish = close > open
isBearish = close < open
// Contador de velas consecutivas
var contraCount = 0
if (close > sma200) // Tendencia alcista → buscamos 3 velas bajistas
if isBearish
contraCount += 1
else
contraCount := 0
else if (close < sma200) // Tendencia bajista → buscamos 3 velas alcistas
if isBullish
contraCount += 1
else
contraCount := 0
// Señal cuando se cumplan 3 consecutivas en contra
signal = (contraCount == 3)
// Mostrar en gráfico
plotshape(signal, title="Señal 3 velas", style=shape.labeldown,
text="", location=location.abovebar,
color=color.red, size=size.tiny, textcolor=color.white)
// Crear condición de alerta
alertcondition(signal, title="3 Velas Contra Tendencia",
message="Se han formado 3 velas en contratendencia respecto a la SMA200.")
indicator("3 VCT + SMA200", overlay=true)
// SMA200
smaLength = 200
sma200 = ta.sma(close, smaLength)
plot(sma200, "SMA200", color=color.orange, linewidth=2)
// Condiciones de velas
isBullish = close > open
isBearish = close < open
// Contador de velas consecutivas
var contraCount = 0
if (close > sma200) // Tendencia alcista → buscamos 3 velas bajistas
if isBearish
contraCount += 1
else
contraCount := 0
else if (close < sma200) // Tendencia bajista → buscamos 3 velas alcistas
if isBullish
contraCount += 1
else
contraCount := 0
// Señal cuando se cumplan 3 consecutivas en contra
signal = (contraCount == 3)
// Mostrar en gráfico
plotshape(signal, title="Señal 3 velas", style=shape.labeldown,
text="", location=location.abovebar,
color=color.red, size=size.tiny, textcolor=color.white)
// Crear condición de alerta
alertcondition(signal, title="3 Velas Contra Tendencia",
message="Se han formado 3 velas en contratendencia respecto a la SMA200.")
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน