m1=MACD(r1,r2); s1=Signal(r1,r2,r3); mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND m1>s1,colorBrightGreen,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed)));
////////// m1=MACD(r1,r2); s1=Signal(r1,r2,r3); mycolor=IIf(m1<0 AND m1>s1, ColorRGB(230,230,0),IIf(m1>0 AND m1>s1,colorWhite,IIf(m1>0 AND m1<s1,colorOrange,colorDarkRed))); if(Show_color)
_SECTION_BEGIN("Breakout Setting"); Buyperiods=Param("Breakout periods best is usually 18",5,1,100,1,1); Sellperiods=Param("Exit Breakout",5,1,100,1,1);
P = HaClose; Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 20, 2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods ); if( Type == "Wilders" ) m = Wilders( P, Periods ); if( Type == "Simple" ) m = MA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", colorDarkYellow),ParamStyle("Style",styleLine |styleThick|styleDots|styleNoTitle ,maskAll),Displacement );
_SECTION_END();
_SECTION_BEGIN("Average 1");
P = HaClose; Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 60, 2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods ); if( Type == "Wilders" ) m = Wilders( P, Periods ); if( Type == "Simple" ) m = MA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", colorDarkGreen),ParamStyle("Style",styleLine |styleThick|styleDots|styleNoTitle ,maskAll),Displacement );
_SECTION_END();
_SECTION_BEGIN("Average 2");
P = HaClose; Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 100, 2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods ); if( Type == "Wilders" ) m = Wilders( P, Periods ); if( Type == "Simple" ) m = MA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", ColorRGB(70,70,70)),ParamStyle("Style",styleLine |styleThick|stylehidden|styleDots|styleNoTitle ,maskAll),Displacement );
_SECTION_END();
_SECTION_BEGIN("Average 5"); P = HaClose; Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 120 ,2, 200 ); Displacement = Param("Displacement", 1, -50, 50 ); m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods ); if( Type == "Wilders" ) m = Wilders( P, Periods ); if( Type == "Simple" ) m = MA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", colorCustom13),ParamStyle("Style",styleLine |styleThick|styleDots|styleNoTitle ,maskAll),Displacement ); _SECTION_END();
_SECTION_BEGIN("Sell Average 3"); P = HaClose; Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 180, 2, 800 ); Displacement = Param("Displacement", 1, -50, 50 ); m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods ); if( Type == "Wilders" ) m = Wilders( P, Periods ); if( Type == "Simple" ) m = MA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", ColorRGB(150,150,150)),ParamStyle("Style",styleLine |styleThick|styleDots|styleNoTitle ,maskAll),Displacement ); _SECTION_END();
_SECTION_BEGIN("Average 4"); P = HaClose; Type = ParamList("Type", "Weighted,Lagless-21,Hull-26,Linear Regression-45,Exponential,Double Exponential,Tripple Exponential,Wilders,Simple"); Periods = Param("Periods", 500, 2, 800 ); Displacement = Param("Displacement", 1, -50, 50 ); m = 0;
if( Type == "Weighted" ) m= WMA( P, Periods ); if( Type == "Lagless-21" ) m= 2*EMA(P, Periods)-EMA(EMA(P, Periods), Periods); if( Type == "Hull-26" ) m= WMA(2*(WMA(P, Periods/2))-WMA(P, Periods) ,4 ); if( Type == "Linear Regression-45" ) m= LinearReg( P, Periods ); if( Type == "Exponential" ) m = EMA( P, Periods ); if( Type == "Double Exponential" ) m = DEMA( P, Periods ); if( Type == "Tripple Exponential" ) m = TEMA( P, Periods );
Plot( m, _DEFAULT_NAME(), ParamColor("Color", ColorRGB(190,190,190)),ParamStyle("Style",styleLine |styleThick|stylehidden|styleDots|styleNoTitle ,maskAll),Displacement ); _SECTION_END();
CloudResColor=ParamColor("CloudResColorLong",colorDarkGrey); BrCount7=Param("CloudResLengthLong",300,1,500,1); for (i=0;i<BarCount-BrCount7;i++) //hide the line except most recent 10 bars { CloudResColor[i] = colorBlack; }
if (nLLVAfterLastPiv < aLPivLows[0] AND (nLLVIdxAfterLastPiv - lastHPIdx - 1) >= 1 AND nLLVIdxAfterLastPiv != curBar ) {
// -- OK, we'll add this as a pivot. // Mark it for plotting... aLPivs[nLLVIdxAfterLastPiv] = 1; aAddedLPivs[nLLVIdxAfterLastPiv] = 1;
// ...and then rearrange elements in the // pivot information arrays for (j=0; j<nLPivs; j++) { aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)]; aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)]; } aLPivLows[0] = nLLVAfterLastPiv; aLPivIdxs[0] = nLLVIdxAfterLastPiv; nLPivs++;
// -- Test whether to add piv given last piv is high // AND we have lower highs }
// -- Here, the last piv is a high piv, and we have // higher-highs. The most likely addition is a // Low piv that is a retracement. } else {
if (nLLVAfterLastPiv > aLPivLows[0] AND (nLLVIdxAfterLastPiv - lastHPIdx - 1) >= 1 AND nLLVIdxAfterLastPiv != curBar ) {
// -- OK, we'll add this as a pivot. // Mark it for plotting... aLPivs[nLLVIdxAfterLastPiv] = 1; aAddedLPivs[nLLVIdxAfterLastPiv] = 1;
// ...and then rearrange elements in the // pivot information arrays for (j=0; j<nLPivs; j++) { aLPivLows[nLPivs-j] = aLPivLows[nLPivs-(j+1)]; aLPivIdxs[nLPivs-j] = aLPivIdxs[nLPivs-(j+1)]; } aLPivLows[0] = nLLVAfterLastPiv; aLPivIdxs[0] = nLLVIdxAfterLastPiv; nLPivs++;
// -- Test whether to add piv given last piv is high // AND we have lower highs } // -- The last piv is a high and we have higher highs // OR lower highs }
/* ************************************************** ************** Still finding missed pivot(s). Here, the last piv is a low piv. ************************************************** ************** */ } else {
// -- First case, lower highs if (aHPivHighs[0] < aHPivHighs[1]) {
if (nHHVAfterLastPiv < aHPivHighs[0] AND (nHHVIdxAfterLastPiv - lastLPIdx - 1) >= 1 AND nHHVIdxAfterLastPiv != curBar ) {
// -- OK, we'll add this as a pivot. // Mark that for plotting aHPivs[nHHVIdxAfterLastPiv] = 1; aAddedHPivs[nHHVIdxAfterLastPiv] = 1;
// ...and then rearrange elements in the // pivot information arrays for (j=0; j<nHPivs; j++) { aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)]; aHPivIdxs[nHPivs-j] = aHPivIdxs[nhPivs-(j+1)]; } aHPivHighs[0] = nHHVAfterLastPiv; aHPivIdxs[0] = nHHVIdxAfterLastPiv; nHPivs++;
// -- Test whether to add piv given last piv is high // AND we have lower highs }
// -- Second case when last piv is a low piv, higher highs // Most likely addition is high piv that is a retracement. // Considering adding a high piv as long as it is higher } else {
// -- Where I have higher highs, if (nHHVAfterLastPiv > aHPivHighs[0] AND (nHHVIdxAfterLastPiv - lastLPIdx - 1) >= 1 AND nHHVIdxAfterLastPiv != curBar ) {
// -- OK, we'll add this as a pivot. // Mark it for plotting... aHPivs[nHHVIdxAfterLastPiv] = 1; aAddedHPivs[nHHVIdxAfterLastPiv] = 1;
// ...and then rearrange elements in the // pivot information arrays for (j=0; j<nHPivs; j++) { aHPivHighs[nHPivs-j] = aHPivHighs[nHPivs-(j+1)]; aHPivIdxs[nHPivs-j] = aHPivIdxs[nhPivs-(j+1)]; } aHPivHighs[0] = nHHVAfterLastPiv; aHPivIdxs[0] = nHHVIdxAfterLastPiv; nHPivs++;
// -- Test whether to add piv given last piv is high // AND we have lower highs }
}
}
// -- If there are at least two of each }
/* **************************************** // -- Done with finding pivots ***************************************** */
// -- Do TCZ calcs. Arrangement of pivs very specific // for this setup. if (nHPivs >= 2 AND nLPivs >=2 AND aHPivHighs[0] > aHPivHighs[1] AND aLPivLows[0] > aLPivLows[1]) {
// -- Are retracement levels arranged in // tcz order?
// .500 is above .786 for long setups tcz500 >= (tcz786 * (1 - .005)) AND // .681 is below .786 for long setups tcz618 <= (tcz786 * (1 + .005)) AND
// -- Is the low in the tcz range // -- Is the close >= low of tcz range // and low <= high of tcz range retrcClose >= ((1 - .01) * tcz618) AND retrcPrc <= ((1 + .01) * tcz500) );
// -- risk would be high of signal bar minus low of zone //risk = 0;
// -- lower highs and lower lows } else if (nHPivs >= 2 AND nLPivs >=2 AND aHPivHighs[0] < aHPivHighs[1] AND aLPivLows[0] < aLPivLows[1]) {
TM = T3 ( Close , Prd1 ) ; TM2 = T3 ( Close , Prd2 ) ; TimeFrameRestore(); BullishRevers=Close>TM AND Close<TM2; Bullish=Close>TM AND Close>TM2; BearishRevers=Close<TM AND Close>TM2; Bearish=Close<TM AND Close<TM2;
No comments:
Post a Comment
Thanks