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.


  • Topics

  • Posts

    • I guess US has fund managers and investment banking institutions looking after the portfolios on behalf of their clients.
    • There are many resources related to forex trading available on forums like babypips and forexfactory etc.
    • Candle stick pattern is one of the easiest charting patterns available to learn and make money. However, new traders never learn about the skills needed for earning money but they rush for making money and eventually lose their money.
    • Nothing wrong with being a ‘progressive’. Nothing wrong with being a ‘conservative’.  Very generally, ‘conservatives’ have preponderance of the here and now neurotransmitters, prefer empirical references, the rule of law, and value individual agency (It has been said that conservatives love humans and progressives love humanity) . Very generally, ‘progressives’ are dopaginaric - driven by passion for a better possible future, prefer references to others  (Example Karmela won’t answer questions with facts.  She cites the opinion of 18 ‘experts’), have a penchant for rule by man/mobs not by law , and value ‘societal' agency.  However, excesses of either tendency indicates mental illness, collective malaise, and has consequences.  When either camp is systematically captured by control seekers and/or, situationally by mobs, the whole is lessened. A key sign that is occurring is when one side no longer allows disagreement.  Progressives have  currently gone crazy in those excesses and are no longer allowing anything but unithought... examples - You can still be a vocal pro choice republican.  Try being a vocal pro life democrat. For snicks just try it.  You’ll get cancelled.  Bust a myth about blacks in America, true up the real  history of Republicans ending slavery and what has happened since, how the democrats are the party of the KKK, how Obama did not a fkn thang for blacks in general, be a black republican, etc.    You will get canceled in a heartbeat. Step up and question the social agendas of federally subsidized schools at a board meeting... get treated like shit and also get an immediate case number with the FBI ... Question the requirements to watch and lickkiss the 'rainbows' and also make sure your kids show up for it, not to mention fund transitions out of your pocket and see what you get ‘labeled’ Question mainstream media bias - even just to mention that biased, agenda driven narrative is different from truth in reporting - and see what happens to your voice... Excesses have consequences... imbalances have consequences... just sayin’
    • SBUX Starbucks stock, watch for a top of range breakout above 99.81 at https://stockconsultant.com/?SBUX
×
×
  • Create New...

Important Information

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