0% found this document useful (0 votes)
99 views

b4 Scanner v2.2

This document contains the code for the B4 Scanner trading tool. It includes headers noting that the code is free to use but must include credits, and the author assumes no liability. It also provides version history and contact information. The code defines multiple trading indicators including MACD, Bollinger Bands, RSI, stochastic, Fibonacci supertrend, and combines them using Boolean logic into single buy and sell signals.

Uploaded by

Juan Aponte
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views

b4 Scanner v2.2

This document contains the code for the B4 Scanner trading tool. It includes headers noting that the code is free to use but must include credits, and the author assumes no liability. It also provides version history and contact information. The code defines multiple trading indicators including MACD, Bollinger Bands, RSI, stochastic, Fibonacci supertrend, and combines them using Boolean logic into single buy and sell signals.

Uploaded by

Juan Aponte
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

# B4 Scanner

#
# Free for use. Header credits must be included when any form of the code included
in this package is used.
# User assumes all risk. Author not responsible for errors or use of tool.
# Join us at https://discord.gg/kD3pKE2CQd
#
#
# v1.2 - Assembled by Chuck Edwards
# v2.0 - Barbaros - Scanner Update, removed Market Forecast, HULL Concavity and
Squeeze due to ToS limitation
# v2.1 - Barbaros - Separated out BullBear options for combinations
# v2.2 - Barbaros - Removed BOP for efficiency

### MACDBB

input MACDBB_FastLength = 12;


input MACDBB_SlowLength = 26;
input MACDBB_BandLength = 15;
input MACDBB_Length = 25;
input MACDBB_NumDev = 1.0;

def MACDBB_Data = MACD(fastLength = MACDBB_FastLength, slowLength =


MACDBB_SlowLength, MACDLength = 5);
def MACDBB_Upper = reference BollingerBands(price = MACDBB_Data, length =
MACDBB_BandLength,
Num_Dev_Dn = -MACDBB_NumDev,
Num_Dev_Up = MACDBB_NumDev).UpperBand;;
def MACDBB_Lower = reference BollingerBands(price = MACDBB_Data, length =
MACDBB_BandLength,
Num_Dev_Dn = -MACDBB_NumDev,
Num_Dev_Up = MACDBB_NumDev).Lowerband;
def MACDBB_Buy = MACDBB_Data > MACDBB_Upper;
def MACDBB_Sell = MACDBB_Data <= MACDBB_Lower;

### RSI/STOCASTIC/MACD CONFLUENCE COMBO

def RSM_MACD_Diff = reference MACD(fastLength = 12, slowLength = 26, MACDLength =


9).Diff;
def RSM_MACD_ZeroLine = 0;
def RSM_RSI = reference RSI(length = 7).RSI;
def RSM_Stoch_Val = 100 * (close - lowest(low, 14)) / (highest(high, 14) -
lowest(low, 14));
def RSM_StochSlowK = SimpleMovingAvg(SimpleMovingAvg(RSM_Stoch_Val,3),3);

def RSM_rsiGreen = RSM_RSI >= 50;


def RSM_rsiRed = RSM_RSI < 50;
def RSM_stochGreen = RSM_StochSlowK >= 50;
def RSM_stochRed = RSM_StochSlowK < 50;
def RSM_macdGreen = RSM_MACD_Diff >= 0;
def RSM_macdRed = RSM_MACD_Diff < 0;
def RSM_Buy = RSM_rsiGreen and RSM_stochGreen and RSM_macdGreen;
def RSM_Sell = RSM_rsiRed and RSM_stochRed and RSM_macdRed;

### RSI IFT

def RSI_IFT_R = reference RSI(5, close) - 50;


def RSI_IFT_AvgRSI = MovingAverage(AverageType.Exponential,RSI_IFT_R,9);
def RSI_IFT_InverseRSI = (Power(Double.E, 2 * RSI_IFT_AvgRSI) - 1) /
(Power(Double.E, 2 * RSI_IFT_AvgRSI) + 1);
def RSI_IFT_Direction = if BarNumber() == 0 then 0
else if (RSI_IFT_InverseRSI[1] > 0) and (RSI_IFT_InverseRSI
< 0) then -1
else if (RSI_IFT_InverseRSI > 0) and (RSI_IFT_InverseRSI[1]
< 0) then 1
else RSI_IFT_Direction[1];

### Fibonacci SuperTrend

input FST_Length = 11;


input FST_Retrace = 23.6;
input FST_UseHighLow = yes;

def FST_h = if FST_UseHighLow then high else close;


def FST_l = if FST_UseHighLow then low else close;
def FST_minL = Lowest(FST_l, FST_Length);
def FST_maxH = Highest(FST_h, FST_Length);

def FST_hh = if FST_h > FST_maxH[1] then FST_h else FST_hh[1];


def FST_ll = if FST_l < FST_minL[1] then FST_l else FST_ll[1];
def FST_trend = if FST_h > FST_maxH[1] then 1 else if FST_l < FST_minL[1] then -1
else FST_trend[1];
def FST_Direction = if BarNumber() == 0 then 0
else if FST_trend != 1 then -1
else if FST_trend == 1 then 1
else FST_Direction[1];

### Strategy

input BullBear_Include_FST = yes; #hint BullBear_Include_FST: Include


Fibonacci SuperTrend in the vertical line strategy
input BullBear_Include_RSI_IFT = yes; #hint BullBear_Include_RSI_IFT: Include RSI
IFT in the vertical line strategy

def BullBear_Buy = (!BullBear_Include_FST or FST_Direction == 1) and


(!BullBear_Include_RSI_IFT or RSI_IFT_Direction == 1);
def BullBear_Sell = (!BullBear_Include_FST or FST_Direction == -1) and
(!BullBear_Include_RSI_IFT or RSI_IFT_Direction == -1);

def Strategy_Buy = BullBear_Buy and MACDBB_Buy and RSM_Buy;


def Strategy_Sell = BullBear_Sell and MACDBB_Sell and RSM_Sell;

plot StrategyArrow = if Strategy_Buy and !Strategy_Buy[1] then 1


else if Strategy_Sell and !Strategy_Sell[1] then -1
else 0;

You might also like