PHP Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// Author: @ senpai_noticeme (emansenpai, doc). ack: @ silenThunderr, @ dixitsoham7, @ colejustice
//@version=5
// One Minute Algo Run (OMAR) will mark High Low of the opening candle (1min is recommended default) based on the current time frame in current session
// There are also recommended 1x and 2x extensions of the ranges for taking profit that may also be adjusted as needed.
indicator('One Minute Algo Run', shorttitle='OMAR', overlay=true)
baseOnOneMinuteCandles = input.bool(title='Base on 1 Minute Candles', defval=true, tooltip="If checked, opening range high/low will be based on 1 minute candles instead of the chart settings. Useful for short ranges, e.g. the opening minute.")
SessionInput = input.session('1000-1015')
var target1Long = 0.0
var target2Long = 0.0
var target1Short = 0.0
var target2Short = 0.0
var OmarRange = 0.0
var OmarMid = 0.0
var longT1 = line.new(na, na, na, na, extend=extend.right)
var longT2 = line.new(na, na, na, na, extend=extend.right)
var shortT1 = line.new(na, na, na, na, extend=extend.right)
var shortT2 = line.new(na, na, na, na, extend=extend.right)
var longT1Label = label.new(na, na, textcolor=color.blue, style=label.style_none)
var longT2Label = label.new(na, na, textcolor=color.blue, style=label.style_none)
var shortT1Label = label.new(na, na, textcolor=color.blue, style=label.style_none)
var shortT2Label = label.new(na, na, textcolor=color.blue, style=label.style_none)
var longT1Line = input.bool(title='Show Long T1', defval=true, group='Long')
var longT2Line = input.bool(title='Show Long T2', defval=true, group='Long')
var shortT1Line = input.bool(title='Show Short T1', defval=true, group='Short')
var shortT2Line = input.bool(title='Show Short T2', defval=true, group='Short')
var longT1Range = input.float(title='Long T1', defval=1, group='Long (x times above range of OMAR)', tooltip='Line will be plotted above high of OMAR. If value entered is 1, then T1 = range of OMAR x 1')
var longT2Range = input.float(title='Long T2', defval=2, group='Long (x times above range of OMAR)', tooltip='Line will be plotted above high of OMAR. If value entered is 2, then T2 = range of OMAR x 2')
var shortT1Range = input.float(title='Short T1', defval=1, group='Short (x times below range of OMAR)', tooltip='Line will be plotted below low of OMAR. If value entered is 1, then T1 = range of OMAR x 1')
var shortT2Range = input.float(title='Short T2', defval=2, group='Short (x times below range of OMAR)', tooltip='Line will be plotted below low of OMAR. If value entered is 2, then T2 = range of OMAR x 1')
// Section below defines what an active session is
var tz = "UTC-3"
sessionBegins(sess) =>
t = time(timeframe.period, sess,tz)
timeframe.isintraday and (not barstate.isfirst) and na(t[1]) and not na(t)
timeframe_high = baseOnOneMinuteCandles ? request.security(syminfo.ticker, "60", high, barmerge.gaps_off, barmerge.lookahead_on) : high
timeframe_low = baseOnOneMinuteCandles ? request.security(syminfo.ticker, "60", low, barmerge.gaps_off, barmerge.lookahead_on) : low
var float high_value = na
var float low_value = na
//Set required variable values during active session
if sessionBegins(SessionInput)
high_value := timeframe_high
low_value := timeframe_low
OmarRange := high_value - low_value
OmarMid := low_value + OmarRange/2
target1Long := high_value + longT1Range * OmarRange
target2Long := high_value + longT2Range * OmarRange
target1Short := low_value - shortT1Range * OmarRange
target2Short := low_value - shortT2Range * OmarRange
// Only plot the high, low and mid suring active session
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? high_value : na, style=plot.style_circles, linewidth=3, color=color.new(color.orange, 0), title='High')
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? low_value : na, style=plot.style_circles, linewidth=3, color=color.new(color.orange, 0), title='Low')
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? OmarMid : na, style=plot.style_linebr, linewidth=2, color=color.new(color.orange, 0), title='Middle')
//long target 1
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? (longT1Line ? target1Long : na) : na, style=plot.style_linebr, linewidth=2, color=color.new(color.blue, 100), title='LongT1')
if not(true and not time(timeframe.period, SessionInput,tz))
label.set_xy(longT1Label, bar_index + 15, target1Long)
label.set_text(id=longT1Label, text='T1 - ' + str.tostring(target1Long) + ' (' + str.tostring(longT1Range * OmarRange) + ') points')
//long target 2
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? (longT2Line ? target2Long : na) : na, style=plot.style_linebr, linewidth=2, color=color.new(color.blue, 100), title='LongT2')
if not(true and not time(timeframe.period, SessionInput,tz))
label.set_xy(longT2Label, bar_index + 15, target2Long)
label.set_text(id=longT2Label, text='T2 - ' + str.tostring(target2Long) + ' (' + str.tostring(longT2Range * OmarRange) + ') points')
//short target 1
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? (shortT1Line ? target1Short : na) : na, style=plot.style_linebr, linewidth=2, color=color.new(color.blue, 100), title='ShortT1')
if not(true and not time(timeframe.period, SessionInput,tz))
label.set_xy(shortT1Label, bar_index + 15, target1Short)
label.set_text(id=shortT1Label, text='T1 - ' + str.tostring(target1Short) + ' (' + str.tostring(shortT1Range * OmarRange) + ') points')
//short target 2
//plot(not(true and not time(timeframe.period, SessionInput,tz)) ? (shortT2Line ? target2Short : na) : na, style=plot.style_linebr, linewidth=2, color=color.new(color.blue, 0), title='ShortT2')
if not(true and not time(timeframe.period, SessionInput,tz))
label.set_xy(shortT2Label, bar_index + 15, target2Short)
label.set_text(id=shortT2Label, text='T2 - ' + str.tostring(target2Short) + ' (' + str.tostring(shortT2Range * OmarRange) + ') points')
kod türkiye saati için 10 ile 10.15 arası....saatlik ayarlanmıştır...
Yer İmleri