Nicolas

Top Bottom indicator

Category: Indicators By: Nicolas Created: October 8, 2020, 9:31 AM
October 8, 2020, 9:31 AM
Indicators
13 Comments
Top Bottom indicator

The Top and Bottom indicator is using the breakout of the most recent tops and bottoms of the last x periods to start counting the number of bars elapsed since the events.

  • When the bars count of the last bearish breakout is higher than the bars count of the last bullish breakout, a buy signal is generated.
  • When the bars count of the last bullish breakout is higher than the bars count of the last bearish breakout, a sell signal is generated.

Code converted from another trading platform programming language, as per a request in the indicators forum.

 

//PRC_Top Bottom | indicator
//08.10.2020
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings 
per = 14 //Bottom Period
per2 = 14 //Top Period
// --- end of settings 

loc = low < lowest[per](low[1]) and low <= lowest[per](low[per])
if loc then 
 locstart=barindex
endif 
bottom = barindex-locstart

loc2 = high > highest[per2](high[1]) and high >= highest[per2](high[per2])
if loc2 then 
 loc2start=barindex
endif
top = barindex-loc2start 

iBuy = bottom crosses over top 
iSell = bottom crosses under top 

if iBuy then 
 drawtext("Buy",barindex,bottom-4,dialog,bold,20) coloured(0,128,0)
endif
if iSell then 
 drawtext("Sell",barindex,top-4, dialog,bold,20) coloured(255,0,0)
endif

if top<bottom then 
 backgroundcolor(0,255,0,50)
else
 backgroundcolor(255,0,0,50)
endif

return bottom coloured(0,0,255) style(line,2) as "bottom", top coloured(255,0,0) style(line,2) as "top"

 

Download
Filename: PRC_Top-Bottom-Indicator.itf
Downloads: 869
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

PHAN100
5 years ago
#

bonjour, j'ai un bug sur le programme recopié prorealtime me dit qu'il y a un problème à la ligne 14, caractère 6.. j'ai tout bien recopié , je ne comprends pas. si quelqu'un peut m'aider? merci.

wtangsiri
5 years ago
#

C'est exactement le même signal que donne le croisement et le décroisement de deux EMA (7 et 20), comme par hasard ?

Manu L.
6 years ago
#

Bonjour Nicolas, j'ai créé un screener avec l'aide à la prog en TF weekly mais je voudrais adapter celui-ci en monthly. Une solution ? ignored, indicator1 = CALL "PRC_Top Bottom Indicator"[3, 4] c1 = (indicator1[1] > 0) ignored, indicator2 = CALL "PRC_Top Bottom Indicator"[3, 4] c2 = (indicator2 = 0) SCREENER[c1 AND c2] ((close/DClose(1)-1)*100 AS "% Veille")

superprof
6 years ago
#

salut merci pour ton indicateur. Pour bien comprendre , si suis acheteur à quelle comment je dois sortir du Trade ( graphiquent ??) et idem si je suis vendeur a quelle moment je ferme ma position. Merci beaucoup

Nicolas
6 years ago
#

A discrétion, bon courage dans ton apprentissage du trading.

LAMARRE
6 years ago
#

Bonjour Nicolas, est ce que ton indicateur est utilisable sur toutes les UT ? Et sur la dernière version de PRT ? Meri pour ton retour

Nicolas
6 years ago
#

Oui, il peut être appliqué sur toutes les unités de temps et fonctionne sur prorealtime v11.

im3hdvpcyxlh
6 years ago
#

Hi Nicolas. Is it possible to screen for those giving iBuy signal yesterday? Even better - those that were iSell 2 days ago? TIA

im3hdvpcyxlh
6 years ago
#

I would like to implement screener for the first bar that signals now an iSell to iBuy state change, from previous bar[1] to latest bar, signaling a buy opportunity (and vice versa)

Nicolas
6 years ago
#

I don't know how what signals you are talking about, where and when? To get signals from the indicator just test if the Top value crosses over or under the Bottom one.

Madrosat
6 years ago
#

Bonjour Je sèche quelqu'un peut il me détailler précisement cette ligne loc = low < lowest[per](low[1]) and low <= lowest[per](low[per])

Alai-n
6 years ago
#

https://www.prorealcode.com/trading-programming-services/ ;)

Xtian
6 years ago
#

Bonjour Nicolas, est-il possible de vous contacter en message privé pour une demande d'un développement spécifique sur PRT ?

ProRealCode ProRealCode
Loading...