Murrey Math lines Fluid version
Forums › ProRealTime English forum › ProBuilder support › Murrey Math lines Fluid version
- This topic has 3 replies, 3 voices, and was last updated 3 years ago by robertogozzi.
-
-
08/19/2021 at 7:15 PM #175724
Hello everybody,
I need help with a script that is not very popular but in my opinion it is very important, currently there is a version which works in prt is quite chaotic, but in the Tradingview platform it works more fluid.
Code that i found: https://www.prorealcode.com/topic/niveles-de-murrey-math/
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168//Trading view Code://@version=4// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © ceyhun//Original Code https://tr.tradingview.com/v/x8ZRlmof/study("Murrey Math Lines", title="MML", overlay=true)//-- get inputsstring res1 = input(title="Resolution",type=input.resolution,defval="D")int frame = input(defval=64, title="Frame Size", type=input.integer, minval=8, maxval=256)float mult = input(defval=1.5, title="Frame Multiplier", type=input.float, minval=1.0, maxval=2.0, step=0.5)bool wicks = input(defval=true, title="Ignore Wicks?")//-- defineslogTen = log(10)log8 = log(8)log2 = log(2)lookback = round(frame * mult)ss = syminfo.tickeridstring res = res1=="" ? timeframe.period : res1o = security(ss, res, open)c = security(ss, res, close)h = security(ss, res, high)l = security(ss, res, low)uPrice = wicks == true ? max(o, c) : hlPrice = wicks == true ? min(o, c) : l//-- find highest/lowest price over specified lookbackvLow1 = lowest(lPrice, lookback)vHigh1 = highest(uPrice, lookback)vLow = security(ss, res, vLow1)vHigh = security(ss, res, vHigh1)vDist = vHigh - vLow//-- if low price is < 0 then adjust accordinglytmpHigh = vLow < 0 ? 0 - vLow : vHightmpLow = vLow < 0 ? 0 - vLow - vDist : vLow//-- determine if price shift is in placeshift = vLow < 0 ? true : false//-- calculate scale framesfVar = log(0.4 * tmpHigh) / logTen - floor(log(0.4 * tmpHigh) / logTen)SR = tmpHigh > 25 ?sfVar > 0 ? exp(logTen * (floor(log(0.4 * tmpHigh) / logTen) + 1)) :exp(logTen * floor(log(0.4 * tmpHigh) / logTen)) :100 * exp(log8 * floor(log(0.005 * tmpHigh) / log8))nVar1 = log(SR / (tmpHigh - tmpLow)) / log8nVar2 = nVar1 - floor(nVar1)N = nVar1 <= 0 ? 0 : nVar2 == 0 ? floor(nVar1) : floor(nVar1) + 1//-- calculate scale interval and temporary frame top and bottomSI = SR * exp(-N * log8)M = floor(1.0 / log2 * log((tmpHigh - tmpLow) / SI) + 0.0000001)I = round((tmpHigh + tmpLow) * 0.5 / (SI * exp((M - 1) * log2)))Bot = (I - 1) * SI * exp((M - 1) * log2)Top = (I + 1) * SI * exp((M - 1) * log2)//-- determine if frame shift is requireddoShift = tmpHigh - Top > 0.25 * (Top - Bot) or Bot - tmpLow > 0.25 * (Top - Bot)ER = doShift == true ? 1 : 0MM = ER == 0 ? M : ER == 1 and M < 2 ? M + 1 : 0NN = ER == 0 ? N : ER == 1 and M < 2 ? N : N - 1//-- recalculate scale interval and top and bottom of frame, if necessaryfinalSI = ER == 1 ? SR * exp(-NN * log8) : SIfinalI = ER == 1 ? round((tmpHigh + tmpLow) * 0.5 / (finalSI * exp((MM - 1) * log2))) : IfinalBot = ER == 1 ? (finalI - 1) * finalSI * exp((MM - 1) * log2) : BotfinalTop = ER == 1 ? (finalI + 1) * finalSI * exp((MM - 1) * log2) : Top//-- determine the incrementIncrement = (finalTop - finalBot) / 8//-- determine the absolute topabsTop = shift == true ? -(finalBot - 3 * Increment) : finalTop + 3 * Increment//-- create our Murrey line variables based on absolute top and the incrementPlus38 = absTopPlus28 = absTop - IncrementPlus18 = absTop - 2 * IncrementEightEight = absTop - 3 * IncrementSevenEight = absTop - 4 * IncrementSixEight = absTop - 5 * IncrementFiveEight = absTop - 6 * IncrementFourEight = absTop - 7 * IncrementThreeEight = absTop - 8 * IncrementTwoEight = absTop - 9 * IncrementOneEight = absTop - 10 * IncrementZeroEight = absTop - 11 * IncrementMinus18 = absTop - 12 * IncrementMinus28 = absTop - 13 * IncrementMinus38 = absTop - 14 * Increment//-- plot the lines and we are doneplot(Plus38, title="+3/8 Imminent Bearish reversal", style=plot.style_circles, color=#008000, linewidth=1)plot(Plus28, title="+2/8 Extreme Overshoot conditions, can reverse anytime", style=plot.style_circles, color=#FF0000, linewidth=1)plot(Plus18, title="+1/8 Overshoot conditions", style=plot.style_circles, color=#808080, linewidth=1)plot(EightEight, title="8/8 Ultimate resistance, extremely overbought conditions", style=plot.style_circles, color=#0000FF, linewidth=2)plot(SevenEight, title="7/8 Weak level, place to stop and reverse", style=plot.style_circles, color=#808080, linewidth=1)plot(SixEight, title="6/8 Strong pivot reverse", style=plot.style_circles, color=#FF0000, linewidth=1)plot(FiveEight, title="5/8 Top of trading range", style=plot.style_circles, color=#008000, linewidth=1)plot(FourEight, title="4/8 Major support/resistance pivot point", style=plot.style_circles, color=#0000FF, linewidth=2)plot(ThreeEight, title="3/8 Bottom of trading range", style=plot.style_circles, color=#008000, linewidth=1)plot(TwoEight, title="2/8 Strong, Pivot, reverse", style=plot.style_circles, color=#FF0000, linewidth=1)plot(OneEight, title="1/8 Weak, place to stop and reverse", style=plot.style_circles, color=#808080, linewidth=1)plot(ZeroEight, title="0/8 Hardest line to fall below, oversold conditions", style=plot.style_circles, color=#0000FF, linewidth=2)plot(Minus18, title="-1/8 Oversold conditions", style=plot.style_circles, color=#808080, linewidth=1)plot(Minus28, title="-2/8 Extreme oversold conditions, can reverse anytime", style=plot.style_circles, color=#FF0000, linewidth=1)plot(Minus38, title="-3/8 Imminent bullish reversal ", style=plot.style_circles, color=#008000, linewidth=1)// Function outputs 1 when it's the first bar of the D/W/M/Yis_newbar(res) =>ch = 0if(res == 'Y')t = year(time('D'))ch := change(t) != 0 ? 1 : 0elset = time(res)ch := change(t) != 0 ? 1 : 0ch////////////// ALERTS //ot = crossover(close, Plus38) or crossunder(close, Plus38) or crossover(close, Plus28) or crossunder(close, Plus28) or crossover(close, Plus18) or crossunder(close, Plus18) or crossover(close, EightEight) or crossunder(close, EightEight) or crossover(close, SevenEight) or crossunder(close, SevenEight) or crossover(close, SixEight) or crossunder(close, SixEight) or crossover(close, FiveEight) or crossunder(close, FiveEight) or crossover(close, FourEight) or crossunder(close, FourEight) or crossover(close, ThreeEight) or crossunder(close, ThreeEight) or crossover(close, TwoEight) or crossunder(close, TwoEight) or crossover(close, OneEight) or crossunder(close, OneEight) or crossover(close, ZeroEight) or crossunder(close, ZeroEight) or crossover(close, Minus18) or crossunder(close, Minus18) or crossover(close, Minus28) or crossunder(close, Minus28) or crossover(close, Minus38) or crossunder(close, Minus38)alertcondition(ot, title="Alert me when Octaves Change!", message="Octaves Change - Alert!")alertcondition(not is_newbar('D') and crossover(close, Plus38), "Crossover +3/8", "Crossover +3/8")alertcondition(not is_newbar('D') and crossover(close, Plus28), "Crossover +2/8", "Crossover +2/8")alertcondition(not is_newbar('D') and crossover(close, Plus18), "Crossover +1/8", "Crossover +1/8")alertcondition(not is_newbar('D') and crossover(close, EightEight), "Crossover 8/8", "Crossover 8/8")alertcondition(not is_newbar('D') and crossover(close, SevenEight), "Crossover 7/8", "Crossover 7/8")alertcondition(not is_newbar('D') and crossover(close, SixEight), "Crossover 6/8", "Crossover 6/8")alertcondition(not is_newbar('D') and crossover(close, FiveEight), "Crossover 5/8", "Crossover 5/8")alertcondition(not is_newbar('D') and crossover(close, FourEight), "Crossover 4/8", "Crossover 4/8")alertcondition(not is_newbar('D') and crossover(close, ThreeEight), "Crossover 3/8", "Crossover 3/8")alertcondition(not is_newbar('D') and crossover(close, TwoEight), "Crossover 2/8", "Crossover 2/8")alertcondition(not is_newbar('D') and crossover(close, OneEight), "Crossover 1/8", "Crossover 1/8")alertcondition(not is_newbar('D') and crossover(close, ZeroEight), "Crossover 0/8", "Crossover 0/8")alertcondition(not is_newbar('D') and crossover(close, Minus18), "Crossover -1/8", "Crossover -1/8")alertcondition(not is_newbar('D') and crossover(close, Minus28), "Crossover -2/8", "Crossover -2/8")alertcondition(not is_newbar('D') and crossover(close, Minus38), "Crossover -3/8", "Crossover -3/8")alertcondition(not is_newbar('D') and crossunder(close, Plus38), "Crossunder +3/8", "Crossunder +3/8")alertcondition(not is_newbar('D') and crossunder(close, Plus28), "Crossunder +2/8", "Crossunder +2/8")alertcondition(not is_newbar('D') and crossunder(close, Plus18), "Crossunder +1/8", "Crossunder +1/8")alertcondition(not is_newbar('D') and crossunder(close, EightEight), "Crossunder 8/8", "Crossunder 8/8")alertcondition(not is_newbar('D') and crossunder(close, SevenEight), "Crossunder 7/8", "Crossunder 7/8")alertcondition(not is_newbar('D') and crossunder(close, SixEight), "Crossunder 6/8", "Crossunder 6/8")alertcondition(not is_newbar('D') and crossunder(close, FiveEight), "Crossunder 5/8", "Crossunder 5/8")alertcondition(not is_newbar('D') and crossunder(close, ThreeEight), "Crossunder 4/8", "Crossunder 4/8")alertcondition(not is_newbar('D') and crossunder(close, FourEight), "Crossunder 3/8", "Crossunder 3/8")alertcondition(not is_newbar('D') and crossunder(close, TwoEight), "Crossunder 2/8", "Crossunder 2/8")alertcondition(not is_newbar('D') and crossunder(close, OneEight), "Crossunder 1/8", "Crossunder 1/8")alertcondition(not is_newbar('D') and crossunder(close, ZeroEight), "Crossunder 0/8", "Crossunder 0/8")alertcondition(not is_newbar('D') and crossunder(close, Minus18), "Crossunder -1/8", "Crossunder -1/8")alertcondition(not is_newbar('D') and crossunder(close, Minus28), "Crossunder -2/8", "Crossunder -2/8")alertcondition(not is_newbar('D') and crossunder(close, Minus38), "Crossunder -3/8", "Crossunder -3/8")08/25/2021 at 10:45 AM #17618308/25/2021 at 10:59 AM #176184If I have already checked these versions, but the only one that comes close is this Murrey Niveles, it is not clear or fast like the one I propose since this indicator is very important the price action depending on the support / resistance level and it cannot be appreciated, Metatrader or Tradingview currently is much more friendly
This
08/25/2021 at 12:00 PM #176191Do not embed your pics within the post itself, rather use the SELECT button.
Embedding pics will greatly impair the speed of the website.
Thank you 🙂
1 user thanked author for this post.
-
AuthorPosts