OPEN-SOURCE SCRIPT
Forex Sessions + High/Low Volume Indicator

//version=5
indicator("Forex Sessions + High/Low Volume Indicator", overlay=true, max_boxes_count=500)
// --- Inputs: Sessions ---
showAsia = input.bool(true, "Show Asia Session", group="Forex Sessions")
asiaTime = input.session("0000-0900", "Asia Session Time", group="Forex Sessions")
asiaColor = input.color(color.new(color.blue, 90), "Asia Color", group="Forex Sessions")
showLondon = input.bool(true, "Show London Session", group="Forex Sessions")
londonTime = input.session("0800-1700", "London Session Time", group="Forex Sessions")
londonColor= input.color(color.new(color.orange, 90), "London Color", group="Forex Sessions")
showNY = input.bool(true, "Show NY Session", group="Forex Sessions")
nyTime = input.session("1300-2200", "NY Session Time", group="Forex Sessions")
nyColor = input.color(color.new(color.red, 90), "NY Color", group="Forex Sessions")
// --- Inputs: Volume ---
volLen = input.int(20, "Volume MA Length", minval=1, group="Volume Logic")
highMult = input.float(1.5, "High Volume Threshold (x MA)", minval=1.0, group="Volume Logic")
lowMult = input.float(0.5, "Low Volume Threshold (x MA)", maxval=1.0, group="Volume Logic")
// --- Session Logic ---
is_session(sess) =>
not na(time(timeframe.period, sess, "UTC+0")) // Adjust "UTC+0" to your broker's timezone if needed
inAsia = showAsia and is_session(asiaTime)
inLondon = showLondon and is_session(londonTime)
inNY = showNY and is_session(nyTime)
// Plot Backgrounds
bgcolor(inAsia ? asiaColor : na)
bgcolor(inLondon ? londonColor : na)
bgcolor(inNY ? nyColor : na)
// --- Volume Logic ---
volMA = ta.sma(volume, volLen)
isHighVol = volume > (volMA * highMult)
isLowVol = volume < (volMA * lowMult)
// Highlight Candles based on Volume
barcolor(isHighVol ? color.yellow : isLowVol ? color.gray : na)
// --- Labels (Optional) ---
if isHighVol
label.new(bar_index, high, "HV", color=color.yellow, textcolor=color.black, style=label.style_label_down, size=size.tiny)
if isLowVol
label.new(bar_index, low, "LV", color=color.gray, textcolor=color.white, style=label.style_label_up, size=size.tiny)
// Plot Volume MA for reference (optional, shown in separate pane if not overlay)
// plot(volMA, "Volume MA", color=color.white)
indicator("Forex Sessions + High/Low Volume Indicator", overlay=true, max_boxes_count=500)
// --- Inputs: Sessions ---
showAsia = input.bool(true, "Show Asia Session", group="Forex Sessions")
asiaTime = input.session("0000-0900", "Asia Session Time", group="Forex Sessions")
asiaColor = input.color(color.new(color.blue, 90), "Asia Color", group="Forex Sessions")
showLondon = input.bool(true, "Show London Session", group="Forex Sessions")
londonTime = input.session("0800-1700", "London Session Time", group="Forex Sessions")
londonColor= input.color(color.new(color.orange, 90), "London Color", group="Forex Sessions")
showNY = input.bool(true, "Show NY Session", group="Forex Sessions")
nyTime = input.session("1300-2200", "NY Session Time", group="Forex Sessions")
nyColor = input.color(color.new(color.red, 90), "NY Color", group="Forex Sessions")
// --- Inputs: Volume ---
volLen = input.int(20, "Volume MA Length", minval=1, group="Volume Logic")
highMult = input.float(1.5, "High Volume Threshold (x MA)", minval=1.0, group="Volume Logic")
lowMult = input.float(0.5, "Low Volume Threshold (x MA)", maxval=1.0, group="Volume Logic")
// --- Session Logic ---
is_session(sess) =>
not na(time(timeframe.period, sess, "UTC+0")) // Adjust "UTC+0" to your broker's timezone if needed
inAsia = showAsia and is_session(asiaTime)
inLondon = showLondon and is_session(londonTime)
inNY = showNY and is_session(nyTime)
// Plot Backgrounds
bgcolor(inAsia ? asiaColor : na)
bgcolor(inLondon ? londonColor : na)
bgcolor(inNY ? nyColor : na)
// --- Volume Logic ---
volMA = ta.sma(volume, volLen)
isHighVol = volume > (volMA * highMult)
isLowVol = volume < (volMA * lowMult)
// Highlight Candles based on Volume
barcolor(isHighVol ? color.yellow : isLowVol ? color.gray : na)
// --- Labels (Optional) ---
if isHighVol
label.new(bar_index, high, "HV", color=color.yellow, textcolor=color.black, style=label.style_label_down, size=size.tiny)
if isLowVol
label.new(bar_index, low, "LV", color=color.gray, textcolor=color.white, style=label.style_label_up, size=size.tiny)
// Plot Volume MA for reference (optional, shown in separate pane if not overlay)
// plot(volMA, "Volume MA", color=color.white)
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.