AD

User info

Welcome, Guest! Please login or register.


You are here » AD » WOW.that's literally me » #8 investing.com


#8 investing.com

Posts 91 to 99 of 99

91

//@version=3
study(title="Donchain Keltner Channels", shorttitle="DKC", overlay=true)
length = input(20, minval=1)
lower = lowest(length)
upper = highest(length)
basis = avg(upper, lower)
l = plot(lower, color=blue, title="Lower DC")
u = plot(upper, color=blue, title="Upper DC")
plot(basis, color=orange, title="Basis DC")
fill(u, l, color=blue)

useTrueRange = input(true)
length2 = input(20, minval=1)
mult = input(1.0)
src = input(close, title="Source")

ma = ema(src, length2)
range = useTrueRange ? tr : high - low
rangema = ema(range, length2)
upper2 = ma + rangema * mult
lower2 = ma - rangema * mult
c = blue
u2 = plot(upper2, color=c, title="Upper KC")
plot(ma, color=c, title="Basis KC")
l2 = plot(lower2, color=c, title="Lower KC")
fill(u2, l2, color=c)

0

92

Это индикатор для торговой платформы МТ4
https://forexsystemru.com/threads/arkhi … st-1994738

//+------------------------------------------------------------------+
//|                       RSI_Bands_MTF_Triple.mq4                   |
//+------------------------------------------------------------------+
#property copyright   "Based on LazyBear's RSI Bands"
#property description "Triple MTF RSI Bands by DemaN_FxMen"
#property version     "2.0"

#property indicator_chart_window
#property indicator_buffers 15
#property indicator_color1  clrRed
#property indicator_color2  clrGreen
#property indicator_color3  clrNavy
#property indicator_color4  clrGold
#property indicator_color5  clrGold
#property indicator_color6  clrRed
#property indicator_color7  clrGreen
#property indicator_color8  clrNavy
#property indicator_color9  clrGold
#property indicator_color10 clrGold
#property indicator_color11 clrRed
#property indicator_color12 clrGreen
#property indicator_color13 clrNavy
#property indicator_color14 clrGold
#property indicator_color15 clrGold
#property indicator_width1  2
#property indicator_width2  2
#property indicator_width3  1
#property indicator_width4  1
#property indicator_width5  1
#property indicator_width6  2
#property indicator_width7  2
#property indicator_width8  1
#property indicator_width9  1
#property indicator_width10 1
#property indicator_width11 2
#property indicator_width12 2
#property indicator_width13 1
#property indicator_width14 1
#property indicator_width15 1
#property indicator_style4 DRAW_ARROW
#property indicator_style5 DRAW_ARROW
#property indicator_style9 DRAW_ARROW
#property indicator_style10 DRAW_ARROW
#property indicator_style14 DRAW_ARROW
#property indicator_style15 DRAW_ARROW
#property indicator_type4  DRAW_ARROW
#property indicator_type5  DRAW_ARROW
#property indicator_type9  DRAW_ARROW
#property indicator_type10 DRAW_ARROW
#property indicator_type14 DRAW_ARROW
#property indicator_type15 DRAW_ARROW

//--- входные параметры для индикатора 1
input string SECTION1 = "========= Индикатор 1 =========";
input ENUM_TIMEFRAMES TimeFrame1 = PERIOD_CURRENT;
input int  RSILength1 = 14;
input int  OB1 = 70;
input int  OS1 = 30;
input bool ShowIndicator1 = true;
input bool ShowArrows1    = true;

//--- входные параметры для индикатора 2
input string SECTION2 = "========= Индикатор 2 =========";
input ENUM_TIMEFRAMES TimeFrame2 = PERIOD_CURRENT;
input int  RSILength2 = 20;
input int  OB2 = 65;
input int  OS2 = 35;
input bool ShowIndicator2 = true;
input bool ShowArrows2    = true;

//--- входные параметры для индикатора 3
input string SECTION3 = "========= Индикатор 3 =========";
input ENUM_TIMEFRAMES TimeFrame3 = PERIOD_CURRENT;
input int  RSILength3 = 10;
input int  OB3 = 75;
input int  OS3 = 25;
input bool ShowIndicator3 = true;
input bool ShowArrows3    = true;

//--- буферы отображения для индикатора 1
double ubBuffer1[];
double lbBuffer1[];
double midBuffer1[];
double buyArrow1[];
double sellArrow1[];

//--- буферы отображения для индикатора 2
double ubBuffer2[];
double lbBuffer2[];
double midBuffer2[];
double buyArrow2[];
double sellArrow2[];

//--- буферы отображения для индикатора 3
double ubBuffer3[];
double lbBuffer3[];
double midBuffer3[];
double buyArrow3[];
double sellArrow3[];

//--- глобальные массивы для расчетов
double aucArray[], adcArray[], upArray[], downArray[];
double closeArray[];

//+------------------------------------------------------------------+
int OnInit()
{
   //--- инициализация буферов индикатора 1
   SetIndexBuffer(0, ubBuffer1);
   SetIndexLabel(0, "Resistance 1");
   SetIndexBuffer(1, lbBuffer1);
   SetIndexLabel(1, "Support 1");
   SetIndexBuffer(2, midBuffer1);
   SetIndexLabel(2, "Midline 1");
   SetIndexBuffer(3, buyArrow1);
   SetIndexLabel(3, "Buy Signal 1");
   SetIndexArrow(3, 233);
   SetIndexBuffer(4, sellArrow1);
   SetIndexLabel(4, "Sell Signal 1");
   SetIndexArrow(4, 234);
   
   //--- инициализация буферов индикатора 2
   SetIndexBuffer(5, ubBuffer2);
   SetIndexLabel(5, "Resistance 2");
   SetIndexBuffer(6, lbBuffer2);
   SetIndexLabel(6, "Support 2");
   SetIndexBuffer(7, midBuffer2);
   SetIndexLabel(7, "Midline 2");
   SetIndexBuffer(8, buyArrow2);
   SetIndexLabel(8, "Buy Signal 2");
   SetIndexArrow(8, 233);
   SetIndexBuffer(9, sellArrow2);
   SetIndexLabel(9, "Sell Signal 2");
   SetIndexArrow(9, 234);
   
   //--- инициализация буферов индикатора 3
   SetIndexBuffer(10, ubBuffer3);
   SetIndexLabel(10, "Resistance 3");
   SetIndexBuffer(11, lbBuffer3);
   SetIndexLabel(11, "Support 3");
   SetIndexBuffer(12, midBuffer3);
   SetIndexLabel(12, "Midline 3");
   SetIndexBuffer(13, buyArrow3);
   SetIndexLabel(13, "Buy Signal 3");
   SetIndexArrow(13, 233);
   SetIndexBuffer(14, sellArrow3);
   SetIndexLabel(14, "Sell Signal 3");
   SetIndexArrow(14, 234);
   
   //--- установка стилей отрисовки
   ArraySetAsSeries(ubBuffer1, true);
   ArraySetAsSeries(lbBuffer1, true);
   ArraySetAsSeries(midBuffer1, true);
   ArraySetAsSeries(buyArrow1, true);
   ArraySetAsSeries(sellArrow1, true);
   ArraySetAsSeries(ubBuffer2, true);
   ArraySetAsSeries(lbBuffer2, true);
   ArraySetAsSeries(midBuffer2, true);
   ArraySetAsSeries(buyArrow2, true);
   ArraySetAsSeries(sellArrow2, true);
   ArraySetAsSeries(ubBuffer3, true);
   ArraySetAsSeries(lbBuffer3, true);
   ArraySetAsSeries(midBuffer3, true);
   ArraySetAsSeries(buyArrow3, true);
   ArraySetAsSeries(sellArrow3, true);
   
   ArraySetAsSeries(aucArray, true);
   ArraySetAsSeries(adcArray, true);
   ArraySetAsSeries(upArray, true);
   ArraySetAsSeries(downArray, true);
   ArraySetAsSeries(closeArray, true);

   Comment("Triple MTF RSI Bands © 2025, DemaN_FxMen");
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Функция расчета полос RSI для конкретных параметров              |
//+------------------------------------------------------------------+
void CalculateRSIBands(int length, int ob, int os, ENUM_TIMEFRAMES tf,
                      double &ubBuffer[], double &lbBuffer[], double &midBuffer[],
                      double &buyArrow[], double &sellArrow[], bool showIndicator, bool showArrows)
{
   if(!showIndicator) return;
   
   int rates_total = Bars;
   if(rates_total < length + 10) return;
   
   int ep = 2 * length - 1;
   int start = rates_total - length - 10;
   if(start < 1) start = 1;
   
   //--- подготовка массивов для расчета
   ArrayResize(upArray, rates_total);
   ArrayResize(downArray, rates_total);
   ArrayResize(aucArray, rates_total);
   ArrayResize(adcArray, rates_total);
   ArrayResize(closeArray, rates_total);
   
   //--- копируем данные с нужного таймфрейма
   CopyClose(_Symbol, tf, 0, rates_total, closeArray);
   
   //--- Расчёт дельты
   for(int i = start; i >= 1; i--)
   {
      double change = closeArray[i] - closeArray[i + 1];
      upArray[i] = (change > 0) ? change : 0;
      downArray[i] = (change < 0) ? -change : 0;
   }
   
   //--- Основной цикл расчёта
   for(int j = rates_total - 2; j >= 1; j--)
   {
      aucArray[j] = iMAOnArray(upArray, rates_total, ep, 0, MODE_EMA, j);
      adcArray[j] = iMAOnArray(downArray, rates_total, ep, 0, MODE_EMA, j);
     
      double x1 = (length - 1) * (adcArray[j] * ob / (100.0 - ob) - aucArray[j]);
      double x2 = (length - 1) * (adcArray[j] * os / (100.0 - os) - aucArray[j]);
     
      double ub = (x1 >= 0) ? closeArray[j] + x1 : closeArray[j] + x1 * (100.0 - ob) / ob;
      double lb = (x2 >= 0) ? closeArray[j] + x2 : closeArray[j] + x2 * (100.0 - os) / os;
     
      ubBuffer[j] = ub;
      lbBuffer[j] = lb;
      midBuffer[j] = (ub + lb) / 2.0;
     
      //--- Расчет стрелок
      if(showArrows)
      {
         // BUY: предыдущая цена ниже lb, текущая выше lb
         if(closeArray[j + 1] < lbBuffer[j + 1] && closeArray[j] > lb)
            buyArrow[j] = Low[j] - (10 * Point);
         else
            buyArrow[j] = EMPTY_VALUE;

         // SELL: предыдущая цена выше ub, текущая ниже ub
         if(closeArray[j + 1] > ubBuffer[j + 1] && closeArray[j] < ub)
            sellArrow[j] = High[j] + (10 * Point);
         else
            sellArrow[j] = EMPTY_VALUE;
      }
      else
      {
         buyArrow[j] = EMPTY_VALUE;
         sellArrow[j] = EMPTY_VALUE;
      }
   }
}

//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   //--- расчет первого индикатора
   CalculateRSIBands(RSILength1, OB1, OS1, TimeFrame1, ubBuffer1, lbBuffer1, midBuffer1, buyArrow1, sellArrow1, ShowIndicator1, ShowArrows1);
   
   //--- расчет второго индикатора
   CalculateRSIBands(RSILength2, OB2, OS2, TimeFrame2, ubBuffer2, lbBuffer2, midBuffer2, buyArrow2, sellArrow2, ShowIndicator2, ShowArrows2);
   
   //--- расчет третьего индикатора
   CalculateRSIBands(RSILength3, OB3, OS3, TimeFrame3, ubBuffer3, lbBuffer3, midBuffer3, buyArrow3, sellArrow3, ShowIndicator3, ShowArrows3);
   
   return rates_total;
}
//+------------------------------------------------------------------+

0

93

RSIBAND_LB

//
// @author LazyBear
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study("RSI Bands [LazyBear]", shorttitle="RSIBANDS_LB", overlay=true)
obLevel = input(70, title="RSI Overbought")
osLevel = input(30, title="RSI Oversold")
length = input(14, title="RSI Length")
src=close
ep = 2 * length - 1
auc = ema( max( src - src[1], 0 ), ep )
adc = ema( max( src[1] - src, 0 ), ep )
x1 = (length - 1) * ( adc * obLevel / (100-obLevel) - auc)
ub = iff( x1 >= 0, src + x1, src + x1 * (100-obLevel)/obLevel )
x2 = (length - 1) * ( adc * osLevel / (100-osLevel) - auc)
lb = iff( x2 >= 0, src + x2, src + x2 * (100-osLevel)/osLevel )

plot( ub, title="Resistance", color=red, linewidth=2)
plot( lb, title="Support", color=green, linewidth=2)
plot( avg(ub, lb), title="RSI Midline", color=gray, linewidth=1)

0

94

EMA 28 HL/2

//@version=6
indicator(title="Moving Average Exponential", shorttitle="EMA", overlay=true, timeframe="", timeframe_gaps=true)
len = input.int(9, minval=1, title="Length")
src = input(close, title="Source")
offset = input.int(title="Offset", defval=0, minval=-500, maxval=500, display = display.data_window)
out = ta.ema(src, len)
plot(out, title="EMA", color=color.blue, offset=offset)

// Smoothing MA inputs
GRP = "Smoothing"
TT_BB = "Only applies when 'SMA + Bollinger Bands' is selected. Determines the distance between the SMA and the bands."
maTypeInput = input.string("None", "Type", options = ["None", "SMA", "SMA + Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group = GRP, display = display.data_window)
maLengthInput = input.int(14, "Length", group = GRP, display = display.data_window)
bbMultInput = input.float(2.0, "BB StdDev", minval = 0.001, maxval = 50, step = 0.5, tooltip = TT_BB, group = GRP, display = display.data_window)
var enableMA = maTypeInput != "None"
var isBB = maTypeInput == "SMA + Bollinger Bands"

// Smoothing MA Calculation
ma(source, length, MAtype) =>
switch MAtype
    "SMA"                   => ta.sma(source, length)
    "SMA + Bollinger Bands" => ta.sma(source, length)
    "EMA"                   => ta.ema(source, length)
    "SMMA (RMA)"            => ta.rma(source, length)
    "WMA"                   => ta.wma(source, length)
    "VWMA"                  => ta.vwma(source, length)

// Smoothing MA plots
smoothingMA = enableMA ? ma(out, maLengthInput, maTypeInput) : na
smoothingStDev = isBB ? ta.stdev(out, maLengthInput) * bbMultInput : na
plot(smoothingMA, "EMA-based MA", color=color.yellow, display = enableMA ? display.all : display.none, editable = enableMA)
bbUpperBand = plot(smoothingMA + smoothingStDev, title = "Upper Bollinger Band", color=color.green, display = isBB ? display.all : display.none, editable = isBB)
bbLowerBand = plot(smoothingMA - smoothingStDev, title = "Lower Bollinger Band", color=color.green, display = isBB ? display.all : display.none, editable = isBB)
fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill", display = isBB ? display.all : display.none, editable = isBB)

0

95

RSIBANDS 

HIGH
LOW

--------------

//
// @author LazyBear
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study("RSI Bands [LazyBear]", shorttitle="RSI_BANDS_HIGH", overlay=true)
obLevel = input(70, title="RSI Overbought")
osLevel = input(30, title="RSI Oversold")
length = input(14, title="RSI Length")
src=high
ep = 2 * length - 1
auc = ema( max( src - src[1], 0 ), ep )
adc = ema( max( src[1] - src, 0 ), ep )
x1 = (length - 1) * ( adc * obLevel / (100-obLevel) - auc)
ub = iff( x1 >= 0, src + x1, src + x1 * (100-obLevel)/obLevel )
x2 = (length - 1) * ( adc * osLevel / (100-osLevel) - auc)
lb = iff( x2 >= 0, src + x2, src + x2 * (100-osLevel)/osLevel )

plot( ub, title="Resistance", color=blue, linewidth=2)
plot( lb, title="Support", color=white, linewidth=2)
plot( avg(ub, lb), title="RSI Midline", color=orange, linewidth=1)



------------------------

//
// @author LazyBear
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study("RSI Bands [LazyBear]", shorttitle="RSI_BANDS_LOW", overlay=true)
obLevel = input(70, title="RSI Overbought")
osLevel = input(30, title="RSI Oversold")
length = input(14, title="RSI Length")
src=low
ep = 2 * length - 1
auc = ema( max( src - src[1], 0 ), ep )
adc = ema( max( src[1] - src, 0 ), ep )
x1 = (length - 1) * ( adc * obLevel / (100-obLevel) - auc)
ub = iff( x1 >= 0, src + x1, src + x1 * (100-obLevel)/obLevel )
x2 = (length - 1) * ( adc * osLevel / (100-osLevel) - auc)
lb = iff( x2 >= 0, src + x2, src + x2 * (100-osLevel)/osLevel )

plot( ub, title="Resistance", color=white, linewidth=2)
plot( lb, title="Support", color=blue, linewidth=2)
plot( avg(ub, lb), title="RSI Midline", color=orange, linewidth=1)

0

96

//@version=6

indicator('<[Расширенный двойной конверт HL MTF]>', '<[ADHL-Env-MTF]>', true)
// Настройки МТФ
mtf = input.timeframe('', 'Таймфрейм')

// ВЫБОР ТИПА МУВИНГА
ma_type = input.string('EMA', 'Тип мувинга', options = ['SMA', 'EMA', 'WMA', 'Hull MA', 'VWMA', 'TEMA', 'JMA', 'LSMA', 'ALMA', 'Vidya', 'ZLEMA', 'FRAMA'])

ma_length = input.int(9, 'Период мувинга')
ma_source = input.source(hl2, 'Источник для MA')

// Дополнительные параметры для некоторых MA
ma_offset = input.int(0, 'Смещение MA')
jma_power = input.float(2.0, 'JMA: Мощность', minval = 1, maxval = 10, step = 0.1)
alma_offset = input.float(0.85, 'ALMA: Смещение', minval = 0, maxval = 1, step = 0.01)
alma_sigma = input.float(6.0, 'ALMA: Сигма', minval = 1, maxval = 10, step = 0.1)

// Настройки конвертов
lookback1 = input.int(5, 'Период волатильности 1')
mult1 = input.float(1.0, 'Множитель 1', step = 0.1)
lookback2 = input.int(10, 'Период волатильности 2')
mult2 = input.float(1.0, 'Множитель 2', step = 0.1)

// Получаем данные с нужного ТФ
src = request.security(syminfo.tickerid, mtf, ma_source)
high_mtf = request.security(syminfo.tickerid, mtf, high)
low_mtf = request.security(syminfo.tickerid, mtf, low)

// ФУНКЦИИ РАСЧЕТА РАЗНЫХ MA
// Hull Moving Average
hma(_src, _length) =>
    _wma1 = ta.wma(_src, _length / 2)
    _wma2 = ta.wma(_src, _length)
    2 * _wma1 - _wma2

// Volume Weighted Moving Average
vwma(_src, _length) =>
    _sum = math.sum(_src * volume, _length)
    _vol = math.sum(volume, _length)
    _sum / _vol

// Triple Exponential Moving Average
tema(_src, _length) =>
    _ema1 = ta.ema(_src, _length)
    _ema2 = ta.ema(_ema1, _length)
    _ema3 = ta.ema(_ema2, _length)
    3 * _ema1 - 3 * _ema2 + _ema3

// Jurik Moving Average (упрощенная версия)
jma(_src, _length, _power) =>
    _beta = 0.45 * (_length - 1) / (0.45 * (_length - 1) + 2)
    _alpha = math.pow(_beta, _power)
    _jma = 0.0
    _jma := _alpha * _src + (1 - _alpha) * nz(_jma[1])
    _jma

// Least Squares Moving Average
lsma(_src, _length) =>
    _sum_x = _length * (_length - 1) / 2
    _sum_x2 = _length * (_length - 1) * (2 * _length - 1) / 6
    _sum_xy = 0.0
    _sum_y = 0.0
    for i = 0 to _length - 1 by 1
        _sum_xy := _sum_xy + i * _src[i]
        _sum_y := _sum_y + _src[i]
        _sum_y
    _slope = (_length * _sum_xy - _sum_x * _sum_y) / (_length * _sum_x2 - _sum_x * _sum_x)
    _intercept = (_sum_y - _slope * _sum_x) / _length
    _intercept + _slope * (_length - 1)

// Arnaud Legoux Moving Average
alma(_src, _length, _offset, _sigma) =>
    _m = math.floor(_offset * (_length - 1))
    _s = _length / _sigma
    _weights = array.new_float(0)
    _norm = 0.0
    for i = 0 to _length - 1 by 1
        _w = math.exp(-math.pow(i - _m, 2) / (2 * math.pow(_s, 2)))
        array.push(_weights, _w)
        _norm := _norm + _w
        _norm
    _sum = 0.0
    for i = 0 to _length - 1 by 1
        _sum := _sum + _src[i] * array.get(_weights, i)
        _sum
    _sum / _norm

// Variable Index Dynamic Average
vidya(_src, _length) =>
    _cmos = math.abs(ta.change(_src, 9)) / ta.atr(9)
    _alpha = 2.0 / (_length + 1)
    _vidya = 0.0
    _vidya := _alpha * _cmos * _src + (1 - _alpha * _cmos) * nz(_vidya[1])
    _vidya

// Zero-Lag EMA
zlema(_src, _length) =>
    _lag = math.round((_length - 1) / 2)
    _zlsrc = _src + _src - _src[_lag]
    ta.ema(_zlsrc, _length)

// Fractal Adaptive Moving Average
frama(_src, _length) =>
    float _n1 = math.max(ta.highest(_length), ta.lowest(_length))
    float _n2 = math.max(ta.highest(_length / 2), ta.lowest(_length / 2))
    float _n3 = math.max(ta.highest(_length / 2), ta.lowest(_length / 2))
    float _dimen = 1.0
    if _n1 > 0 and _n2 > 0 and _n3 > 0
        float _temp1 = math.log(_n1 + _n2)
        float _temp2 = math.log(_n3)
        _dimen := (_temp1 - _temp2) / math.log(2)
        _dimen
    float _alpha = math.exp(-4.6 * (_dimen - 1))
    _alpha := math.max(math.min(_alpha, 1), 0.01)
    float _frama = 0.0
    _frama := _alpha * _src + (1 - _alpha) * nz(_frama[1])
    _frama

// ВЫБОР ТИПА MA
get_ma() =>
    switch ma_type
        'SMA' => ta.sma(src, ma_length)
        'EMA' => ta.ema(src, ma_length)
        'WMA' => ta.wma(src, ma_length)
        'Hull MA' => hma(src, ma_length)
        'VWMA' => vwma(src, ma_length)
        'TEMA' => tema(src, ma_length)
        'JMA' => jma(src, ma_length, jma_power)
        'LSMA' => lsma(src, ma_length)
        'ALMA' => alma(src, ma_length, alma_offset, alma_sigma)
        'Vidya' => vidya(src, ma_length)
        'ZLEMA' => zlema(src, ma_length)
        'FRAMA' => frama(src, ma_length)

// Расчет центральной линии
center_line = get_ma()

// ПЕРВЫЙ конверт: Суммарная волатильность
total_hl_diff = 0.0
for i = 0 to lookback1 - 1 by 1
    total_hl_diff := total_hl_diff + high_mtf[i] - low_mtf[i]
    total_hl_diff

upper_band1 = center_line + total_hl_diff * mult1
lower_band1 = center_line - total_hl_diff * mult1

// ВТОРОЙ конверт: Общий диапазон
overall_high = ta.highest(high_mtf, lookback2)
overall_low = ta.lowest(low_mtf, lookback2)
hl_range = overall_high - overall_low

upper_band2 = center_line + hl_range * mult2
lower_band2 = center_line - hl_range * mult2

// Отрисовка
plot(center_line, 'Мувинг', #ff9800, 2)

// Конверт 1
u1 = plot(upper_band1, 'Верх Суммарный', #ff5252, 2)
l1 = plot(lower_band1, 'Низ Суммарный', #ff5252, 2)
fill(u1, l1, color.new(color.red, 90), 'Конверт 1')

// Конверт 2
u2 = plot(upper_band2, 'Верх Общий', #4caf50, 2)
l2 = plot(lower_band2, 'Низ Общий', #4caf50, 2)
fill(u2, l2, color.new(color.green, 90), 'Конверт 2')

// Общие High/Low
plot(overall_high, 'Общий High', #ff0057, 1, plot.style_circles)
plot(overall_low, 'Общий Low', #00ffff, 1, plot.style_circles)

var table logo = table.new(position.bottom_right, 1, 1)
table.cell(logo, 0, 0, 'DM', text_size = size.normal, text_color = #00897b)

//===========================================================================//

0

97

//@version=6

indicator('<[Расширенный двойной конверт HL MTF]>', '<[ADHL-Env-MTF]>', true)
// Настройки МТФ
mtf = input.timeframe('', 'Таймфрейм')

// ВЫБОР ТИПА МУВИНГА
ma_type = input.string('EMA', 'Тип мувинга', options = ['SMA', 'EMA', 'WMA', 'Hull MA', 'VWMA', 'TEMA', 'JMA', 'LSMA', 'ALMA', 'Vidya', 'ZLEMA', 'FRAMA'])

ma_length = input.int(9, 'Период мувинга')
ma_source = input.source(hl2, 'Источник для MA')

// Дополнительные параметры для некоторых MA
ma_offset = input.int(0, 'Смещение MA')
jma_power = input.float(2.0, 'JMA: Мощность', minval = 1, maxval = 10, step = 0.1)
alma_offset = input.float(0.85, 'ALMA: Смещение', minval = 0, maxval = 1, step = 0.01)
alma_sigma = input.float(6.0, 'ALMA: Сигма', minval = 1, maxval = 10, step = 0.1)

// Настройки конвертов
lookback1 = input.int(9, 'Период волатильности 1')
mult1 = input.float(1.0, 'Множитель 1', step = 0.1)
lookback2 = input.int(9, 'Период волатильности 2')
mult2 = input.float(1.0, 'Множитель 2', step = 0.1)

// Получаем данные с нужного ТФ
src = request.security(syminfo.tickerid, mtf, ma_source)
high_mtf = request.security(syminfo.tickerid, mtf, high)
low_mtf = request.security(syminfo.tickerid, mtf, low)

// ВЫБОР ТИПА MA
get_ma() =>
    switch ma_type
        'EMA' => ta.ema(src, ma_length)
     
// Расчет центральной линии
center_line = get_ma()

// ПЕРВЫЙ конверт: Суммарная волатильность
total_hl_diff = 0.0
for i = 0 to lookback1 - 1 by 1
    total_hl_diff := total_hl_diff + high_mtf[i] - low_mtf[i]
    total_hl_diff

upper_band1 = center_line + total_hl_diff * mult1
lower_band1 = center_line - total_hl_diff * mult1

// ВТОРОЙ конверт: Общий диапазон
overall_high = ta.highest(high_mtf, lookback2)
overall_low = ta.lowest(low_mtf, lookback2)
hl_range = overall_high - overall_low

upper_band2 = center_line + hl_range /3
lower_band2 = center_line - hl_range /3

// Отрисовка
plot(center_line, 'Мувинг', #ff9800, 2)

// Конверт 1
u1 = plot(upper_band1, 'Верх Суммарный', #ff5252, 2)
l1 = plot(lower_band1, 'Низ Суммарный', #ff5252, 2)
fill(u1, l1, color.new(color.red, 90), 'Конверт 1')

// Конверт 2
u2 = plot(upper_band2, 'Верх Общий', #4caf50, 2)
l2 = plot(lower_band2, 'Низ Общий', #4caf50, 2)
fill(u2, l2, color.new(color.green, 90), 'Конверт 2')

// Общие High/Low
plot(overall_high, 'Общий High', #ff0057, 1, plot.style_circles)
plot(overall_low, 'Общий Low', #00ffff, 1, plot.style_circles)

var table logo = table.new(position.bottom_right, 1, 1)
table.cell(logo, 0, 0, 'DM', text_size = size.normal, text_color = #00897b)

//===========================================================================//

0

98

//@version=6

indicator('<[Расширенный двойной конверт HL MTF]>', '<[ADHL-Env-MTF]>', true)
// Настройки МТФ
mtf = input.timeframe('', 'Таймфрейм')

// ВЫБОР ТИПА МУВИНГА
ma_type = input.string('EMA', 'Тип мувинга', options = ['EMA'])

ma_length = input.int(9, 'Период мувинга')
ma_source = input.source(hl2, 'Источник для MA')

// Дополнительные параметры для некоторых MA
ma_offset = input.int(0, 'Смещение MA')

// Настройки конвертов
lookback1 = input.int(9, 'Период волатильности 1')
mult1 = input.float(1.0, 'Множитель 1', step = 0.1)
lookback2 = input.int(9, 'Период волатильности 2')
mult2 = input.float(1.0, 'Множитель 2', step = 0.1)

// Получаем данные с нужного ТФ
src = request.security(syminfo.tickerid, mtf, ma_source)
high_mtf = request.security(syminfo.tickerid, mtf, high)
low_mtf = request.security(syminfo.tickerid, mtf, low)

// ВЫБОР ТИПА MA
get_ma() =>
    switch ma_type
        'EMA' => ta.ema(src, ma_length)
     
// Расчет центральной линии
center_line = get_ma()

// ПЕРВЫЙ конверт: Суммарная волатильность
total_hl_diff = 0.0
for i = 0 to lookback1 - 1 by 1
    total_hl_diff := total_hl_diff + high_mtf[i] - low_mtf[i]
    total_hl_diff

upper_band1 = center_line + total_hl_diff /3
lower_band1 = center_line - total_hl_diff /3

// ВТОРОЙ конверт: Общий диапазон
overall_high = ta.highest(high_mtf, lookback2)
overall_low = ta.lowest(low_mtf, lookback2)
hl_range = overall_high - overall_low

upper_band2 = center_line + hl_range /3
lower_band2 = center_line - hl_range /3

// Отрисовка
plot(center_line, 'Мувинг', #ff9800, 2)

// Конверт 1
u1 = plot(upper_band1, 'Верх Суммарный', #ff5252, 2)
l1 = plot(lower_band1, 'Низ Суммарный', #ff5252, 2)
fill(u1, l1, color.new(color.red, 90), 'Конверт 1')

// Конверт 2
u2 = plot(upper_band2, 'Верх Общий', #4caf50, 2)
l2 = plot(lower_band2, 'Низ Общий', #4caf50, 2)
fill(u2, l2, color.new(color.green, 90), 'Конверт 2')

// Общие High/Low
plot(overall_high, 'Общий High', color.rgb(206, 23, 223), 1, plot.style_circles)
plot(overall_low, 'Общий Low', #e017e0, 1, plot.style_circles)

var table logo = table.new(position.bottom_right, 1, 1)
table.cell(logo, 0, 0, 'DM', text_size = size.normal, text_color = #00897b)

//===========================================================================//

0

99

//@version=6

indicator('<[Расширенный двойной конверт HL MTF]>', '<[ADHL-Env-MTF]>', true)
// Настройки МТФ
mtf = input.timeframe('', 'Таймфрейм')

// ВЫБОР ТИПА МУВИНГА
ma_type = input.string('EMA', 'Тип мувинга', options = ['EMA'])

ma_length = input.int(9, 'Период мувинга')
ma_source = input.source(hl2, 'Источник для MA')

// Дополнительные параметры для некоторых MA
ma_offset = input.int(0, 'Смещение MA')

// Настройки конвертов
lookback1 = input.int(15, 'Период волатильности 1')
mult1 = input.float(1.0, 'Множитель 1', step = 0.1)
lookback2 = input.int(15, 'Период волатильности 2')
mult2 = input.float(1.0, 'Множитель 2', step = 0.1)

// Получаем данные с нужного ТФ
src = request.security(syminfo.tickerid, mtf, ma_source)
high_mtf = request.security(syminfo.tickerid, mtf, high)
low_mtf = request.security(syminfo.tickerid, mtf, low)

// ВЫБОР ТИПА MA
get_ma() =>
    switch ma_type
        'EMA' => ta.ema(src, ma_length)
     
// Расчет центральной линии
center_line = get_ma()

// ПЕРВЫЙ конверт: Суммарная волатильность
total_hl_diff = 0.0
for i = 0 to lookback1 - 1 by 1
    total_hl_diff := high_mtf[i] - low_mtf[i]
    total_hl_diff

upper_band1 = center_line + total_hl_diff /3
lower_band1 = center_line - total_hl_diff /3

// ВТОРОЙ конверт: Общий диапазон
overall_high = ta.highest(high_mtf, lookback2)
overall_low = ta.lowest(low_mtf, lookback2)
hl_range = overall_high - overall_low

upper_band2 = center_line + hl_range /3
lower_band2 = center_line - hl_range /3

// Отрисовка
plot(center_line, 'Мувинг', #ff9800, 2)

// Конверт 1
u1 = plot(upper_band1, 'Верх Суммарный', #ff5252, 2)
l1 = plot(lower_band1, 'Низ Суммарный', #ff5252, 2)
fill(u1, l1, color.new(color.red, 90), 'Конверт 1')

// Конверт 2
u2 = plot(upper_band2, 'Верх Общий', #4caf50, 2)
l2 = plot(lower_band2, 'Низ Общий', #4caf50, 2)
fill(u2, l2, color.new(color.green, 90), 'Конверт 2')

//===========================================================================//

0

Quick post

Write and submit your message



You are here » AD » WOW.that's literally me » #8 investing.com