Page 1 of 3

The "Squeeze"

Posted: Thu Sep 21, 2006 6:00 pm
by TxTrader
Hello all,

Here is the code for the squeeze. I would like to know if someone could add an alert for when the black dot appears? I would like to run this indicator on several charts and time frames and it gets confusing and tiring flipping thru charts all day.

Thanks to all for a super site and super work!


function preMain() {
setStudyTitle("FPSqueeze");
setCursorLabelName("FPSqueeze", 0);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_HISTOGRAM,0);
setDefaultBarThickness(4,0);

//addBand(0,PS_SOLID,1,Color.black,"zero");

var BBlow=null;
var BBhigh=null;
var KClow=null;
var KChigh=null;
var Mom=null;
var vHigh=null;
var vLow=null;
var vClose=null;

var fp1 = new FunctionParameter("nMA", FunctionParameter.NUMBER);
fp1.setName("Squeeze Moving Average");
fp1.setLowerLimit(1);
fp1.setDefault(20);

var fp2 = new FunctionParameter("nSD", FunctionParameter.NUMBER);
fp2.setName("Standard Deviation");
fp2.setLowerLimit (1);
fp2.setDefault(2.0);

var fp3 = new FunctionParameter("nColorSqueeze", FunctionParameter.COLOR);
fp3.setName("Squeeze Color");
fp3.setDefault(Color.red);

var fp4 = new FunctionParameter("nColorAction", FunctionParameter.COLOR);
fp4.setName("Action Color");
fp4.setDefault(Color.lime);
}
function ATR(nInputLength) {

var dSum = 0;

var dH = high(0, -nInputLength);

var dL = low(0, -nInputLength);

var dC = close(-1, -nInputLength);

if (dH == null || dL == null || dC == null) {

return;

}

for (i = 0; i < nInputLength; ++i) {

var vTrueHigh = Math.max(dH[i], dC[i]);

var vTrueLow = Math.min(dL[i], dC[i]);

var vTrueRange = (vTrueHigh - vTrueLow);

dSum += vTrueRange;

}

dSum /= nInputLength;

return dSum;

}


function main(nMA, nSD, nColorSqueeze, nColorAction) {

//Bollinger Band Variables using 1.4 Standard Deviation
var myStudy1 = upperBB (nMA,nSD);
var myStudy2 = lowerBB (nMA,nSD);
var momStudy1 = ema(10,mom(12));
var macdstudy = new macdHist(12,26,9);

BBlow = myStudy2.getValue(0);
BBhigh = myStudy1.getValue(0);
Mom = momStudy1.getValue(0);
macdvalue = macdstudy.getValue(0);



var BarCntr;

var nRangeFactor = 1.5;



if (getBarState() == BARSTATE_NEWBAR)

BarCntr += 1;



if (BarCntr < nMA) {

return;

} else {

var dKeltnerBasis= call("/Library/KeltnerEMA.efs", nMA);
var dATR = ATR(nMA);
KClow = (dKeltnerBasis - (nRangeFactor * dATR));
KChigh = (dKeltnerBasis + (nRangeFactor * dATR));
}
//Logic to create red or blue squeeze signal
if ((BBhigh <= KChigh) || (BBlow >= KClow)) {
drawShapeRelative(0,0,Shape.CIRCLE,null,nColorSqueeze,Shape.TOP);
}
if ((BBhigh > KChigh) || (BBlow < KClow)) {
drawShapeRelative(0,0,Shape.CIRCLE,null,nColorAction,Shape.TOP);
}



if (Mom > 0) {
setBarFgColor(Color.blue);
}
else {
setBarFgColor(Color.red);
}

drawTextPixel( 1, 93, "Squeeze ", Color.black, null, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM | Text.BOLD, "Arial",10 );

return ((Mom+macdvalue)/2);

}

Posted: Sat Sep 23, 2006 4:07 pm
by watzdorf
TxTrader,
what is this indicator doing? How does it work?
Thank you

Alex

Posted: Sat Sep 23, 2006 4:21 pm
by zeller4
TxTrader or anybody who may know,
Do you know how to create the darker shading on the backing off side of the histogram bars? Also, you talked about a black dot but I haven't seen one. Do you have a screenshot where one occured so I may reproduce the signal? I'm using AB - what symbol(s) are you using?
Kirk

Alex,
go to TTM (Trade the Markets) or search for TTM or squeeze. TRO had a link I'm trying to find where Hubert (from TTM) explains it. If I can find I will post.

Posted: Sat Sep 23, 2006 10:10 pm
by watzdorf
Thank you Zeller4, found it :)

Posted: Sat Sep 23, 2006 11:31 pm
by TxTrader
Screenshot of FP squeeze.
Using code that was posted, I am not able to get any black dots either? So something is different somewhere.



Posted: Sun Sep 24, 2006 1:44 am
by zeller4
I know the Tradestation forum (not necessarily on Kreslik) had a revised squeeze version with an extra dot but I haven't seen in e-signal. Thanks for the screenshot. Was FPsqueeze on the esignal forum? (if you can say where you got or if you coded it?) FWIW, I'm testing with Bollinger and Keltner bands. I think I understand the setup for when you enter long but not when a short position is setup. If anyone knows, please reply or post a screenshot with entry notes. Thanks in advance.
Kirk

Posted: Sun Sep 24, 2006 3:34 am
by TxTrader
zeller,

I think the black dot is a preliminary signal, like one band/upper or lower of BB has broken out of Keltner channels, then the full signal is when both break out. Just an idea.

On the short/long position, this only a momentum play, so therefore if the histogram is red then sell, blue then buy. Or you can use another indicator that you are comfortabel with that tends to show market direction.

TRO has been gracious enough to supply plenty! Thanks TRO.

Good trading,

oh, this code is in the Esignal database under the Forex group and at Forexproject.com.

Posted: Sat Feb 17, 2007 11:03 am
by Tyler19
If your using Esignal with the squeeze code. Then the dots are different colors. RED dot means wait signal is coming. first Green dot after the red dot means take position in direction of histogram. The dots are located in a line between the positive and negative histogram.

Hope that helps.

Posted: Sat Feb 17, 2007 12:26 pm
by Patch
Hi Tyler19

Could you post a chart for guys like me that don't have Esignal ao I can see what you are talking about.

Thanks
Jeff in VA

Posted: Sat Feb 17, 2007 4:44 pm
by Tyler19
Hey Jeff, I'm in Burke. How are you liking the Ice?