Nicolas

BSTrend

Category: Indicators By: Nicolas Created: November 5, 2018, 9:18 AM
November 5, 2018, 9:18 AM
Indicators
10 Comments
BSTrend

The BSTrend indicator shows you the prevailing currency trend. Blue bars indicate uptrend (1). Violet bars indicate downtrend (-1).

Trading Signals:

  • BUY: Wait for the first blue bar.
  • SELL: Wait for the first violet bar.

(converted from MT4 version by request in the English forum).

//PRC_BStrend | indicator
//05.11.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MT4 indicator

// --- settings 
period=12
// --- end of settings 

if barindex>period then 
 ld104 = highest[period](high)
 ld96 = lowest[period](low)
 ld16 = (High[0] + Low[0]) / 2.0
 ld48 = 0.66 * ((ld16 - ld96) / (ld104 - ld96) - 0.5) + 0.67 * ld56
 ld48 = Min(Max(ld48, -0.999), 0.999)
 gda80 = Log((ld48 + 1.0) / (1 - ld48)) / 2.0 + ld80 / 2.0
 ld56 = ld48
 ld80 = gda80

 li124 = 1
 ld8 = gda80[0]
 ld0 = gda80[1]
 if ((ld8 < 0.0 and ld0 > 0.0) or ld8 < 0.0) then 
  li124 = 0//FALSE;
 endif
 if ((ld8 > 0.0 and ld0 < 0.0) or ld8 > 0.0) then 
  li124 = 1//TRUE;
 endif
 if (li124=0) then
  gs92 = -1 //"Downtrend"
  r=238
  g=130
  b=238
 else 
  gs92 = 1 //"Uptrend"
  r=0
  g=191
  b=255  
 endif
endif

return gs92 coloured(r,g,b) as "BS Trend"

 

Download
Filename: PRC_BStrend.itf
Downloads: 414
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

Rohit82189
6 years ago
#

bstrend repaints

Nicolas
6 years ago
#

No, it doesn't repaint.

JvdG
8 years ago
#

I meant of course: since ld56 is one of the constituents of ld48;

JvdG
8 years ago
#

Hi Nicolas, ld48 = 0.66 * ((ld16 - ld96) / (ld104 - ld96) - 0.5) + 0.67 * ld56 ld48 = Min(Max(ld48, -0.999), 0.999) you assign two different expressions to the same parameter (ld48)... ld56 = ld48: this seems to me a circular code since ld48 is one of the constituents of ld56; ld80 = gda80: something similar goes for this assignment; The solution maybe is to give your parameters real names. That forces you to make clear what they refer to and it gives me an opportunity to elaborate on it. Best regards, Jerke van der Geest

Nicolas
8 years ago
#

You are right about ld56. Since this is a translation from another programming language, I did it like a robot :) About ld48 referencing itself, it is normal, ld48 is comparing its own value with other Min/Max values and updating automatically this way.

SAM
SAM
8 years ago
#

Thanks!!

Florian Legeard
8 years ago
#

C’est à dire sur le prix et non sur le temps ? Merci

SAM
SAM
8 years ago
#

Hi Nicolas, Thank for this code.... i look that the picture that you have posted is for a tick-grafic. What is the best time frame for this indicator?

Nicolas
8 years ago
#

I would prefer non time dependent "timeframe". For any indicator, in my opinion, it is always better to rely only on price and not on time passing by..

Teddy Coronak
8 years ago
#

Merci Nicolas pour ce fabuleux indicateur. Top!!! Après avoir fait mes tests.

ProRealCode ProRealCode
Loading...