Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

caglebagle

Squeezer

Recommended Posts

Here's a little indicator I coded a while back which displays the upper and lower band values when a bollinger band squeeze is on. The price lines disappear when the bands exit the squeeze. The idea is to place an entry bracket at price lines in anticipation of the breakout. Hope someone finds it useful. :)

 

inputs:
BollingerPrice( close),
bbLength( 13 ),
NumDevsUp( 2 ),
NumDevsDn( -2),
Displace( 0 ) ,
kPrice( Close ), 
kLength( 13 ), 
NumATRs( 1.5 ),
Plotbb(false); 

variables:
bbAvg( 0 ),
kAvg(0),
SDev( 0 ),
bbLowerBand( 0 ),
bbUpperBand( 0 ), 
Shift( 0 ),
	kLowerBand( 0 ), 
kUpperBand( 0 ),
decimals(autodecimals),
rndbbupperband(0),
rndbblowerband(0);


{bb}
bbAvg = AverageFC( BollingerPrice, bbLength ) ;
SDev = StandardDev( BollingerPrice, bbLength, 1 ) ;
bbUpperBand = bbAvg + NumDevsUp * SDev ;
bbLowerBand = bbAvg + NumDevsDn * SDev ;
{kc}
kAvg = AverageFC( kPrice, kLength ) ;
Shift = NumATRs * AvgTrueRange( kLength ) ;
kUpperBand = kAvg + Shift ;
kLowerBand = kAvg - Shift ;
{bb}
If plotbb=true then begin	
if Displace >= 0 or CurrentBar > AbsValue( Displace ) then 
begin
Plot1[Displace]( bbUpperBand, "UpperBand" ) ;
Plot2[Displace]( bbLowerBand, "LowerBand" ) ;
Plot3[Displace]( bbAvg, "MidLine" ) ;
end;
{kc}
if Displace >= 0 or CurrentBar > AbsValue( Displace )  then 
begin
Plot4[Displace]( kUpperBand, "UpperBand" ) ;
Plot5[Displace]( kLowerBand, "LowerBand" ) ;

end;
end;

If bbUpperBand<=kUpperband or bbLowerband>=klowerband then begin
setplotcolor(1,yellow);
setplotcolor(2,yellow);
end;	

if lastbaronchart then begin

value1=TL_new(currentdate, currenttime+5, bbUpperband, currentdate, currenttime+5, bbUpperband);
value2=TL_new(currentdate, currenttime+5, bbLowerband, currentdate, currenttime+5, bbLowerband);

TL_SetExtRight(1, true);
TL_SetExtRight(2, true);


TL_SetStyle(1, tool_solid);
TL_SetStyle(2, tool_solid);



TL_SetColor(1, yellow);
TL_SetColor(2, yellow);


TL_SetSize(1, 0);
TL_SetSize(2, 0);


rndbbupperband=roundinst(bbupperband);
rndbblowerband=roundinst(bblowerband);
value3=Text_New(Date, time, 0, numtostr(rndbbupperband,decimals));

Text_SetLocation(1, currentDate, currenttime+5, bbupperband);
Text_SetColor(1, green);

value4=Text_New(Date, Time, 0, numtostr(rndbblowerband,decimals));
Text_SetLocation(2, currentDate, currenttime+5, bblowerband);
Text_SetColor(2, red);
If  bbUpperBand>=kUpperband or bbLowerband<=klowerband then begin
TL_Delete(1);
TL_Delete(2);
Text_Delete(1);
Text_Delete(2);
end;




end;

 

Let me know if you have any issues. Squeezer.eld is the indicator. Auto Decimals.eld and RoundInst.eld are functions referenced in the indicator.

 

JC

SQUEEZER.ELD

AUTO DECIMALS.ELD

ROUNDINST.ELD

Edited by caglebagle

Share this post


Link to post
Share on other sites

I found another squeeze related indicator that I coded a while back. This one is a paintbar indicator and paints the bars when a squeeze is entered. It works well with the above indicator and the BB Squeeze indicator.

 

JC

SQUEEZRPB.ELD

SqueezrPB.thumb.png.7c34089fa96b3c2e0a92ecaa40c0f440.png

Edited by caglebagle

Share this post


Link to post
Share on other sites
I found another squeeze related indicator that I coded a while back. This one is a paintbar indicator and paints the bars when a squeeze is entered. It works well with the above indicator and the BB Squeeze indicator.

 

JC

 

Thx JC.....will load it up & backtest it & test it live tomorrow. Good work, looks great!!......ajax :)

Share this post


Link to post
Share on other sites

Make sure a squeeze is occurring or else the price lines will not be drawn. This is intentional. Try changing the plotbb setting to true to check if it's working. Also be sure you also installed the necessary function elds.

 

JC

Share this post


Link to post
Share on other sites

JC.....thx.....but still can't get it to show on the charts, tho see it in there on the list. So, any other suggestions to make it visible would be much appreciated. When ya have time, no hurry. Thx again.....ajax

Share this post


Link to post
Share on other sites
You won't see anything until the keltners enter the bb's unless you turn the bands on. The lines disappear once the keltners exit. Try turning the bands on just to check if it's displaying.

 

JC

 

thx JC....will try that .... :)

Share this post


Link to post
Share on other sites

All I can think of is to try reinstalling it from the .eld file or maybe try placing carets around the the Tl_delete and text delete commands at bottom of code......this will force the price lines to always be displayed. It's been working on my machine with version 8.6, so I'm not really sure why it's misbehaving.

 

Hope it helps,

JC

:missy:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.