OPEN-SOURCE SCRIPT
papa experiment

//version=6
indicator("Edufx AMD", shorttitle="Edufx AMD", overlay=true)
// ───── Inputs ─────
timezone = input.string("America/New_York", "Timezone")
enableDailyCycles = input.bool(true, "Enable Daily Cycles")
colorAcc = input.color(color.new(color.gray, 80), "Accumulation")
colorManip = input.color(color.new(color.red, 80), "Manipulation")
colorDist = input.color(color.new(color.green, 80), "Distribution")
// ───── Daily Anchor (NY 8PM) ─────
var int dayStart = na
if na(dayStart) or time >= dayStart + 86400000
dayStart := timestamp(timezone, year, month, dayofmonth, 20, 0)
accEnd = dayStart + 9 * 60 * 60 * 1000
manEnd = dayStart + 15 * 60 * 60 * 1000
distEnd = dayStart + 24 * 60 * 60 * 1000
// ───── State ─────
var float accLo = na
var float accHi = na
var float manLo = na
var float manHi = na
var float disLo = na
var float disHi = na
var bool accDone = false
var bool manDone = false
var bool disDone = false
// ───── Daily AMD ─────
if enableDailyCycles
// Accumulation
if time >= dayStart and time < accEnd
accLo := na(accLo) ? low : math.min(accLo, low)
accHi := na(accHi) ? high : math.max(accHi, high)
if time >= accEnd and not accDone and not na(accLo)
box.new(dayStart, accHi, accEnd, accLo,
xloc=xloc.bar_time, bgcolor=colorAcc, border_color=colorAcc)
accDone := true
// Manipulation
if time >= accEnd and time < manEnd
manLo := na(manLo) ? low : math.min(manLo, low)
manHi := na(manHi) ? high : math.max(manHi, high)
if time >= manEnd and not manDone and not na(manLo)
box.new(accEnd, manHi, manEnd, manLo,
xloc=xloc.bar_time, bgcolor=colorManip, border_color=colorManip)
manDone := true
// Distribution
if time >= manEnd and time < distEnd
disLo := na(disLo) ? low : math.min(disLo, low)
disHi := na(disHi) ? high : math.max(disHi, high)
if time >= distEnd and not disDone and not na(disLo)
box.new(manEnd, disHi, distEnd, disLo,
xloc=xloc.bar_time, bgcolor=colorDist, border_color=colorDist)
disDone := true
// Reset
if time >= distEnd
accLo := na
accHi := na
manLo := na
manHi := na
disLo := na
disHi := na
accDone := false
manDone := false
disDone := false
indicator("Edufx AMD", shorttitle="Edufx AMD", overlay=true)
// ───── Inputs ─────
timezone = input.string("America/New_York", "Timezone")
enableDailyCycles = input.bool(true, "Enable Daily Cycles")
colorAcc = input.color(color.new(color.gray, 80), "Accumulation")
colorManip = input.color(color.new(color.red, 80), "Manipulation")
colorDist = input.color(color.new(color.green, 80), "Distribution")
// ───── Daily Anchor (NY 8PM) ─────
var int dayStart = na
if na(dayStart) or time >= dayStart + 86400000
dayStart := timestamp(timezone, year, month, dayofmonth, 20, 0)
accEnd = dayStart + 9 * 60 * 60 * 1000
manEnd = dayStart + 15 * 60 * 60 * 1000
distEnd = dayStart + 24 * 60 * 60 * 1000
// ───── State ─────
var float accLo = na
var float accHi = na
var float manLo = na
var float manHi = na
var float disLo = na
var float disHi = na
var bool accDone = false
var bool manDone = false
var bool disDone = false
// ───── Daily AMD ─────
if enableDailyCycles
// Accumulation
if time >= dayStart and time < accEnd
accLo := na(accLo) ? low : math.min(accLo, low)
accHi := na(accHi) ? high : math.max(accHi, high)
if time >= accEnd and not accDone and not na(accLo)
box.new(dayStart, accHi, accEnd, accLo,
xloc=xloc.bar_time, bgcolor=colorAcc, border_color=colorAcc)
accDone := true
// Manipulation
if time >= accEnd and time < manEnd
manLo := na(manLo) ? low : math.min(manLo, low)
manHi := na(manHi) ? high : math.max(manHi, high)
if time >= manEnd and not manDone and not na(manLo)
box.new(accEnd, manHi, manEnd, manLo,
xloc=xloc.bar_time, bgcolor=colorManip, border_color=colorManip)
manDone := true
// Distribution
if time >= manEnd and time < distEnd
disLo := na(disLo) ? low : math.min(disLo, low)
disHi := na(disHi) ? high : math.max(disHi, high)
if time >= distEnd and not disDone and not na(disLo)
box.new(manEnd, disHi, distEnd, disLo,
xloc=xloc.bar_time, bgcolor=colorDist, border_color=colorDist)
disDone := true
// Reset
if time >= distEnd
accLo := na
accHi := na
manLo := na
manHi := na
disLo := na
disHi := na
accDone := false
manDone := false
disDone := false
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。