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.
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"
You must be logged in to post a comment.
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")
Hi Nicolas. Is it possible to screen for those giving iBuy signal yesterday? Even better - those that were iSell 2 days ago? TIA
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)
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.