As it turned out that DOpen, DClose etc. are not consistent with the trading session for the EUR/USD I am using this version of the pivot points. This results are also consistent with weekends and with the pivot points given on the website http://www.actionforex.com/ (for example). I don’t know, where I took the original code from (maybe a metatrader code), but I modified it a little bit, so the time when a “new day” starts is configurable.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
defparam drawonlastbaronly = true nd = 230000 if barindex = 0 then init = 1 lastClose = undefined lastHigh = undefined lastLow = undefined PP = undefined Res1 = undefined Res2 = undefined Res3 = undefined Sup1 = undefined Sup2 = undefined Sup3 = undefined else newDay = (Time[2] < nd AND Time[1] >= nd AND dayofweek <> 0) or (Time[2] < nd AND Time[1] >= nd and dayofweek[1] <> 0 and dayofweek[0] = 0) if newDay then if init = 1 then lastHigh = High lastLow = Low init = 2 elsif init = 2 then lastClose = Close[1] PP = (lastClose + lastHigh + lastLow) / 3 hl = lastHigh - lastLow Res1 = 2 * PP - lastLow Sup1 = 2 * PP - lastHigh Res2 = PP + hl Sup2 = PP - hl Res3 = Res1 + hl Sup3 = Sup1 - hl lastHigh = High lastLow = Low endif endif if init = 2 then lastHigh = Max(lastHigh, High) lastLow = Min(lastLow, Low) endif endif return PP coloured(0,0,0) style(dottedline, 1) as "PP", Res1 coloured(200,200,0) style(dottedline, 1) as "R1", Res2 coloured(0,0,255) style(dottedline, 1) as "R2", Res3 coloured(255,0,0) style(dottedline, 1) as "R3", Sup1 coloured(200,200,0) style(dottedline, 1) as "S1", Sup2 coloured(0,0,255) style(dottedline, 1) as "S2", Sup3 coloured(255,0,0) style(dottedline, 1) as "S3" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thank you Mario for your contribution!
Hello Nicolas,
With Daily Pivot, it easy for me to show current day pivot e.g.
if Date = Today the
//// show
endif
But the weekly pivot seem not to be straight forward. Is there any workaround this, that is, to show only the current week pivot without clustering the chart.
Thanks
You’ll find many other pivots points indicators in the library, just use the search box of the navigation bar of the website, thank you.
Thanks for the suggestion.