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提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。