Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 08-18-2009, 06:35 AM   #1

Join Date: Jul 2009
Location: london
Posts: 25
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Squeeze Alert

Hi i would like to set an alert up when the squeeze fires off but only for buycolour1 and sellcour1..

here is the squeeze code im using

Code:
Inputs: Price(Close), price2(close),Price3(H/3+L/3+C/3),
	 Length(20),
	 Length2(13),
	 Length3(21),
	 Length4(9),
	 Style(1),
	 nK(1.5), 
	 nBB(2), 
 	 AlertLine( 1 ),
	 BuyColor1(blue), BuyColor2(darkblue),
	 SellColor1(red), SellColor2(darkred),
	 NormalColor(Red),AlertColor(Blue),
	 CounterTrend(true); 

vars:FastVal1(0), SlowVal1(0), Diff1(0),
     FastVal2(0), SlowVal2(0), Diff2(0),
     FastVal3(0), SlowVal3(0), Diff3(0),
     FastVal4(0), SlowVal4(0), Diff4(0),
     AvgDiff(0), AvgDif(0), poles(4),
     CCIValue(0),DownCT(0),UpCT(0),SDev(0),ATR(0),LHMult(0),Denom(0),BBS_Ind(0);

if Style = 0 then begin
	{Zero Line - BB Squeeze}
	if ( barnumber=1 ) then 
	Begin
	  If minmove <> 0 then
	    LHMult = pricescale/minmove;
	end;

	{-- Calculate BB Squeeze ----------------------}
	ATR = AvgTrueRange(Length);
	SDev = StandardDev(Price, Length, 1);

	Denom = (nK*ATR);
	If Denom <> 0 then BBS_Ind = (nBB * SDev) /Denom; 

	If BBS_Ind < Alertline then
	  SetPlotColor(1, NormalColor)
	else
	  SetPlotColor(1, AlertColor);

	{-- Plot Index & Alert Line -------------------------}
	Plot1(0, "Squeeze");
end;

if Style = 1 then begin
	{Zero Line - Gauss filter}
	value1 = Gauss(Price3,Length3,3);

	if (Value1) > (Value1[1]) then 
	SetPlotColor(1, BuyColor1);
	if (Value1) < (Value1[1]) then 
	SetPlotColor(1, SellColor1);
	//SetPlotWidth(1,7);
	Plot1(0, "Squeeze");
end;


{Histogram} 
FastVal1 = Gauss(price, 8, poles);
SlowVal1 = Gauss(price, 21, poles);
Diff1 = FastVal1 - SlowVal1;
FastVal2 = Gauss(price, 13, poles);
SlowVal2 = Gauss(price, 34, poles);
Diff2 = FastVal2 - SlowVal2;
FastVal3 = Gauss(price, 21, poles);
SlowVal3 = Gauss(price, 55, poles);
Diff3 = FastVal3 - SlowVal3;
FastVal4 = Gauss(price, 34, poles);
SlowVal4 = Gauss(price, 89, poles);
Diff4 = FastVal4 - SlowVal4;
AvgDiff = (Diff1+Diff2+Diff3+Diff4)/4;

plot2(AvgDiff,"DiffHisto") ;
//setplotwidth(2,7);
if AvgDiff > 0 then 
  if AvgDiff > AvgDiff[1] then 
    setplotcolor(2,BuyColor1)
  else
    setplotcolor(2,BuyColor2) ;

if AvgDiff < 0 then 
  if AvgDiff < AvgDiff[1] then setplotcolor(2,SellColor1)
else
  setplotcolor(2,SellColor2);



{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{ Counter Trend Mode}
if CounterTrend = true then begin
	CCiValue = CCI(13);

	Condition1 = ccivalue[1] > 50;
	Condition2 = CCivalue < 50;
	Condition3 = CCivalue[1] < 100;
	Condition4 = CCiValue > 100;
	Condition5 = AvgDiff > 0;
	Condition6 = AvgDiff[1] > 0;
	Condition7 = AvgDiff[2] > 0;
	Condition8 = ccivalue < 100;

	if Condition1 and Condition2 and Condition5 and condition6 and condition7 then begin
	  setplotcolor(2,SellColor2);
	  DownCT = 1;
	end;

	if DownCT = 1 and AvgDiff < 0 then DownCT =0;

	if DownCT = 1 and Condition8 and Condition5 then setplotcolor(2,SellColor2);

	if DownCT = 1 and Condition3 and Condition4 then begin
	  setplotcolor(2,BuyColor1);
	  DownCT = 0;
	end;

	Condition11 = ccivalue[1] < -50;
	Condition12 = CCivalue > -50;
	Condition13 = CCivalue[1] >- 100;
	Condition14 = CCiValue < -100;
	Condition15 = AvgDiff < 0;
	Condition16 = AvgDiff[1] < 0;
	Condition17 = AvgDiff[2] < 0;
	Condition18 = ccivalue >-100;

	if Condition11 and Condition12 and Condition15 and condition16 and condition17 then begin
	  setplotcolor(2,BuyColor2) ;
	  UpCT = 1;
	end;

	if UpCT = 1 and AvgDiff > 0 then UpCT =0;
	if UpCT = 1 and Condition18 and Condition15 then setplotcolor(2,BuyColor2) ;
	if UpCT = 1 and Condition13 and Condition14 then begin
	  setplotcolor(2,SellColor1);
	  UpCT = 0;
	end;
08704870334
end;
I have tried the following

if AvgDiff < AvgDiff[1] then Alert ( "Short" );

but its not working, anyone know how to alert for this?

Thanks
kamakazy is offline  
Reply With Quote
Old 08-18-2009, 07:21 AM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Squeeze Alert

I don't see the alert in your code.
Tams is offline  
Reply With Quote
Old 08-18-2009, 07:29 AM   #3

Join Date: Jul 2009
Location: london
Posts: 25
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Re: Squeeze Alert

sorry its not in that i added it to the bottom, i just wanted to put up the original code before i added the alert!

I added

if AvgDiff < AvgDiff[1] then Alert ( "Short" );

to the bottom of the file before the, end;
kamakazy is offline  
Reply With Quote
Old 08-18-2009, 07:40 AM   #4

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Squeeze Alert

Quote:
Originally Posted by kamakazy »
...
but its not working, anyone know how to alert for this?

Thanks

go to Format Study,

make sure the alert is ENABLED.
Tams is offline  
Reply With Quote
Old 08-18-2009, 07:54 AM   #5

Join Date: Jul 2009
Location: london
Posts: 25
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Re: Squeeze Alert

yes its enabled and firing off!!!!

BUT

It fires off even when the squeeze is the wrong colour!

If its green i still get a short alert!
kamakazy is offline  
Reply With Quote
Old 08-18-2009, 07:59 AM   #6

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Squeeze Alert

Quote:
Originally Posted by kamakazy »
yes its enabled and firing off!!!!

BUT

It fires off even when the squeeze is the wrong colour!

If its green i still get a short alert!


write out your logic on paper...

covering ALL the permutations,
including all the ON conditions and OFF conditions.


you will see the "hole" once you have done that.
Tams is offline  
Reply With Quote
Old 08-18-2009, 09:33 AM   #7

Join Date: Jul 2009
Location: london
Posts: 25
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Re: Squeeze Alert

yea have been for 2 weeks¬

if your talking about if AvgDiff > 0 then

I have tried that it does nothing different!
kamakazy is offline  
Reply With Quote
Old 08-18-2009, 10:57 AM   #8

Join Date: Jul 2009
Location: london
Posts: 25
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Re: Squeeze Alert

hmm though it seems to work ok if i turn off countertrtend mode!!
kamakazy is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add the Timeframe to the Alert Box in TS? daedalus Coding Forum 9 06-29-2009 10:24 PM
Suggestion for Scam Alert brownsfan019 Support Center 1 10-29-2008 08:45 PM
BB Squeeze (Version of TTM Squeeze) ashokkuttan Market Analysis 26 08-14-2008 01:34 PM
Alert on Tradestation volume? Greycells Coding Forum 2 12-13-2007 11:02 AM
Stay Alert! 11/15/07 Soultrader Market Analysis 0 11-15-2007 05:03 AM

All times are GMT -4. The time now is 01:43 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.