Skip to content

Custom Scripted Tool - 52 week Fibonacci Levels

By Optuma Team · Updated 2023-01-31

Any script formula applied to a Show Bar, Show Plot or Show View can be saved as your own tool and added to your toolbox. For example, the following script can be used in a Show Plot to automatically calculate the Fibonacci levels between the 52 week high and low using multiple Plot functions:

//Get 52 week high and low;
H1 = LAST(HIGHESTHIGH(RANGE=Look Back Period, BACKTYPE=Weeks, BARS=52, INCBAR=True));
L1 = LAST(LOWESTLOW(RANGE=Look Back Period, BACKTYPE=Weeks, BARS=52, INCBAR=True));
//Calc range;
R1 = (H1-L1);
//Calc Fib levels;
Plot1 = H1;
Plot2 = L1 + (R1 * 0.618);
Plot3 = L1 + (R1 * 0.5);
Plot4 = L1 + (R1 * 0.382);
Plot5 = L1;
//Set line styles;
Plot1.Colour = Green;
Plot1.Linestyle = Dash;
Plot1.LineWidth = 2;
Plot2.Colour = Blue;
Plot2.Linestyle = Dash;
Plot3.Colour = Red;
Plot3.Linestyle = Dash;
Plot3.LineWidth = 2;
Plot4.Colour = Blue;
Plot4.Linestyle = Dash;
Plot5.Colour = Green;
Plot5.Linestyle = Dash;
Plot5.LineWidth = 2;

To save as an indicator and add it to your toolbox, click on the Use as an Indicator box, and apply it to the Same View so that it appears on the price chart.

Capture

Once saved, apply the tool as per any other tool from your toolbox and the Fibonacci levels will automatically show on the screen - and update automatically as the high/low range changes.

Capture

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.