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
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.