CANAUX ATR SUR FORCE INDEX
Forums › ProRealTime forum Français › Support ProBuilder › CANAUX ATR SUR FORCE INDEX
- This topic has 5 replies, 3 voices, and was last updated 1 year ago by Cekka.
Viewing 6 posts - 1 through 6 (of 6 total)
-
-
02/18/2022 at 12:37 PM #188462
Bonjour,
J’aimerais pouvoir appliquer des canaux ATR(1,2 et 3 ATR) sur l’indicateur FORCE INDEX.
Lorsque j’applique les 3 codes ( avec K=1, 2 et 3) sur le force index, mes indicateurs sont plats .
ici j’aimerais pouvoir recréer l’indicateur qu’utilise M. ELDER Alexandre et presenté dans son livre
Comment résoudre ce probleme ?
Code utilisé pour les canaux, que j’applique 3 fois :
12345678910periodMA=22periodATR=14k=1MA = ExponentialAverage[periodMA](close)UpperBand = MA + k*AverageTrueRange[periodATR](close)LowerBand = MA - k*AverageTrueRange[periodATR](close)RETURN MA , UpperBand , LowerBandMerci pour votre aide
02/18/2022 at 4:57 PM #188487Cela marche:
12345678910periodMA=10periodATR=14k=1//MA = ExponentialAverage[periodMA](close)MA = ForceIndex(close)UpperBand = MA + k*AverageTrueRange[periodATR](MA)LowerBand = MA - k*AverageTrueRange[periodATR](MA)RETURN MA AS "Force Index", UpperBand AS "Top", LowerBand AS "Bottom"02/18/2022 at 7:09 PM #18849602/18/2022 at 9:35 PM #188507Alors je ne sais pas quoi te dire, je suis désolé.
07/22/2022 at 8:55 PM #197745Pour ce sujet, voici le code de TV, cela peut-il aider ?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © loxx//@version=5indicator(title='Elder Force Index With ATR Channels [loxx]', shorttitle='EFIATR [loxx]', format=format.volume, timeframe="", timeframe_gaps=true, max_bars_back = 5000)RMA(x, t) =>EMA1 = xEMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (1/t) + nz(EMA1[1])EMA1EMA(x, t) =>EMA1 = xEMA1 := na(EMA1[1]) ? x : (x - nz(EMA1[1])) * (2 / (t + 1)) + nz(EMA1[1])EMA1_bpDom(len, bpw, mult) =>HP = 0.0BP = 0.0Peak = 0.0Real = 0.0counter = 0.0DC = 0.0alpha2 = (math.cos(0.25 * bpw * 2 * math.pi / len) + math.sin(0.25 * bpw * 2 * math.pi / len) - 1) / math.cos(0.25 * bpw * 2 * math.pi / len)HP := (1 + alpha2 / 2) * (close - nz(close[1])) + (1 - alpha2) * nz(HP[1])beta1 = math.cos(2 * math.pi / len)gamma1 = 1 / math.cos(2 * math.pi * bpw / len)alpha1 = gamma1 - math.sqrt(gamma1 * gamma1 - 1)BP := 0.5 * (1 - alpha1) * (HP - nz(HP[2])) + beta1 * (1 + alpha1) * nz(BP[1]) - alpha1 * nz(BP[2])BP := bar_index == 1 or bar_index == 2 ? 0 : BPPeak := 0.991 * PeakPeak := math.abs(BP) > Peak ? math.abs(BP) : PeakReal := Peak != 0 ? BP / Peak : RealDC := nz(DC[1])DC := DC < 6 ? 6 : DCcounter := counter[1] + 1if ta.crossover(Real, 0) or ta.crossunder(Real, 0)DC := 2 * counterif 2 * counter > 1.25 * nz(DC[1])DC := 1.25 * DC[1]if 2 * counter < 0.8 * nz(DC[1])DC := 0.8 * nz(DC[1])counter := 0temp_out = mult * DCtemp_out//inputssrc = input.source(close, title = "Source", group = "Basic Settings")calc_type = input.string("Fixed", title = "Calculation Type", options =["Fixed", "Band-pass Dominant Cycle"], group = "Basic Settings")len = input.int(13, title = "Fixed EFI Period", group = "Fixed Settings")slen = input.int(21, title='Fixed Signal Period', group = "Fixed Settings")atr_sm = input.int(21, title ="Fixed ATR Smoothing Length", group = "Fixed Settings")bp_period = input.int(13, "Band-pass Period", minval = 1, group = "Band-pass")bp_width = input.float(0.20, "Band-pass Width", step = 0.1, group = "Band-pass")cycle_len = input.float(100, "Signal and ATR Percent of Dominant Cycle (%)", step = 1.0, group = "Band-pass")/100efi_reduction = input.float(75, "EFI Percent of Dominant Cycle (%) ", step = 1.0, group = "Band-pass")/100len_out_fast = int(nz(_bpDom(bp_period, bp_width, efi_reduction), 1)) < 1 ? 1 : int(nz(_bpDom(bp_period, bp_width, efi_reduction), 1))len_out_slow = int(nz(_bpDom(bp_period, bp_width, cycle_len), 1)) < 1 ? 1 : int(nz(_bpDom(bp_period, bp_width, cycle_len), 1))atr_mult1 = input.int(1, title = "ATR Mult Level 1", group = "ATR Multipliers")atr_mult2 = input.int(2, title = "ATR Mult Level 2", group = "ATR Multipliers")atr_mult3 = input.int(3, title = "ATR Mult Level 3", group = "ATR Multipliers")trunc_atr = input.bool(true, title = "Truncate over ATR Mult Level 4?", group = "UI Options")//core calcefi = EMA(ta.change(close) * volume, calc_type == "Fixed" ? len : len_out_fast)sig = EMA(efi, calc_type == "Fixed" ? len : len_out_slow)atr_ema = math.abs(efi[1] - efi)atr_out = RMA(atr_ema, calc_type == "Fixed" ? len : len_out_slow)//atr channel calcatr_high1 = sig + atr_out * atr_mult1atr_low1 = sig - atr_out * atr_mult1atr_high2= sig + atr_out * atr_mult2atr_low2 = sig - atr_out * atr_mult2atr_high3 = sig + atr_out * atr_mult3atr_low3 = sig - atr_out * atr_mult3atr_obhigh = sig + atr_out * (atr_mult3 + 1)atr_oblow = sig - atr_out * (atr_mult3 + 1)efi_out = trunc_atr ? efi > atr_obhigh ? atr_high3 : efi < atr_oblow ? atr_low3 : efi : efi//plot atr channelsplot(atr_high1, color = bar_index % 2 == 0 ? na : color.new(color.gray, 30), linewidth = 1, title = "ATR1 High")plot(atr_high2, color = bar_index % 4 == 0 ? na : color.new(color.gray, 30), linewidth = 1, title = "ATR2 High")plot(atr_high3, color = color.new(color.gray, 30), linewidth = 2, title = "ATR3 High")plot(atr_low1, color = bar_index % 2 == 0 ? na : color.new(color.gray, 30), linewidth = 1, title = "ATR1 Low")plot(atr_low2, color = bar_index % 4 == 0 ? na : color.new(color.gray, 30), linewidth = 1, title = "ATR2 Low")plot(atr_low3, color = color.new(color.gray, 30), linewidth = 2, title = "ATR3 Low")//plot mainplot(0, color=color.gray, style = plot.style_circles, title='Zero Line', linewidth = 2)plot(sig, color=color.new(color.white, 0), title='Signal', linewidth = 2)plot(efi_out, color = #4f6cdf, title='EFI', linewidth = 2)//plot shapesplot(efi_out >= atr_high3 ? efi_out : na, style = plot.style_circles, linewidth = 3, color = #D2042D, title = "Over ATR4 High")plot(efi_out <= atr_low3 ? efi_out : na, style = plot.style_circles, linewidth = 3, color = #2DD204, title = "Over ATR4 Low")03/11/2023 at 1:25 PM #2113681234567891011121314151617fiperiod = 13atrperiod = 14zeroline = 0elderfi = Average[fiperiod,1]((close[0]-close[1])*Volume)emafi = ExponentialAverage[fiperiod+1](elderfi)atrfi = AverageTrueRange[atrperiod](emafi)upper1 = emafi + atrfiupper2 = emafi + atrfi*2upper3 = emafi + atrfi*3lower1 = emafi - atrfilower2 = emafi - atrfi*2lower3 = emafi - atrfi*3return elderfi as "force index", zeroline as "zeroline", upper1 as "atr1", upper2 as "atr2", upper3 as "atr3",lower1 as "-atr1", lower2 as "-atr2", lower3 as "-atr3"i don’t know if it’s correct, i used tradingview elder force index with atr channels as reference, lmk for corrections
1 user thanked author for this post.
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)