MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

Документация - это исчерпывающая справка по языку MQL5
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2012.12.05 10:47
Pivot Lines TimeZone

Pivot Lines TimeZone - indicator for MetaTrader 5

| English Russian Chinese Spanish Portuguese

votes: 13

The indicator is rewritten from MQL4, the author Alejandro Galindo, published by Scriptor, link to the source -

How it works

The indicator draws the Pivot levels, the Pivot sublevels and the Camarilla levels.

Levels can be displayed by indicator buffers (by the whole history) and/or only current levels by horizontal lines.

Drawing levels using the indicator buffers. 

Drawing levels using the horizontal lines.


  • DayStartHour - Hour of day start.
  • DayStartMinute - Minutes of day start.
  • PivotsBuffers - Draw the Pivot levels using the indicator buffers.
  • MidpivotsBuffers - Draw the Pivot sublevels using the indicator buffers.
  • CamarillaBuffers - Draw the Camarilla levels using the indicator buffers.
  • PivotsLines - Draw the current Pivot levels using the horizontal lines.
  • MidpivotsLines - Draw the current Pivot sublevels using the horizontal lines.
  • CamarillaLines - Draw the current Camarilla levels using the horizontal lines.
  • ClrPivot - Color of the Pivot horizontal line.
  • ClrS - Color of S1, S2, S3 horizontal lines.
  • ClrR - Color of R1, R2, R3 horizontal lines.
  • ClrM - Color of M0, M1, M2, M3, M4, M5 horizontal lines.
  • ClrCamarilla - Color of the Camarilla horizontal lines.
  • ClrTxt - Color of texts with horizontal lines names.
  • AttachSundToMond - Attach Sunday bars to Monday.

Translated from Russian by MetaQuotes Software Corp.
Original code:

Last comments | Go to discussion (2)
Sergey Golubev
newdigital | 30 Oct 2013 at 12:57

Pivot Points Technical Indicator

Pivot points indicator consists of a central pivot which is surrounded by 3 resistance levels below and 3 support levels above.

Pivot points initially were used by floor traders to analyze and trade the equities and futures exchange markets. This indicator is considered to be a leading indicator rather than a lagging indicator.

Pivots provide a quick way for currency traders to analyze the general trend of how the market is going to be moving during the course of the day. This indicator uses only a few simple calculations to plot the resistance and support levels.

To calculate the pivot points for the coming trading day is the previous day's

  • high,
  • low, and
  • close prices are used

The Forex trading day closes at 5:00PM EST this daily closing time is when the pivots are updated.

The 24-hour cycle pivots for this indicator are calculated using a complex formula, which the indicator will calculate automatically for you. The central pivot is then used to calculate the support and resistance levels as follows: 

  • Resistance 3
  • Resistance 2
  • Resistance 1
  • Pivot Point
  • Support 1
  • Support 2
  • Support 3

Technical Analysis of Pivot Points


Pivots can be used in different ways to generate Forex trading signals. The following methods are the most common technical analysis for Pivot points. 

Trend Identification Signals

The central pivot is used by traders to determine the general market trend direction. The trades taken will only be in the direction of the market trend.

  • Buy signal- price is above the central pivot
  • Sell signal- price is below the central pivot

Price Breakout Signals

Price breakout signals are generated as follows

  • Buy signal- is generated when the price breaks upwards through the central point.
  • Sell signal- is generated when the price breaks downwards through the central point.

Price Reversal Signal

Price reversals are generated as follows 

  • Buy signal- when price moves down towards one of the support level, then touches the support or moves slightly through it then quickly reverses and moves upwards.
  • Sell signal- when price moves up towards one of the resistance level, then touches the resistance or moves slightly through it then quickly reverses and moves downwards.

Setting Stop loss and Limit Profit Values using Support & Resistance Levels

The central pivotand the other support and resistance levels are used by traders to determine suitable stop loss and limit profit levels.

If a buy is placed above the central pivot point the Resistance 1 or Resistance 2 can be used to set the take profit level, and the Support 1 can be set as the Stop Loss Level for the trade.

Sergey Golubev
newdigital | 30 Jan 2014 at 11:06

How to Use Forex Yearly Pivot Points to Forecast Euro Targets (based on dailyfx article)

  • Pivot points is a popular and easy way that traders can identify potential support and resistance
  • Pivot points are based on a mathematical calculation that uses the previous high, low and close of a specified period; weekly, daily, monthly, yearly
  • Yearly pivots can forecast maximum and minimum price extremes for the coming year as well as areas where price can change direction.

While most traders are familiar with daily, weekly, and even monthly pivots which fit their type of trading, yearly pivots can also be used to forecast future potential support and resistance areas. Buying at or near a significant area of support and selling at a key area of resistance is the main focus of any trader no matter what the market or the duration traded. Yearly pivots can be monitored for those key trading opportunities.

As you can clearly see in the Euro chart above, forex yearly pivots have been plotted. Notice how the Euro rallied up to the R2 pivot and turned around sharply falling over 600 pips in February. Another significant area that can be easily seen showing the power of yearly pivots is the triple touch of the R1 yearly pivot at 1.2910. The third and final touch led to over a 600-pip rally back to the R2 yearly pivot to close out 2013 up over 4%.

Could forex yearly pivots show traders the next move in the Euro? In the chart above the 2014 yearly pivots are plotted on the EURUSD chart. The year is just getting started and the great thing about yearly pivots is only having to draw them once a year! EURUSD is trapped between the central pivot at 1.3461 and R1 at 1.4177. As at the time of this writing, the Euro has not tested either pivot. However, forex traders may be waiting for a move down to the central pivot (1.3461) for a move back toward the R1 (1.4177) yearly pivot resistance.

Alternative scenario is for the Euro to make an immediate run for it up to the R1 level. At R1 pivot resistance, traders may look to take profit on their longs and/or short the Euro at this level. However, a close above R1 could lead to a move higher to the R2 pivot (1.4610). Traders should also consider the possibility of a close below the central pivot that could lead to a prolonged down push to the S1 (1.3028) level.

Forex traders who scalpers, position or swing traders can make use of yearly pivots to locate key areas of support and resistance. Look for future articles on other currency pairs that lay out the yearly pivot ‘landscape’ to help you navigate the forex market.