{ ======================================= HEADER ====================================

Poly Inner Channel.

This indicator plots a regression line and two standard deviation bands around it.

====================================== DECLARATIONS ==================================}

inputs:

Len (150),

RedLineLen(150),

Order (3),

SDev(.5),{why not make these inputs}

Price ©; {this cannot be a var, for some reason}

vars:

CURSOR (FALSE),

LASTBAR (TRUE),

sigma (0),

f (0),

Y(0),

b0 (0),

b1 (0),

b2 (0),

b3 (0),

b4 (0);

VARS:

JLAOK(TRUE),

JLAPASS1(0),

JLAPASS2(0),

JLAPASS3(0),

JLAPASS4(0),

JLAPASS5(0),

JLAPASS6(0);

{=========================================MAIN PROGRAM ===================================}

VALUE98=POLY_COEFFS(price,len,order,CURSOR,LASTBAR,b0,b1,b2,b3,b4);

value97=LinearRegValue( Price, RedLineLen, 0 );

if (lastbaronchart and lastbar) or (atcommentarybar and cursor) then

begin

sigma= stddev(price,len);

y=(len-1);

f=0;

while y>(-2)

begin

value5=( b0

+(b1 *f )

+(b2*(power(f, 2)))

+(b3*(power(f, 3)))

+(b4*(power(f, 4)))

);

plot1[y] (value5,"regression");

plot2[y] (value5 + (sdev * sigma ),"Channel+1");

plot3[y] (value5 - (sdev * sigma ),"LChannel -1");

plot4[y] (value97[y], "LR Momentum" );

y=y-1;

f=f+1;

end;

end;

{

commentarycl("b0 = ", b0);

commentarycl("b1 = ", b1);

commentarycl("b2 = ", b2);

commentarycl("b3 = ", b3);

commentarycl("b4 = ", b4);

}

it give me an error : trying to access future data.Bar reference value:-1

anybody can help me to solve this error?

thank you

]]>

I'm looking for an EasyLanguage Support Resistance Fractal Levels Indicator like this one:

http://www.tradingview.com/script/RQnLfaNE-Swing-high-low-support-resistance-by-Patternsmart-com/

It is based on the Fractals indicator, but it draws lines instead of one dot for each fractal.

There is an old metatrader indicator that does the same thing, called Kay Support Resistance, or Barry Support Resistance.

Can anyone help?

Thanks

]]>
Anyone has the code of this indicator? I am trying to find the logic behind it.

Trend Magic Indicator FREE

Kind regards,

Mirko

]]>

Thanks

]]>

http://www.traderslaboratory.com/forums/f18/paintbarfactory-com-not-spam-a-question-3168.html

I have been hesitant to post these as some of them are NOT the same as per the above thread. But due to several requests recently I'm posting them anyway.

The attached indicators are:

BR_CCi : *Which is basically a smoothed CCi.*

BR_RSI : *Which again is a smoothed RSi.*

BR_Momentum : *Again a smoothed Momentum ( Can't believe people would actually charge for these ** )*

BR_PaintBars : *MA based trend bars.*

BR_2FastMa's : *Self explanatory.*

BR_Squeeze : *Partly based on the original squeeze ( as we all know it ), but the histogram is defined to show clearer divergences. Also includes CounterTrend and an alternative midline.*

BR_HeatMeter : *Can you take the heat ! ( well actually it's just a 50 period CCi *:\)

For more information on the indicators, please go to the above thread for details.

See Attached Charts to show each indicator.

*Can I just stress that some of these are NOT THE SAME, so take them with a pinch of salt *

Cheers

Blu-Ray

]]>Trading Strategies

1. Bollinger Band squeeze. This might be the most common trading strategy with Bollinger bands. Bollinger band squeeze happens when the width of the band is the narrowest in recent times. This indicates a sideways trading or lack of volatility. Finally a volatility breakout will come and price will move in the breakout direction. This volatility breakout is identified by the expansion in band width.

2. Reversals at Bollinger Bands. Look for candlestick reversal patterns like engulfing bars and pin bars formed at the upper or lower band. In the chart below, a bearish pin bar is formed at the upper band. Trade bearish signals forming at upper band and bullish signals forming at lower band.

The Bollinger Bands High Low indicator can be customized through the parameters. You can change the Bollinger Band calculation period and Standard Deviation. To edit parameter values, open the VTL script in VTL Editor by right clicking on the indicator name in Navigator and select Edit. Parameters are located at the top of the script file. Edit them save, compile and attach to chart again for the new parameter values to take effect

]]>

Would anyone be kind enough the convert the mq4 formula for the

Sling Range into Tradestation Code

Hoping that you can oblige

Thank you in advance

Derek

//+------------------------------------------------------------------+ //| Rj_SlidingRange.mq4 | //| Copyright © 2011,RJ Rjabkov Alexander | //| rj-a@mail.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011,RJ Rjabkov Alexander" #property link "rj-a@mail.ru" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Aqua #property indicator_color2 Red #property indicator_color3 Aqua #property indicator_color4 Red #property indicator_width1 1 #property indicator_width2 1 #property indicator_width3 2 #property indicator_width4 2 #property indicator_style1 2 #property indicator_style2 2 extern int CalcPeriodRange = 5; double UpperLimit[]; double LowerLimit[]; double AwlUpper[]; double AwlLower[]; double Current[]; int init() { IndicatorBuffers(5); SetIndexBuffer(0, UpperLimit); SetIndexBuffer(1, LowerLimit); SetIndexBuffer(2, AwlUpper); SetIndexBuffer(3, AwlLower); SetIndexBuffer(4, Current); SetIndexStyle(0, DRAW_LINE); SetIndexStyle(1, DRAW_LINE); SetIndexStyle(2, DRAW_LINE); SetIndexStyle(3, DRAW_LINE); return(0); } int deinit() {return(0);} int start() { int i, cb; int counted_bars = IndicatorCounted(); if (counted_bars < 0) return(-1); if (counted_bars > 0) counted_bars--; cb=Bars-counted_bars; while(cb>=0) { i=cb+CalcPeriodRange-1; double b1=0, b2=0; while(i>=cb) { b1 += High[iHighest(NULL, 0, MODE_HIGH, CalcPeriodRange, i)]; b2 += Low[iLowest(NULL, 0, MODE_LOW, CalcPeriodRange, i)]; i--; } UpperLimit[cb]=b1/CalcPeriodRange; LowerLimit[cb]=b2/CalcPeriodRange; Current[cb]=NormalizeDouble((UpperLimit[cb]+LowerLimit[cb])/2, 5); AwlUpper[cb]=EMPTY_VALUE; AwlLower[cb]=EMPTY_VALUE; if(Current[cb]>Current[cb+1]) {AwlUpper[cb]=Current[cb]; AwlUpper[cb+1]=Current[cb+1];} if(Current[cb]<Current[cb+1]) {AwlLower[cb]=Current[cb]; AwlLower[cb+1]=Current[cb+1];} if(Current[cb]==Current[cb+1] && AwlLower[cb+1]!=EMPTY_VALUE) {AwlLower[cb]=Current[cb];} if(Current[cb]==Current[cb+1] && AwlUpper[cb+1]!=EMPTY_VALUE) {AwlUpper[cb]=Current[cb];} cb--; } return(0); } //+------------------------------------------------------------------+]]>

How to Use ATR Ratio Indicator

The ATR ratio indicator does not generate trading signals, it is a confirmatory indicator. When a new trend begins, usually the indicator value climbs above one. Identify the direction of the trend from chart with the help of moving averages or trend lines and then initiate trades when the ATR ratio indicator climbs above one. The image shows a short trade setup. After a consolidation, price breaks below the moving average. As you can see in the area highlighted by vertical box, price remains below the MA and ATR ratio climbs above one. This is the ideal time to open a short trade.

When the ATR ratio falls below one and stays there, it is clearly telling that the trend has lost momentum. Open positions can be closed when this happens, and wait for the next breakout.

Parameters

ATR Ratio can be customized through the parameters. Long Term ATR Period and Short Term ATR period are defined by the parameters. Default values are 7 and 49. To change the parameter values, open the script in VTL editor by right clicking on the indicator name in navigator and select edit. The script is now opened in the VTL editor. Parameters are located at the top of the script file. Change the parameter values, save and compile. Apply again to chart for the new parameter values to take effect.

]]>

i ve this script:

[LegacyColorValue = TRUE];

{ ======================================= HEADER ====================================

Poly Inner Channel.

This indicator plots a regression line and two standard deviation bands around it.

====================================== DECLARATIONS ==================================}

inputs:

Len (150),

RedLineLen(150),

Order (3),

SDev(.5),{why not make these inputs}

Price ©; {this cannot be a var, for some reason}

vars:

CURSOR (FALSE),

LASTBAR (TRUE),

sigma (0),

f (0),

Y(0),

b0 (0),

b1 (0),

b2 (0),

b3 (0),

b4 (0);

VARS:

JLAOK(TRUE),

JLAPASS1(0),

JLAPASS2(0),

JLAPASS3(0),

JLAPASS4(0),

JLAPASS5(0),

JLAPASS6(0);

{=========================================MAIN PROGRAM ===================================}

VALUE98=POLY_COEFFS(price,len,order,CURSOR,LASTBAR,b0,b1,b2,b3,b4);

value97=LinearRegValue( Price, RedLineLen, 0 );

if (lastbaronchart and lastbar) or (atcommentarybar and cursor) then

begin

sigma= stddev(price,len);

y=(len-1);

f=0;

while y>(-2)

begin

value5=( b0

+(b1 *f )

+(b2*(power(f, 2)))

+(b3*(power(f, 3)))

+(b4*(power(f, 4)))

);

plot1[y] (value5,"regression");

plot2[y] (value5 + (sdev * sigma ),"Channel+1");

plot3[y] (value5 - (sdev * sigma ),"LChannel -1");

plot4[y] (value97[y], "LR Momentum" );

y=y-1;

f=f+1;

end;

end;

{

commentarycl("b0 = ", b0);

commentarycl("b1 = ", b1);

commentarycl("b2 = ", b2);

commentarycl("b3 = ", b3);

commentarycl("b4 = ", b4);

}

.... but plotting it in multicharts i recive this popup:

Messagge:Error in study "SIGMA INNER CHANNEL

trying to access future data. Bar reference value:-1.

CAN PLEASE ANYBODY HELP ME TO CORRECT THE SCRIPT?

thank you very much

]]>

Given below is the Easy language code for the Adv Get indicator Make or Break (MOB)

But it gives compiling errors when compiles in Multicharts which uses Easy language.

I tried replacing '|' with',' but that still did not help.

Can anybody help?

SECTION_BEGIN("MOB Simulation");

SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

//Plot Colored Candles

PlotOHLC(O ,H ,L ,C ,"Price",IIf(C>O,colorGreen,colorRed),styleCandle) ;

Offset = 5; //Recommended to use two sheets: one with 5 and another with 7, or maybe other offset value

Avgmov = Offset * MA (abs(ROC(C,1)) ,20);

per = LastValue(Avgmov) ;

numberOfBars = Cum(1);

Range = 0.01;

PS = TroughBars(L, per, 1) == 0;

Title = Title + StrFormat("AVGMOV %g|%g|%g\n", Avgmov,per, numberOfBars);

xa = LastValue(ValueWhen (PS,numberOfBars,1)) ;//x from last trough

Ya = LastValue(ValueWhen (PS,L,1)) ;//y (Low) last trough

PR = PeakBars(H,per, 1) == 0;

xb = LastValue(ValueWhen (PR,numberOfBars,1)) ;//x from last peak

Yb = LastValue(ValueWhen (PR,H,1)) ;//y (High) last peak

Title = Title + StrFormat("PS %g|%g|%g|%g|%g|%g", PS,xa,ya,PR,xb,yb);

Trough_ReTest = abs((L/ya)-1) <Range;

Peak_ReTest = abs((H/yb)-1) <Range;

Trough_Cross = Cross(ya,C);

Peak_Cross = Cross(C,yb);

//UP = upSwing DN = downSwing

UP = xb>xa;//upSwing

DN = xa>xb;//DownSwing

RT23_6 = IIf(UP,yb-(yb- ya)*0.236, IIf(DN,ya+ (yb-ya)*0.236,-1e10) );

RT38_2 = IIf(UP,yb-(yb- ya)*0.382, IIf(DN,ya+ (yb-ya)*0.382,-1e10) );

RT50_0 = IIf(UP,yb-(yb- ya)*0.500, IIf(DN,ya+ (yb-ya)*0.500,-1e10) );

RT61_8 = IIf(UP,yb-(yb- ya)*0.618, IIf(DN,ya+ (yb-ya)*0.618,-1e10) );

RT78_6 = IIf(UP,yb-(yb- ya)*0.786, IIf(DN,ya+ (yb-ya)*0.786,-1e10) );

RT12_7 = IIf(UP,yb-(yb- ya)*1.27, IIf(DN,ya+ (yb-ya)*1.27,-1e10) );

RT16_1 = IIf(UP,yb-(yb- ya)*1.61, IIf(DN,ya+ (yb-ya)*1.61,-1e10) );

RT=

IIf(UP,-100* (yb-L)/(yb- ya),

100*(H-ya)/( yb-ya));//Retracement_ Value

InZone = C<yb & C>ya;//use it for filter to receive only signals that are in in the Retracement zone.

Buy = Trough_ReTest OR peak_Cross;

Sell = Peak_ReTest OR trough_Cross;

Filter = 1;

AddColumn(RT, "RT%");

AddColumn(Trough_ReTest,"TR- Test",1.0) ;

AddColumn(Peak_ReTest,"PK-Test",1.0) ;

AddColumn(Trough_Cross,"TR-Cross",1.0);

AddColumn(Peak_Cross,"PK-Cross",1.0);

//AddColumn(CdDoji( )OR CHammer(),"Candle" ,1.0);

//Plot(C,"C",1, 64);

Plot(IIf(numberOfBars>xa, ya,-1e10) ,"Bottom" ,colorBrown, 1+8);

Plot(IIf(numberOfBars>xb, yb,-1e10) ,"Top",colorBrown,1+8);

xab = IIf(xb>xa,xb, xa);

//Retracements

Plot(IIf(numberOfBars>= xab+1,RT23_6,-1e10), "R2 23.6% Retr.",5,styleLine | styleNoTitle | styleDots);

Plot(IIf(numberOfBars>= xab+1,RT38_2,-1e10), "R1 38.2% Retr.",5,styleLine | styleNoTitle | styleDots);

Plot(IIf(numberOfBars>= xab+1,RT50_0,-1e10), "ZR 50.0% Retr.",colorBlue, styleLine | styleNoTitle | styleDots);

Plot(IIf(numberOfBars>= xab+1,RT61_8,-1e10), "S1 61.8% Retr.",colorDarkRed, styleLine | styleNoTitle | styleDots);

Plot(IIf(numberOfBars>= xab+1,RT78_6,-1e10), "S2 78.6% Retr.",colorDarkRed, styleLine | styleNoTitle |styleDots);

// Plot the MOB Cloud

Plot(IIf(numberOfBars>= xab+1,RT12_7,-1e10), "127% ext.",colorBrightGreen, styleNoTitle | styleNoLabel | styleLine);

Plot(IIf(numberOfBars>= xab+1,RT16_1,-1e10), "161% ext.",colorBrightGreen, styleNoTitle | styleNoLabel | styleLine);

CondA=IIf(numberOfBars>= xab+1,RT12_7,-1e10);

CondB=IIf(numberOfBars>= xab+1,RT16_1,-1e10);

PlotOHLC(Condb,Condb,Conda,Conda,"",ColorRGB(30,13 0,30),styleCloud, styleNoTitle | styleNoLabel);

GraphXSpace = 0.5;

//Plot(Gauss2ord(C,5),"M5",4,1);

//GraphXSpace = 1.5;

//Title = Name()+" per = "+WriteVal(per, 1.0) +" Close = "+WriteVal(C, 1.2)+ " ("+WriteVal( ROC(C,1), 1.2)+"%)" +" Current Correction = "+WriteVal(RT, 1.0)+"%";

//Plot( Volume,"V", ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", stylehidden| styleOwnScale | styleThick, maskHistogram ), 2 );

_SECTION_END( );

Regards,

Dr.Chatterjee

]]>

Could you please open the Tradestation ELD file

below " 20110116171505TTM ABC WAVES.ELD "

and convert and display it as text file of that indicator on Traderslaboratory.com Website

http://cdn3.traderslaboratory.com/forums/attachments/46/37150d1380685556[[

http://www.traderslaboratory.com/forums/trading-indicators/16938-ttm-wave.html

See attached screenshot of indicator

]]>Third Generation Moving Average is a Client Side VTL indicator. It is an advanced version of the standard moving average (MA), which implements a rather simple lag-reducing procedure based on the longer MA period. The method was first described by Dr. Mafred Durschner. Moving averages are supposed to smooth data and to remove noise and useless information. Multiple moving average variants are used widely, for example Simple Moving Average (SMA) or Exponentially Moving Average (EMA). One challenge is that moving averages introduce a lag, i.e. the smoothed curve follows the trend usually later. 3rd generation MA reduces the lag and follows price trends closely.

As you see in the image, the 3rd Generation MA (red line) offers slightly less lag than the conventional EMA (green line) and reacts to the price changes faster. Unfortunately, it is still prone to lag and may produce false signals. You can use the 3rd Generation Moving Average indicator the same as the standard moving average, to detect the current trend direction. It can be used to generate trading signals also, price crossing the 3rd Generation MA can be used as a buy signal and vice versa for sell signals. It is better to use this with other confirmatory signals.

]]>

Inside Bar Trading Strategy

An Inside Bar means a contraction in price range or volatility. It is a pause in price movement and does not show any strength in price direction. This will lead to a breakout from this trading range.

Identify the trend direction and place a stop buy order few pips above the high of the inside bar if the trend is up. In down trend place a stop sell order few pips below the low of the inside bar. Stoploss is placed few pips beyond the opposite end of the inside bar.

Outside Bar Trading Strategy

An Outside Bar means a short term expansion in price range or volatility. It shows strength in both directions. Look for outside bar at a resistance or support level. When outside bar is formed at a resistance level, sell breakdown of the low of the outside bar. When outside bar is formed at a support level, buy breakout of the high of the outside bar. Stoploss is placed few pips beyond the opposite end of the inside bar.

]]>

If you know the author, please post his credit. Thank You.

]]>

I would like to Plot the "BB-MACD" Created by KelvinHand

for a Variable Time Period Dominant Cycle as

calculated by "Ehlers Autocorrelation Periodogram" code below

I have only able to plot the "BB-MACD" Created by KelvinHand

using the fixed time period of the last value of "Ehlers Autocorrelation Periodogram"

Hoping that you can help

Thanking you in advance

Best regards

Derek

//////////////////////////////////////////////////////

//Ehlers Autocorrelation Periodogram for Amibroker (AFL) /* Autocorrelation Periodogram 2013 John F. Ehlers */ SetBarsRequired(sbrAll); LPeriod = Param("Low-pass Period", 10, 3, 20); HPeriod = Param("High-pass Period", 48, 22, 80); IsPlotHeatMap = ParamToggle("Show HeatMap?", "No|Yes", 1); IsPlotDominantCycle = ParamToggle("Show Dom. Cycle?", "No|Yes"); pi=3.1415926; function RoofingFilter(lpPeriod, hpPeriod) { alpha1 = (cos(0.707*2*pi / hpPeriod) + sin(0.707*2*pi / hpPeriod) - 1) / cos(0.707*2*pi / hpPeriod); a1 = exp(-1.414*pi / lpPeriod); b1 = 2*a1*cos(1.414*pi / lpPeriod); c2 = b1; c3 = -a1*a1; c1 = 1 - c2 - c3; HP = Close; Filt = HP; for(i = 2; i < BarCount; i++) { HP[i] = ((1 - alpha1 / 2)^2)*(Close[i] - 2*Close[i-1] + Close[i-2]) + 2*(1 - alpha1)*HP[i-1] - ((1 - alpha1)^2)*HP[i-2]; Filt[i] = c1*(HP[i] + HP[i-1]) / 2 + c2*Filt[i-1] + c3*Filt[i-2]; } return Filt; } function AGC(lowerCutoff, higherCutoff, acceptableSlope) { factor = 0; accSlope = -acceptableSlope; //acceptableSlope = 1.5 dB halfLC = lowerCutoff / 2; halfHC = higherCutoff / 2; ratio = 10^(accSlope/20); if(halfHC - halfLC > 0) factor = ratio^(1/(halfHC - halfLC)); return factor; } function AutocorrelationPeriodogram(data, isHeatMap, isDomCyc) { avgLength = 3; dominantCycle = 0; //Pearson correlation for each value of lag for(lag = 0; lag <= 48; lag++) { //Set the average length as M M = avgLength; if(avgLength == 0) M = lag; //Initialize correlation sums Sx = 0; Sy = 0; Sxx = 0; Syy = 0; Sxy = 0; //Advance samples of both data streams and sum Pearson components for(count = 0; count <= M-1; count++) { X = Ref(data, -count); Y = Ref(data, -(lag + count)); Sx += X; Sy += Y; Sxx += X^2; Syy += Y^2; Sxy += X*Y; } var1 = (M*Sxx - Sx^2)*(M*Syy - Sy^2); VarSet("corr" + lag, IIf(var1 > 0, (M*Sxy - Sx*Sy)/sqrt(var1), 0)); //Compute correlation for each value of lag //VarSet("corrScale" + lag, IIf(var1 > 0, 0.5*((M*Sxy - Sx*Sy)/sqrt(var1) + 1), 0)); //Scale each correlation to range between 0 and 1 } /*//Plot as a Heatmap (for scale each correlation to range between 0 and 1) for(period = 3; period <= 48; period++) { corr = VarGet("corrScale" + period); Red = IIf(corr > 0.5, 255*(2 - 2*corr), 255); Green = IIf(corr > 0.5, 255, 2*255*corr); PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel); }*/ /* The DFT is accomplished by correlating the autocorrelation at each value of lag with the cosine and sine of each period of interest. The sum of the squares of each of these values represents the relative power at each period. */ for(period = 10; period <= 48; period++) { cosinePart = 0; sinePart = 0; for(n = 3; n <= 48; n++) { cosinePart += VarGet("corr" + n)*cos(2*pi*n / period); sinePart += VarGet("corr" + n)*sin(2*pi*n / period); } VarSet("sqSum" + period, cosinePart^2 + sinePart^2); } //EMA is used to smooth the power measurement at each period for(period = 10; period <= 48; period++) VarSet("r" + period, AMA((VarGet("sqSum" + period))^2, 0.2)); //Find Maximum Power Level for Normalization K = AGC(10, 48, 1.5); for(period = 10; period <= 48; period++) { if(period == 10) VarSet("maxPwr", 0); VarSet("maxPwr", IIf(VarGet("r" + period) > VarGet("maxPwr"), K*VarGet("r" + period), VarGet("maxPwr"))); } //Normalization power for(period = 10; period <= 48; period++) VarSet("pwr" + period, VarGet("r" + period)/VarGet("maxPwr")); //Compute the dominant cycle using the CG of the spectrum Spx = 0; Sp = 0; for(period = 10; period <= 48; period++) { Spx += IIf(VarGet("pwr" + period) >= 0.5, period*VarGet("pwr" + period), 0); Sp += IIf(VarGet("pwr" + period) >= 0.5, VarGet("pwr" + period), 0); } dominantCycle = IIf(Sp != 0, Spx / Sp, 0); dominantCycle =(dominantCycle); if(isHeatMap) { //Plot as a Heatmap for(period = 10; period <= 48; period++) { pwr = VarGet("pwr" + period); Red = IIf(pwr > 0.5, 255, 2*255*pwr); Green = IIf(pwr > 0.5, 255*(2*pwr - 1), 0); PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel, Null, Null, 0, 0); } } if(isDomCyc) Plot(LastValue(dominantCycle,1), "Dominant Cycle", colorBlue, styleThick, Null, Null, 0, 1); pds=LastValue(dominantCycle,1); //"BB-MACD") Created by KelvinHand SetChartBkColor( ParamColor("background",colorBlack) ); A1=EMA(C,pds/2)-EMA(C,pds); BBtop=BBandTop(A1,10,1); BBbot=BBandBot(A1,10,1); Color=IIf(a1<0 AND a1>Ref(a1,-1), colorLime,IIf(a1>0 AND a1>Ref(a1,-1),colorBrightGreen,IIf(a1>0 AND a1<Ref(a1,-1),colorCustom12,colorRed))); Plot(a1,"MACD",color,styleThick+styleLine); Plot(BBtop,"BBtop",colorWhite,styleDashed); Plot(BBbot,"BBbot",colorWhite,styleDashed); Plot(0,"",colorWhite,1); AddColumn(round(dominantCycle), " DominantCycle", 2.0 , colorRed, colorLightYellow,50) ; return dominantCycle; } filtData = RoofingFilter(LPeriod, HPeriod); AutocorrelationPeriodogram(filtData, IsPlotHeatMap, IsPlotDominantCycle);

]

]]>

Using Amibroker I would like to Plot the "BB-MACD" Created by KelvinHand

for a Variable time period Dominant Cycle as calculated by "Ehlers Autocorrelation Periodogram" code below

I have only able to plot the "BB-MACD" Created by KelvinHand

using the fixed time period of the last value of "Ehlers Autocorrelation Periodogram"

Hoping that you can help

Thanking you in advance

Best regards

Derek

///////////////////////////////////////////////

//Ehlers Autocorrelation Periodogram for Amibroker (AFL) /* Autocorrelation Periodogram 2013 John F. Ehlers */ SetBarsRequired(sbrAll); LPeriod = Param("Low-pass Period", 10, 3, 20); HPeriod = Param("High-pass Period", 48, 22, 80); IsPlotHeatMap = ParamToggle("Show HeatMap?", "No|Yes", 1); IsPlotDominantCycle = ParamToggle("Show Dom. Cycle?", "No|Yes"); pi=3.1415926; function RoofingFilter(lpPeriod, hpPeriod) { alpha1 = (cos(0.707*2*pi / hpPeriod) + sin(0.707*2*pi / hpPeriod) - 1) / cos(0.707*2*pi / hpPeriod); a1 = exp(-1.414*pi / lpPeriod); b1 = 2*a1*cos(1.414*pi / lpPeriod); c2 = b1; c3 = -a1*a1; c1 = 1 - c2 - c3; HP = Close; Filt = HP; for(i = 2; i < BarCount; i++) { HP[i] = ((1 - alpha1 / 2)^2)*(Close[i] - 2*Close[i-1] + Close[i-2]) + 2*(1 - alpha1)*HP[i-1] - ((1 - alpha1)^2)*HP[i-2]; Filt[i] = c1*(HP[i] + HP[i-1]) / 2 + c2*Filt[i-1] + c3*Filt[i-2]; } return Filt; } function AGC(lowerCutoff, higherCutoff, acceptableSlope) { factor = 0; accSlope = -acceptableSlope; //acceptableSlope = 1.5 dB halfLC = lowerCutoff / 2; halfHC = higherCutoff / 2; ratio = 10^(accSlope/20); if(halfHC - halfLC > 0) factor = ratio^(1/(halfHC - halfLC)); return factor; } function AutocorrelationPeriodogram(data, isHeatMap, isDomCyc) { avgLength = 3; dominantCycle = 0; //Pearson correlation for each value of lag for(lag = 0; lag <= 48; lag++) { //Set the average length as M M = avgLength; if(avgLength == 0) M = lag; //Initialize correlation sums Sx = 0; Sy = 0; Sxx = 0; Syy = 0; Sxy = 0; //Advance samples of both data streams and sum Pearson components for(count = 0; count <= M-1; count++) { X = Ref(data, -count); Y = Ref(data, -(lag + count)); Sx += X; Sy += Y; Sxx += X^2; Syy += Y^2; Sxy += X*Y; } var1 = (M*Sxx - Sx^2)*(M*Syy - Sy^2); VarSet("corr" + lag, IIf(var1 > 0, (M*Sxy - Sx*Sy)/sqrt(var1), 0)); //Compute correlation for each value of lag //VarSet("corrScale" + lag, IIf(var1 > 0, 0.5*((M*Sxy - Sx*Sy)/sqrt(var1) + 1), 0)); //Scale each correlation to range between 0 and 1 } /*//Plot as a Heatmap (for scale each correlation to range between 0 and 1) for(period = 3; period <= 48; period++) { corr = VarGet("corrScale" + period); Red = IIf(corr > 0.5, 255*(2 - 2*corr), 255); Green = IIf(corr > 0.5, 255, 2*255*corr); PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel); }*/ /* The DFT is accomplished by correlating the autocorrelation at each value of lag with the cosine and sine of each period of interest. The sum of the squares of each of these values represents the relative power at each period. */ for(period = 10; period <= 48; period++) { cosinePart = 0; sinePart = 0; for(n = 3; n <= 48; n++) { cosinePart += VarGet("corr" + n)*cos(2*pi*n / period); sinePart += VarGet("corr" + n)*sin(2*pi*n / period); } VarSet("sqSum" + period, cosinePart^2 + sinePart^2); } //EMA is used to smooth the power measurement at each period for(period = 10; period <= 48; period++) VarSet("r" + period, AMA((VarGet("sqSum" + period))^2, 0.2)); //Find Maximum Power Level for Normalization K = AGC(10, 48, 1.5); for(period = 10; period <= 48; period++) { if(period == 10) VarSet("maxPwr", 0); VarSet("maxPwr", IIf(VarGet("r" + period) > VarGet("maxPwr"), K*VarGet("r" + period), VarGet("maxPwr"))); } //Normalization power for(period = 10; period <= 48; period++) VarSet("pwr" + period, VarGet("r" + period)/VarGet("maxPwr")); //Compute the dominant cycle using the CG of the spectrum Spx = 0; Sp = 0; for(period = 10; period <= 48; period++) { Spx += IIf(VarGet("pwr" + period) >= 0.5, period*VarGet("pwr" + period), 0); Sp += IIf(VarGet("pwr" + period) >= 0.5, VarGet("pwr" + period), 0); } dominantCycle = IIf(Sp != 0, Spx / Sp, 0); dominantCycle =(dominantCycle); if(isHeatMap) { //Plot as a Heatmap for(period = 10; period <= 48; period++) { pwr = VarGet("pwr" + period); Red = IIf(pwr > 0.5, 255, 2*255*pwr); Green = IIf(pwr > 0.5, 255*(2*pwr - 1), 0); PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel, Null, Null, 0, 0); } } if(isDomCyc) Plot(LastValue(dominantCycle,1), "Dominant Cycle", colorBlue, styleThick, Null, Null, 0, 1); pds=LastValue(dominantCycle,1); //"BB-MACD") Created by KelvinHand SetChartBkColor( ParamColor("background",colorBlack) ); A1=EMA(C,pds/2)-EMA(C,pds); BBtop=BBandTop(A1,10,1); BBbot=BBandBot(A1,10,1); Color=IIf(a1<0 AND a1>Ref(a1,-1), colorLime,IIf(a1>0 AND a1>Ref(a1,-1),colorBrightGreen,IIf(a1>0 AND a1<Ref(a1,-1),colorCustom12,colorRed))); Plot(a1,"MACD",color,styleThick+styleLine); Plot(BBtop,"BBtop",colorWhite,styleDashed); Plot(BBbot,"BBbot",colorWhite,styleDashed); Plot(0,"",colorWhite,1); AddColumn(round(dominantCycle), " DominantCycle", 2.0 , colorRed, colorLightYellow,50) ; return dominantCycle; } filtData = RoofingFilter(LPeriod, HPeriod); AutocorrelationPeriodogram(filtData, IsPlotHeatMap, IsPlotDominantCycle);]]>

Using Amibroker I would like to Plot the "BB-MACD" Created by KelvinHand

for a Variable time period Dominant Cycle as calculated by "Ehlers Autocorrelation Periodogram" code below

I have only able to plot the "BB-MACD" Created by KelvinHand

using the fixed time period of the last value of "Ehlers Autocorrelation Periodogram"

Hoping that you can help

Thanking you in advance

Best regards

Derek

///////////////////////////////////////////////

//Ehlers Autocorrelation Periodogram for Amibroker (AFL) /* Autocorrelation Periodogram 2013 John F. Ehlers */ SetBarsRequired(sbrAll); LPeriod = Param("Low-pass Period", 10, 3, 20); HPeriod = Param("High-pass Period", 48, 22, 80); IsPlotHeatMap = ParamToggle("Show HeatMap?", "No|Yes", 1); IsPlotDominantCycle = ParamToggle("Show Dom. Cycle?", "No|Yes"); pi=3.1415926; function RoofingFilter(lpPeriod, hpPeriod) { alpha1 = (cos(0.707*2*pi / hpPeriod) + sin(0.707*2*pi / hpPeriod) - 1) / cos(0.707*2*pi / hpPeriod); a1 = exp(-1.414*pi / lpPeriod); b1 = 2*a1*cos(1.414*pi / lpPeriod); c2 = b1; c3 = -a1*a1; c1 = 1 - c2 - c3; HP = Close; Filt = HP; for(i = 2; i < BarCount; i++) { HP[i] = ((1 - alpha1 / 2)^2)*(Close[i] - 2*Close[i-1] + Close[i-2]) + 2*(1 - alpha1)*HP[i-1] - ((1 - alpha1)^2)*HP[i-2]; Filt[i] = c1*(HP[i] + HP[i-1]) / 2 + c2*Filt[i-1] + c3*Filt[i-2]; } return Filt; } function AGC(lowerCutoff, higherCutoff, acceptableSlope) { factor = 0; accSlope = -acceptableSlope; //acceptableSlope = 1.5 dB halfLC = lowerCutoff / 2; halfHC = higherCutoff / 2; ratio = 10^(accSlope/20); if(halfHC - halfLC > 0) factor = ratio^(1/(halfHC - halfLC)); return factor; } function AutocorrelationPeriodogram(data, isHeatMap, isDomCyc) { avgLength = 3; dominantCycle = 0; //Pearson correlation for each value of lag for(lag = 0; lag <= 48; lag++) { //Set the average length as M M = avgLength; if(avgLength == 0) M = lag; //Initialize correlation sums Sx = 0; Sy = 0; Sxx = 0; Syy = 0; Sxy = 0; //Advance samples of both data streams and sum Pearson components for(count = 0; count <= M-1; count++) { X = Ref(data, -count); Y = Ref(data, -(lag + count)); Sx += X; Sy += Y; Sxx += X^2; Syy += Y^2; Sxy += X*Y; } var1 = (M*Sxx - Sx^2)*(M*Syy - Sy^2); VarSet("corr" + lag, IIf(var1 > 0, (M*Sxy - Sx*Sy)/sqrt(var1), 0)); //Compute correlation for each value of lag //VarSet("corrScale" + lag, IIf(var1 > 0, 0.5*((M*Sxy - Sx*Sy)/sqrt(var1) + 1), 0)); //Scale each correlation to range between 0 and 1 } /*//Plot as a Heatmap (for scale each correlation to range between 0 and 1) for(period = 3; period <= 48; period++) { corr = VarGet("corrScale" + period); Red = IIf(corr > 0.5, 255*(2 - 2*corr), 255); Green = IIf(corr > 0.5, 255, 2*255*corr); PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel); }*/ /* The DFT is accomplished by correlating the autocorrelation at each value of lag with the cosine and sine of each period of interest. The sum of the squares of each of these values represents the relative power at each period. */ for(period = 10; period <= 48; period++) { cosinePart = 0; sinePart = 0; for(n = 3; n <= 48; n++) { cosinePart += VarGet("corr" + n)*cos(2*pi*n / period); sinePart += VarGet("corr" + n)*sin(2*pi*n / period); } VarSet("sqSum" + period, cosinePart^2 + sinePart^2); } //EMA is used to smooth the power measurement at each period for(period = 10; period <= 48; period++) VarSet("r" + period, AMA((VarGet("sqSum" + period))^2, 0.2)); //Find Maximum Power Level for Normalization K = AGC(10, 48, 1.5); for(period = 10; period <= 48; period++) { if(period == 10) VarSet("maxPwr", 0); VarSet("maxPwr", IIf(VarGet("r" + period) > VarGet("maxPwr"), K*VarGet("r" + period), VarGet("maxPwr"))); } //Normalization power for(period = 10; period <= 48; period++) VarSet("pwr" + period, VarGet("r" + period)/VarGet("maxPwr")); //Compute the dominant cycle using the CG of the spectrum Spx = 0; Sp = 0; for(period = 10; period <= 48; period++) { Spx += IIf(VarGet("pwr" + period) >= 0.5, period*VarGet("pwr" + period), 0); Sp += IIf(VarGet("pwr" + period) >= 0.5, VarGet("pwr" + period), 0); } dominantCycle = IIf(Sp != 0, Spx / Sp, 0); dominantCycle =(dominantCycle); if(isHeatMap) { //Plot as a Heatmap for(period = 10; period <= 48; period++) { pwr = VarGet("pwr" + period); Red = IIf(pwr > 0.5, 255, 2*255*pwr); Green = IIf(pwr > 0.5, 255*(2*pwr - 1), 0); PlotOHLC( period-1, period-1, period, period, "", ColorRGB( Red, Green, 0 ), styleCloud | styleNoLabel, Null, Null, 0, 0); } } if(isDomCyc) Plot(LastValue(dominantCycle,1), "Dominant Cycle", colorBlue, styleThick, Null, Null, 0, 1); pds=LastValue(dominantCycle,1); //"BB-MACD") Created by KelvinHand SetChartBkColor( ParamColor("background",colorBlack) ); A1=EMA(C,pds/2)-EMA(C,pds); BBtop=BBandTop(A1,10,1); BBbot=BBandBot(A1,10,1); Color=IIf(a1<0 AND a1>Ref(a1,-1), colorLime,IIf(a1>0 AND a1>Ref(a1,-1),colorBrightGreen,IIf(a1>0 AND a1<Ref(a1,-1),colorCustom12,colorRed))); Plot(a1,"MACD",color,styleThick+styleLine); Plot(BBtop,"BBtop",colorWhite,styleDashed); Plot(BBbot,"BBbot",colorWhite,styleDashed); Plot(0,"",colorWhite,1); AddColumn(round(dominantCycle), " DominantCycle", 2.0 , colorRed, colorLightYellow,50) ; return dominantCycle; } filtData = RoofingFilter(LPeriod, HPeriod); AutocorrelationPeriodogram(filtData, IsPlotHeatMap, IsPlotDominantCycle);]]>

Using Amibroker I would like to Plot the "BB-MACD" Created by KelvinHand

for a Variable time period Dominant Cycle as calculated by "Ehlers Autocorrelation Periodogram" code below

I have only able to plot the "BB-MACD" Created by KelvinHand

using the fixed time period of the last value of "Ehlers Autocorrelation Periodogram"

Hoping that you can help

Thanking you in advance

Best regards

Derek

///////////////////////////////////////////////

The method to trade outside bars is to open position in the direction of outside bar’s high or low breakout. It is better to open trades when breakout happens in the direction of the outside bar. On bullish outside bar, look for upward breakout, and for a bearish outside bar, look for downward breakout of the outside bar. Trader must use discretion in picking outside bar trading setups. There may be many outside bars in chart but they all does not make good breakout trades. Outside bars formed at key support/resistance level are good setups. Breakout from consolidation with an outside bar setup is another good trading setup. See the image attached.

]]>There are basically two ways to trade an inside bar setup: As a continuation signal or as a reversal signal. The image illustrates these setups. When an inside bar is formed in an uptrend, it is a temporary pause of the uptrend. So upward breakout of the mother bar is likely to present a good trading opportunity. In a down trend, downward breakout of the mother bar presents a good sell opportunity. At key support/Resistance levels, the Inside Bar setup will act as a trend reversal setup. Traders should use discretion in picking inside bars for trading. Inside bars formed inside a trading range is not good for breakout trades as the consolidation will continue till price break out from the trading range.

]]>

Pinbars can be traded with different entry methods. Wait for the Pinbar to complete. Open trade at the start of next bar with a market order. Another method is opening trade on a 50% retrace of the PinBar. In this method, trader waits for the price to retrace to the midpoint of the entire Pinbar’s range. More conservative approach is to place a stoploss buy order above the high of the Bullish Pinbar and stoploss sell order below the low the Bearish Pinbar.

Traders can use their discretion in opening trades with the Pinbar. One of the best methods is to trade Pinbars formed in the direction of trend. This can be considered as trend continuation trades. Reversal trades can be opened when the Pinbar is formed at important resistance or support levels. See the chart attached. Placing the stoploss for the trade at the opposite end of the pin bar is good. Pinbars work best when they are formed at important support or resistance levels.

]]>

Traders can open Buy position when price moves above RSI adaptive moving average and the price bars remain above the average. Profit can be booked when the price bars comes back to the moving average and begins to trade above and below the moving average. The opposite conditions can be used to open Sell positions.

RSI adaptive moving average can be customized through the parameters. To change the parameter values, open the VTL script in VTL editor. The option available is RSI period. Enter the new parameter value, compile the script and attach it chart again.

]]>