modo=Param("Modo= 1 horario, 2 ticks, 3 rango, ",3,0,3); TimeFrameMode(modo); tics=Param("tics",25,1,1000); TimeFrameSet(tics); viewchart=ParamToggle("Chart","View|Hide",0); if(Viewchart) PlotOHLC(O*100,H*100,L*100,C*100,"Chart",colorBrightGreen); Viewtrend=ParamToggle("Trend ","View|Hide",0); if (Viewtrend){ /* Trend Sensitive Moving Average, by D.Tsokakis, May 2003*/ P=25; CMO25=100*((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),P))-(Sum(IIf(CRef(C,-1),(C-Ref(C,-1)),0),P)+(Sum(IIf(CPreferences==>Intraday.... // make sure "Allign minute bars to market hours" is checked... // make sure "Start time of interval" is checked... // make sure "Override: Weekly/monthly bars use day of last trade" is checked. // // The panel presents the selected bars value on the left in the title area, and the last bars values in the right margin area // It is similar to what Woodie uses. Tho see the right margin, set the "Blank bars on the righ margin" (Tools-Preferences...-Charting) // // This panel works on all kind of charts (time, range, volume, tick) // On tick chart the panel cannot determine the current bar's tick size, so it only shows the chart settings. // // Woodie started to use range charts lately (2007). Here are a few example range settings for some futures: // ER2 1.50 // YM 25 // ES 3 // NQ 3.75 // DAX 5 // ZG 1.5 // Use the above setting for the chart. Panel will detect it, no manual setting is needed on the panel. // // Panel is broken up into section, as if it is built up from many indicators. This way panel parameters are presented in groups. // This also allows to "DELETE INDICATOR" menu. However by deleting any parts of the panel you will make the panel not functioning. // // It is also recommended to turn off grid lines of the charts (RClick on the panel-Parameters-Axis & Grid-Show middle lines) // // ******************************************************************************************** // // Entry patterns: // // (1) = zlr (good) // (2) = famir (good) // (3) = vegas trade (this is not well recognized pattern in this panel! It strongly needs visual validation.) // (4) = gb 100 line cross (Good) // (5) = tony trade (Good) // (6) = Ghost (good enough) // You may use more enty patters together, they are presented as the above numbers. // Green numbers are long, red numbers are short entries // // ******************************************************************************************** // // Exit patterns: // // CCI hook: CCI hook back from high or low at least 15 points // CCI 100 exit: Woodie CCI crosses below +100 or above -100 // TCCI hooks into WCCI exit: TCCI crosses WCCI against the trend. (This is not usable alone!) // Mplay Exit: Woodie CCI is falling/raising for at least two bars and Woodie CCI crosses below/above ZL // Heikin-Ashi exit: Low is below open/high is above close on Heikin-Ashi bar // "Sell" is red down arrow at top, "Cover" green hollow up arrow acording to AmiBroker standards. // You may mix more enty patterns together. In this case the earlier one is used. // ******************************************************************************************** // // Other patterns: // // (Circle) = HFE // (WCCI orange highlight): indicates a choppy market defined as cci chopping between +/-100 for at least 10 bars // // ******************************************************************************************** // // Alerts: // // This panel make sound alert on entry end exit signals. // It is recommended to use Alert Output window (View-Output menu) if you have more panels open // // ******************************************************************************************** // // Right side of the panel: // // 0.5p /5t <-- remaing bar point/tick // ZLR LONG <-- pattern // L:8686 <-- long entry price (next bars open, only on range charts) // 6887 6885.5 <-- prev and current bars' highs // 6883 <-- current price // 6882.5 6882 <-- prev and current bars' lows // S:6881.5 <-- short entry price (next bars open, only on range charts) // // ALARM <-- pattern alarm turned on/of // // ******************************************************************************************** // // Panel debugging: // // AmiBroker does not provide any tool for debugging. If you change the panel and want to trace misbehavior, you can print out // array values at selected bar by setting values to "ToolTipDebug" variable. // // Information window has also detailed values and may help to debug the panel. // // ******************************************************************************************** *///Disable printing to commentary window EnableTextOutput(False); SetChartOptions(0,chartShowDates); //Version info of code Revision = " $Revision: 25 $"; PlotText(Revision, Status("firstvisiblebarindex"), -300, colorWhite); //Anything to print at the end of the tooltip for debugging purposes ToolTipDebug = ""; // Bar indexes for titles and commentary CurBarIndex = SelectedValue(BarIndex()); LastBarIndex = LastValue(BarIndex()); _SECTION_END(); //Woodie CCI - YofaTrader _SECTION_BEGIN("Security parameters"); // ******************************************************************************************** // Security properies/parameters // ******************************************************************************************** //Determining market hours MarketOpenTimeParam =ParamTime("Market open time", "15:30:00",0); MarketCloseTimeParam=ParamTime("Market close time", "21:30:00",0); IsMarketHours = Now(4) >= MarketOpenTimeParam //Market hours AND Now(4) <= MarketCloseTimeParam OR Interval(0) >= 86400; // or daily chart //Tick size TickToPriceMult = Param("Tick size of security", 0.1, 0, 10); PriceToTickMult = 1/TickToPriceMult; //number of ticks/pips in 1 full price point //Stop size StopSizeInTicks=Param("Stop loss below entry bar (ticks)",2,0,100); StopSizeInPrice=StopSizeInTicks*TickToPriceMult; //format number to print security price SecurityPriceFormat = Param("Security price format", 4.2, 1, 5, .1); _SECTION_END(); //Security parameters _SECTION_BEGIN("Woodie's CCI panel"); //Background color of the panel BackgroundColorMH = ParamColor("Market hours background color", ColorRGB(160,180,160)); BackgroundColorAH = ParamColor("After hours background color", ColorRGB(180,160,160)); //Set panel background color and static var, so other panels can set bkcolor as well if (LastValue(IsMarketHours)) { SetChartBkColor(BackgroundColorMH); Plot( 300, "", BackgroundColorMH); Plot(-300, "", BackgroundColorMH); StaticVarSet("ChartBkColor"+Name(), BackgroundColorMH); } else { SetChartBkColor(BackgroundColorAH); Plot( 300, "", BackgroundColorAH); Plot(-300, "", BackgroundColorAH); StaticVarSet("ChartBkColor"+Name(), BackgroundColorAH); } // ******************************************************************************************** // Base indicators of Woodie's CCI System // ******************************************************************************************** //CCIs (6, 14, 50 and extra) C6Period=Param("Turbo CCI period",6,0,30); C6Color=ParamColor("Turbo CCI color", colorDarkRed); C6=round(CCI(C6Period)); C14Period=Param("Woodie CCI period",14,0,100); C14Color=ParamColor("Woodie CCI color", colorBlack); C14=round(CCI(C14Period)); C50Period=Param("Long term CCI period",50,0,1000); C50VisibleParam=ParamToggle("Show long term Cci", "No|Yes", False); C50Color=ParamColor("Long term CCI color", colorYellow); C50=round(CCI(C50Period)); C14StrongTrendLevelParam = Param("WCCI - Strong trend level", 200, 120, 300); //level of strong trend... //Ema and Lsma (used in Czi, Swi) Ema34 = EMA(Close,34); Lsma25 = LinearReg(Close, 25); //Calculating price range for last 30 bars (used in Czi, Swi) LowLow30 = LLV(L, 30); Range = 25 / (HHV(H, 30) - LowLow30) * LowLow30; //Ema34 angle (used in "Czi", "Swi") Ema34_y2 = (Ref(Ema34, -1) - Ema34) / Avg * Range; Ema34_c = sqrt(1 + Ema34_y2 * Ema34_y2); Ema34Angle = round(180 * acos(1/Ema34_c) / 3.1415); Ema34Angle = IIf(Ema34_y2 > 0, - Ema34Angle, Ema34Angle); //Lsma25 angle (used in Czi, Swi) Lsma25_y2 = (Ref(Lsma25, -1) - Lsma25) / Avg * Range; Lsma25_c = sqrt(1 + Lsma25_y2 * Lsma25_y2); Lsma25Angle = round(180 * acos(1/Lsma25_c) / 3.1415); Lsma25Angle = IIf(Lsma25_y2 > 0, - Lsma25Angle, Lsma25Angle); //Determining the Woodie CCI trend (used in patterns and histogram coloring) C14Above0 = C14 > 0; C14Below0 = C14 < 0; BarsSinceC14Above0 = BarsSince(C14Above0); BarsSinceC14Below0 = BarsSince(C14Below0); WoodieTrendUp = BarsSinceC14Below0 >= 6; WoodieTrendDown = BarsSinceC14Above0 >= 6; WoodieTrendUp = Flip(WoodieTrendUp, WoodieTrendDown); WoodieTrendDown = Flip(WoodieTrendDown, WoodieTrendUp); //WoodieTrend is always 1 or -1. Trend changing (neutral) is NOT presented in this array. (0 may occure only at first 6 bars...) WoodieTrend = IIf(WoodieTrendUp, 1, IIf(WoodieTrendDown, -1, 0)); //Determining the color of Woodie CCI histrogram WoodieTrendColor = IIf(WoodieTrend == 1, colorLime, IIf(WoodieTrend ==-1, colorRed, colorGrey40)); WoodieTrendColor = IIf(WoodieTrendUp AND C14Below0, colorGrey40, WoodieTrendColor); WoodieTrendColor = IIf(WoodieTrendDown AND C14Above0, colorGrey40, WoodieTrendColor); WoodieTrendColor = IIf(BarsSinceC14Above0 == 5 AND WoodieTrendUp, colorYellow, WoodieTrendColor); WoodieTrendColor = IIf(BarsSinceC14Below0 == 5 AND WoodieTrendDown, colorYellow, WoodieTrendColor); //Zero Line with color using Lsma25/Close ZLColor = IIf(C > Lsma25, colorLime, IIf(C < Lsma25, colorRed, colorYellow)); Plot(0, "", ZLColor, styleThick); //Chop Zone Indicator on the 100 lines CziAngleParam = 5; CziColor = IIf(Ema34Angle >=CziAngleParam, colorTurquoise, IIf(Ema34Angle < 5 AND Ema34Angle >= 3.57, colorDarkGreen, IIf(Ema34Angle < 3.57 AND Ema34Angle >=2.14, colorPaleGreen, IIf(Ema34Angle < 2.14 AND Ema34Angle >=.71, colorLime, IIf(Ema34Angle <= -CziAngleParam, colorDarkRed, IIf(Ema34Angle > -5 AND Ema34Angle <=-3.57, colorRed, IIf(Ema34Angle > -3.57 AND Ema34Angle <=-2.14, colorOrange, IIf(Ema34Angle > -2.14 AND Ema34Angle <=-0.71, colorLightOrange, colorYellow)))))))); Czi = IIf(Ema34Angle >= CziAngleParam, 1, IIf(Ema34Angle <=-CziAngleParam, -1, 0)); Plot( 100,"Czi", CziColor , styleLine | styleNoLabel); Plot(-100,"Czi", CziColor , styleLine | styleNoLabel); //Side Winder Indicator on the 200s Swi = IIf(abs(Ema34Angle) >= 15 AND abs(Ema34Angle + Lsma25Angle) >= 50, IIf(Lsma25Angle > 0, 2, -2), IIf(((Ema34Angle >= 0 AND Lsma25Angle >= 0) OR (Ema34Angle <= 0 AND Lsma25Angle <= 0)) AND abs(Ema34Angle + Lsma25Angle) >= 5, IIf(Lsma25Angle > 0, 1, -1), 0)); AbsSwi=abs(Swi); SwiColor = IIf( AbsSwi == 2, colorBrightGreen, IIf( AbsSwi == 1, colorYellow, colorRed )); Plot( C14StrongTrendLevelParam,"Swi", SwiColor, styleLine | styleNoLabel); Plot(-C14StrongTrendLevelParam,"Swi", SwiColor, styleLine | styleNoLabel); //Plotting CCIs Plot(C6,"Turbo CCI", C6Color, styleLine, -350, 350); //Set panel scaling... Plot(C14,"", WoodieTrendColor, styleHistogram | styleNoLabel); // CCI histogram only!!! CCI line is plotted later //Plot(C14,"", Colorblack, styleThick | styleNoLabel); // CCI histogram only!!! CCI line is plotted later if ( C50VisibleParam ) Plot(C50,"Long term CCI", C50Color, styleLine); //function CalcCCI(Period) //{ // TypicalPrice = (H+L+C)/3; // TypicalPriceAvg = MA(TypicalPrice, Period); // MeanDeviationSum=0; // for (i = Period; i < BarCount; i++) // { // for (j = i - Period; j <= i; j++) // { // MeanDeviationSum[i] = MeanDeviationSum[i] + abs(TypicalPriceAvg[i] - TypicalPrice[j]); // } // MeanDeviationAvg[i] = MeanDeviationSum[i]/Period; // } // return IIf (MeanDeviationAvg == 0, 0, (TypicalPrice-TypicalPriceAvg)/(0.014*MeanDeviationAvg)); //} _SECTION_END(); //Woodie's CCI panel _SECTION_BEGIN("Entry pattern recognition"); // ******************************************************************************************** // Entry pattern recognition and signals // ******************************************************************************************** //Which patterns to recognize ZlrParam=ParamToggle("(1) Zlr","No|Yes",True); ZLRPointMove=Param("ZLR minimum CCI point move",15,8,25,1); FamirParam=ParamToggle("(2) Famir","No|Yes",True); VegasParam=ParamToggle("(3) Vegas","No|Yes",False); Gb100Param=ParamToggle("(4) Gb100","No|Yes",False); TtParam=ParamToggle("(5) Tony","No|Yes",False); GhostParam=ParamToggle("(6) Ghost","No|Yes",True); C14GhostChange = Param("Ghost - Min WCCI change %", 8, 0, 50); C14GhostSteepComp=Param("Ghost - Max trend line slope (CCI/bar)", 8, 0, 30, 1); C14GhostSlopeDir=ParamToggle("Ghost - Allow trend line slopes away from ZL","No|Yes", False); //Base WCCI values for pattern recognition AbsC14 = abs(C14); C14AboveP100 = C14 >= 100; C14BelowP100 = C14 < 100; C14AboveM100 = C14 >=-100; C14BelowM100 = C14 < -100; BarsSinceC14AboveP100 = BarsSince(C14AboveP100); BarsSinceC14BelowM100 = BarsSince(C14BelowM100); //BarsSinceC14AboveM100 = BarsSince(Ref(C14AboveM100,-1)); //BarsSinceC14BelowP100 = BarsSince(Ref(C14BelowP100,-1)); C14CrossP100Downward = Ref(C14AboveP100,-1) AND C14BelowP100; //cross CCI P100 line downward C14CrossM100Upward = Ref(C14BelowM100,-1) AND C14AboveM100; //cross CCI M100 line upward BarsSinceC14CrossP100Downward = BarsSince(C14CrossP100Downward); BarsSinceC14CrossM100Upward = BarsSince(C14CrossM100Upward); C14AboveP200 = C14 >= C14StrongTrendLevelParam; C14BelowP200 = C14 < C14StrongTrendLevelParam; C14AboveM200 = C14 >=-C14StrongTrendLevelParam; C14BelowM200 = C14 < -C14StrongTrendLevelParam; BarsSinceC14AboveP200 = BarsSince(C14AboveP200); BarsSinceC14BelowM200 = BarsSince(C14BelowM200); C14CrossP200Downward = Ref(C14AboveP200,-1) AND C14BelowP200; //cross CCI P200 line downward C14CrossM200Upward = Ref(C14BelowM200,-1) AND C14AboveM200; //cross CCI M200 line upward BarsSinceC14CrossP200Downward = BarsSince(C14CrossP200Downward); BarsSinceC14CrossM200Upward = BarsSince(C14CrossM200Upward); C14Raising = C14 > Ref(C14,-1); C14Falling = C14 < Ref(C14,-1); C14Movement = C14 - Ref(C14,-1); C14Flat = abs(HHV(C14,2) - LLV(C14,2)) > 15; C14HookUp = Ref(C14Falling,-1) AND C14Raising; C14HookDown = Ref(C14Raising,-1) AND C14Falling; JumpDropPeriod = 10; C14StrongAdvance = C14AboveP200 OR C14AboveP100 AND HHV(C14, JumpDropPeriod) == C14 AND //bar is the top ( HHV(C14, JumpDropPeriod) - LLV(C14, JumpDropPeriod) ) > 1.5 * C14StrongTrendLevelParam; //there was a big jump C14StrongDecline = C14BelowM200 OR C14BelowM100 AND LLV(C14, JumpDropPeriod) == C14 AND //bar is the bottom ( LLV(C14, JumpDropPeriod) - HHV(C14, JumpDropPeriod) ) < -1.5 * C14StrongTrendLevelParam;//there was a big drop BarsSinceStrongAdvance = BarsSince(Ref(C14StrongAdvance, -1)); BarsSinceStrongDecline = BarsSince(Ref(C14StrongDecline, -1)); C14ReturnFromStrongTrend = (Ref( AbsC14, -1 ) > C14StrongTrendLevelParam AND AbsC14 < C14StrongTrendLevelParam) //Cci reenter midrange from an extrem value OR Ref(BarsSinceStrongAdvance, -1) AND C14Falling AND NOT C14Falling //big jump than fall OR Ref(BarsSinceStrongDecline, -1) AND C14Raising AND NOT C14Raising; //big drop then raise CziUp = IIf(Czi > 0, 1, 0); CziDown = IIf(Czi < 0, -1, 0); //DEBUG: these were just some test how to catch first big moves even if +/-200 is not reached //Plot(250, "C14StrongAdvance", Iif(C14StrongAdvance, colorGreen, colorWhite), styleLine); //Plot(-250, "C14StrongDecline", Iif(C14StrongDecline, colorRed, colorWhite), styleLine); //Plot( 150, "C14ReturnFromStrongTrend", Iif(C14ReturnFromStrongTrend, colorRed, colorWhite), styleLine); //Plot(-150, "C14ReturnFromStrongTrend", Iif(C14ReturnFromStrongTrend, colorRed, colorWhite), styleLine); // ******************************************************************************************** // Entry patterns // ******************************************************************************************** // Choppy - wcci is within the 100's form more then 10 bars // It remains choppy until cci reaches strong trend level C14InChopZoneFor10Period = HHV( MA(AbsC14, 3), 10 ) <= 100; //CCI is in the +/-100 range for 10 bars C14NoChopping = C14InChopZoneFor10Period == 0 AND //not is chop zone ( BarsSince(C14InChopZoneFor10Period) > BarsSince(C14ReturnFromStrongTrend) //cci hit strong level lately OR BarsSince(C14InChopZoneFor10Period) > BarsSinceStrongAdvance //there was a strong advance OR BarsSince(C14InChopZoneFor10Period) > BarsSinceStrongDecline); //there was a strong decline //ZLR //As the Swi is not exactly the same as Woodie's, it is not used in ZLR patterns. //EMA34's angle/CZI is used instead. // ZLR Long (1) ZlrLongTrend = WoodieTrend == 1 AND SWI > 0 AND Czi > 0 AND Sum(Czi, 3) >= 2; //trend ZlrLongSwingLow = LLV(C14, BarsSinceC14CrossP100Downward) == C14; ZlrLongDirectionChange = Ref(C14, -2) < 100 AND Ref(C14, -1) < 100 AND Ref(C14, -1) >-100 AND C14HookUp;// AND BarsSinceC14CrossP100Downward >=2; ZlrLongOk1Bar = ZlrLongTrend AND ZlrLongDirectionChange AND BarsSince(ZlrLongSwingLow) <= 3 AND C14Movement >= ZLRPointMove AND C14Above0; ZlrLongOk2Bar = ZlrLongTrend AND Ref(ZlrLongDirectionChange, -1) AND NOT Ref(ZlrLongOk1Bar,-1) AND BarsSince(ZlrLongSwingLow) <= 3 AND C14-Ref(C14,-2) >= ZLRPointMove AND C14Raising AND C14Above0; ZlrLong = (ZlrLongOk1Bar OR ZlrLongOk2Bar); // AND C14 < 120 AND C14NoChopping; //Debug //Plot(110, "ZlrLongTrend", Iif(ZlrLongTrend, colorGreen, colorRed)); //Plot(120, "ZlrLongSwingLow", Iif(BarsSince(ZlrLongSwingLow) <= 4, colorGreen, colorRed)); //Plot(130, "ZlrLongDirectionChange", Iif(ZlrLongDirectionChange, colorGreen, colorRed)); //Plot(140, "ZlrLongOk1Bar", Iif(ZlrLongOk1Bar, colorGreen, colorRed)); //Plot(150, "ZlrLongOk2Bar", Iif(ZlrLongOk2Bar, colorGreen, colorRed)); // ZLR Short (1) ZlrShortTrend = WoodieTrend == -1 AND Swi < 0 AND Czi < 0 AND Sum(Czi, 3) <= -2; //trend ZlrShortSwingHigh = HHV(C14, BarsSinceC14CrossM100Upward) == C14; ZlrShortDirectionChange = Ref(C14, -2) >-100 AND Ref(C14, -1) >-100 AND Ref(C14, -1) < 100 AND C14HookDown;// AND BarsSinceC14CrossM100Upward >=2; ZlrShortOk1Bar = ZlrShortTrend AND ZlrShortDirectionChange AND BarsSince(ZlrShortSwingHigh) <= 3 AND C14Movement <= -ZLRPointMove AND C14Below0; ZlrShortOk2Bar = ZlrShortTrend AND Ref(ZlrShortDirectionChange,-1) AND NOT Ref(ZlrShortOk1Bar,-1) AND BarsSince(ZlrShortSwingHigh) <= 3 AND C14-Ref(C14,-2) <= -ZLRPointMove AND C14Falling AND C14Below0; ZlrShort = (ZlrShortOk1Bar OR ZlrShortOk2Bar); // AND C14 > -120 AND C14NoChopping; //Debug //Plot(-110, "ZlrShortTrend", Iif(ZlrShortTrend, colorGreen, colorRed)); //Plot(-120, "ZlrShortSwingLow", Iif(BarsSince(ZlrShortSwingHigh) <= 4, colorGreen, colorRed)); //Plot(-130, "ZlrShortDirectionChange", Iif(ZlrShortDirectionChange, colorGreen, colorRed)); //Plot(-140, "ZlrShortOk1Bar", Iif(ZlrShortOk1Bar, colorGreen, colorRed)); //Plot(-150, "ZlrShortOk2Bar", Iif(ZlrShortOk2Bar, colorGreen, colorRed)); // Famir Long (2) FamirLongSwingHigh = HHV(C14, BarsSinceC14CrossM100Upward); FamirLongHookDown = Ref(FamirLongSwingHigh == C14 AND C14 <= 55, -1) AND C14HookDown; FamirLongHookUp = C14HookUp AND LLV(C14, 3) >=-55; FamirLongHooks = BarsSince(FamirLongHookDown) <= 4 AND FamirLongHookUp; FamirLongBars = WoodieTrend == -1 AND C>Lsma25 AND BarsSinceC14CrossM100Upward < 10 AND BarsSince(FamirLongHooks) <= 2 AND C14 > Ref(FamirLongSwingHigh, -1); FamirLong = FamirLongBars AND NOT Ref(FamirLongBars,-1); // Famir Short (2) FamitShortSwingLow = LLV(C14, BarsSinceC14CrossP100Downward); FamirShortHookUp = Ref(FamitShortSwingLow == C14 AND C14 >= -55, -1) AND C14HookUp; FamirShortHookDown = C14HookDown AND HHV(C14, 3) <=55; FamirShortHooks = BarsSince(FamirShortHookUp) <= 4 AND FamirShortHookDown; FamirShortBars = WoodieTrend == 1 AND C= 5 AND BarsSinceC14CrossM200Upward > VtLongSwingHighBars AND VtLongSwingHighBars > VtLongSwingLowBars AND VtLongSwingLowBars >= 1 AND VtLongSwingHigh <= 0 AND VtLongSwingHigh - VtLongSwingLow > 15; VtLongBar = BarsSinceC14CrossM200Upward < 12 AND Sum(C14HookUp, VtLongSwingHighBars ) <= 2 AND Sum(C14HookDown, VtLongSwingHighBars ) <= 2 AND BarsSince(VtLongHook) < 5 AND C14AboveM100 AND C14BelowP100 AND C14 > Ref(VtLongSwingHigh, -1) AND C > Lsma25; VtLong = ExRemSpan(VtLongBar, 5); //Plot(VtLongSwingHigh, "VtLongSwingHigh", colorGreen); //Plot(VtLongSwingLow, "VtLongSwingLow", colorLime); //Plot(-120, "VtLongHook", Iif(VtLongHook, colorGreen, colorRed)); // VT Short (3) VtShortSwingLow = LLV(Ref(C14,-1), BarsSinceC14CrossP200Downward); VtShortSwingLowBars = LLVBars(C14, BarsSinceC14CrossP200Downward); VtShortSwingHigh = HHV(Ref(C14,-1), VtShortSwingLowBars); VtShortSwingHighBars = HHVBars(C14, VtShortSwingLowBars); VtShortHook = BarsSinceC14CrossP200Downward >= 5 AND BarsSinceC14CrossP200Downward > VtShortSwingLowBars AND VtShortSwingLowBars > VtShortSwingHighBars AND VtShortSwingHighBars >= 1 AND VtShortSwingLow >= 0 AND VtShortSwingHigh - VtShortSwingLow > 15; VtShortBar = BarsSinceC14CrossP200Downward < 12 AND Sum(C14HookUp, VtShortSwingLowBars ) <= 2 AND Sum(C14HookDown, VtShortSwingLowBars ) <= 2 AND BarsSince(VtShortHook) < 5 AND C14AboveM100 AND C14BelowP100 AND C14 < Ref(VtShortSwingLow, -1) AND C < Lsma25; VtShort = ExRemSpan(VtShortBar,5); //Plot(VtShortSwingLow, "VtShortSwingLow", colorRed); //Plot(VtShortSwingHigh, "VtShortSwingHigh", colorDarkRed); //Plot(120, "VtShortHook", Iif(VtShortHook, colorGreen, colorRed)); // GB100s (4) Gb100Long = WoodieTrend == 1 AND MA(Czi, BarsSinceC14AboveP200) > 0.8 //trend AND BarsSinceC14CrossP100Downward <= 12 AND C14BelowP100 AND C14CrossM100Upward; Gb100Short = WoodieTrend == -1 AND MA(Czi, BarsSinceC14BelowM200) < -0.8 //trend AND BarsSinceC14CrossM100Upward <= 12 AND C14AboveM100 AND C14CrossP100Downward; // TT Long (5) TtLongBar = C14Raising AND C14Above0 AND C14BelowP100; TtLongHook = LLV( C14, BarsSinceC14AboveP100 ) > -100; TtLong = TtLongBar AND TtLongHook AND Ref(WoodieTrend, -Ref(BarsSinceC14Above0, -1)-1)==1 AND Ref(BarsSinceC14Above0, -1)<=9 AND Ref(BarsSinceC14Above0, -1)>=4; // TT Short (5) TtShortBar = C14Falling AND C14Below0 AND C14AboveM100; TtShortHook = HHV( C14, BarsSinceC14BelowM100) < 100; TtShort = TtShortBar AND TtShortHook AND Ref(WoodieTrend, -Ref(BarsSinceC14Below0, -1)-1)==-1 AND Ref(BarsSinceC14Below0, -1)<=9 AND Ref(BarsSinceC14Below0, -1) >= 4; // Ghosts (6) GhostCciShift=300; GhostCciChange=C14GhostChange / 2; //CCI values are shifted up 300 ponts (-300 - + 300 -> 0 - 600) GhostBarIndex = LastBarIndex; if (LastBarIndex != CurBarIndex) GhostBarIndex = CurBarIndex; // Ghost Long (6) C14Shifted = -C14 + GhostCciShift; C14Shifted = IIf(C14Shifted < 0, 0, C14Shifted); C14Shifted = IIf(C14Shifted > 600, 600, C14Shifted); GhostLongLeft = -Peak(C14Shifted, GhostCciChange, 3) + GhostCciShift; GhostLongHead = -Peak(C14Shifted, GhostCciChange, 2) + GhostCciShift; GhostLongRight = -Peak(Ref(C14Shifted,-1), GhostCciChange, 1) + GhostCciShift; GhostLongRightDip = -Ref(Trough(C14Shifted, GhostCciChange, 1), -1) + GhostCciShift; GhostLongRightDipIndex = Ref(ValueWhen( Trough(C14Shifted, GhostCciChange) == C14Shifted, BarIndex(), 1), -1); GhostLongLeftDip = -Ref(Trough(C14Shifted, GhostCciChange, 2), -1) + GhostCciShift; GhostLongLeftDipIndex = Ref(ValueWhen( Trough(C14Shifted, GhostCciChange) == C14Shifted, BarIndex(), 2), -1); GhostLongHeadWidth = GhostLongRightDipIndex - GhostLongLeftDipIndex; GhostLongRightWidth = BarIndex() - GhostLongRightDipIndex; GhostLongComp = (GhostLongRightDip - GhostLongLeftDip) / GhostLongHeadWidth; GhostLongBar = ( (GhostLongLeft > GhostLongHead AND GhostLongRight > GhostLongHead AND GhostLongHead <= -100 ) //Ghost OR (GhostLongLeft < GhostLongHead AND GhostLongRight < GhostLongHead AND GhostLongLeft <= -100)) //MGhost //AND GhostLongLeft <= 0 AND GhostLongLeftDip <= 0 //AND GhostLongHead <=0 AND GhostLongRightDip <= 0 //AND GhostLongRight <=0 AND (GhostLongRightDip + GhostLongComp*GhostLongRightWidth <= C14 OR C14Above0)//WCCI returned above neckline AND GhostLongHeadWidth < 25 AND GhostLongRightWidth > 1 AND GhostLongRightWidth < 12; GhostLong = GhostLongBar AND NOT Ref(GhostLongBar,-1) AND C14 < 120 AND GhostLongComp >= -C14GhostSteepComp AND GhostLongComp <= C14GhostSteepComp AND (GhostLongComp >= 0 OR C14GhostSlopeDir); GhostLongRef = BarsSince(GhostLong); if ( GhostParam AND GhostLongRef[GhostBarIndex] <= 5 ) { GhostLongIndex = GhostBarIndex - GhostLongRef[GhostBarIndex]; GhostLine = LineArray( GhostLongLeftDipIndex[GhostLongIndex], GhostLongLeftDip[GhostLongIndex], GhostLongRightDipIndex[GhostLongIndex] + 10, GhostLongRightDip[GhostLongIndex] + GhostLongComp[GhostLongIndex] * 10, 0, False); Plot(GhostLine, "", colorWhite, styleThick); } //DEBUG //Plot(-120, "GhostLongBar", IIf(GhostLongBar, colorGreen, colorRed)); //GhostLine = LineArray( GhostLongLeftDipIndex[CurBarIndex], // GhostLongLeftDip[CurBarIndex], // GhostLongRightDipIndex[CurBarIndex] + 10, // GhostLongLeftDip[CurBarIndex] + GhostLongComp[CurBarIndex]*(GhostLongHeadWidth[CurBarIndex]+10), // 0, False); //Plot(GhostLine, "", colorGreen, styleThick); // Ghost Short (6) C14Shifted = C14 + GhostCciShift; C14Shifted = IIf(C14Shifted < 0, 0, C14Shifted); C14Shifted = IIf(C14Shifted > 600, 600, C14Shifted); GhostShortLeft = Peak(C14Shifted, GhostCciChange, 3) - GhostCciShift; GhostShortHead = Peak(C14Shifted, GhostCciChange, 2) - GhostCciShift; GhostShortRight = Peak(C14Shifted, GhostCciChange, 1) - GhostCciShift; GhostShortRightDip = Ref(Trough(C14Shifted, GhostCciChange, 1), -1) - GhostCciShift; GhostShortRightDipIndex = Ref(ValueWhen( Trough(C14Shifted, GhostCciChange) == C14Shifted, BarIndex(), 1), -1); GhostShortLeftDip = Ref(Trough(C14Shifted, GhostCciChange, 2), -1) - GhostCciShift; GhostShortLeftDipIndex = Ref(ValueWhen( Trough(C14Shifted, GhostCciChange) == C14Shifted, BarIndex(), 2), -1); GhostShortHeadWidth = GhostShortRightDipIndex - GhostShortLeftDipIndex; GhostShortRightWidth = BarIndex() - GhostShortRightDipIndex; GhostShortComp = (GhostShortRightDip - GhostShortLeftDip) / GhostShortHeadWidth; GhostShortBar = ( (GhostShortLeft < GhostShortHead AND GhostShortRight < GhostShortHead AND GhostShortHead >= 100) //Ghost OR (GhostShortLeft > GhostShortHead AND GhostShortRight > GhostShortHead AND GhostShortLeft >= 100)) //MGhost //AND GhostShortLeft >=0 AND GhostShortLeftDip >= 0 //AND GhostShortHead >=0 AND GhostShortRightDip >=0 //AND GhostShortRight >=0 AND (GhostShortRightDip + GhostShortComp*GhostShortRightWidth >= C14 OR C14Below0) //WCCI returned below neckline AND GhostShortHeadWidth < 25 AND GhostShortRightWidth > 1 AND GhostShortRightWidth < 12; GhostShort = GhostShortBar AND NOT Ref(GhostShortBar,-1) AND C14 > -120 AND GhostShortComp <= C14GhostSteepComp AND GhostShortComp >= -C14GhostSteepComp AND (GhostShortComp <= 0 OR C14GhostSlopeDir); GhostShortRef = BarsSince(GhostShort); if ( GhostParam AND GhostShortRef[GhostBarIndex] <= 5 ) { GhostShortIndex = GhostBarIndex - GhostShortRef[GhostBarIndex]; GhostLine = LineArray( GhostShortLeftDipIndex[GhostShortIndex], GhostShortLeftDip[GhostShortIndex], GhostShortRightDipIndex[GhostShortIndex] + 10, GhostShortRightDip[GhostShortIndex] + GhostShortComp[GhostShortIndex] * 10, 0, False); Plot(GhostLine, "", colorWhite, styleThick); } //DEBUG //Plot(120, "GhostShortBar", IIf(GhostShortBar, colorGreen, colorRed)); //GhostLine = LineArray( GhostShortLeftDipIndex[CurBarIndex], // GhostShortLeftDip[CurBarIndex], // GhostShortRightDipIndex[CurBarIndex] + 10, // GhostShortLeftDip[CurBarIndex] + GhostShortComp[CurBarIndex]*(GhostShortHeadWidth[CurBarIndex]+10), // 0, False); //Plot(GhostLine, "", colorRed, styleThick); // ******************************************************************************************** // Cummulate entry patterns // ******************************************************************************************** BuySignals = ((ZlrLong AND ZlrParam) OR (FamirLong AND FamirParam) OR ((VtLong AND NOT FamirLong) AND VegasParam) OR (Gb100Long AND Gb100Param) OR (TtLong AND TtParam) OR (GhostLong AND GhostParam)); ShortSignals = ((ZlrShort AND ZlrParam) OR (FamirShort AND FamirParam) OR ((VtShort AND NOT FamirShort) AND VegasParam) OR (Gb100Short AND Gb100Param) OR (TtShort AND TtParam) OR (GhostShort AND GhostParam)); BuyPattern = BuySignals; ShortPattern = ShortSignals; BuyPatternBars = BarsSince(BuyPattern); ShortPatternBars = BarsSince(ShortPattern); // ******************************************************************************************** // Plotting entry pattern codes // ******************************************************************************************** if ( ZlrParam ) { PlotShapes(IIf(ZlrLong, shapeDigit1, shapeNone), colorGreen, 0, Min(LLV(C14, 3), - 10),-5); PlotShapes(IIf(ZlrShort, shapeDigit1 + shapePositionAbove, shapeNone), colorDarkRed, Max(HHV(C14, 3), 10),-5); } if ( FamirParam ) { PlotShapes(IIf(FamirLong, shapeDigit2, shapeNone), colorGreen, 0, Min(LLV(C14, 3), - 10),-5); PlotShapes(IIf(FamirShort, shapeDigit2 + shapePositionAbove, shapeNone), colorDarkRed,0, Max(HHV(C14, 3), 10),-5); } if ( VegasParam ) { PlotShapes(IIf(VtLong AND NOT FamirLong, shapeDigit3, shapeNone), colorGreen,0,Ref(C14,-1),-5); PlotShapes(IIf(VtShort AND NOT FamirShort, shapeDigit3 + shapePositionAbove, shapeNone), colorDarkRed,0,Ref(C14,-1),-5); } if ( Gb100Param ) { PlotShapes(IIf(Gb100Long, shapeDigit4, shapeNone), colorGreen,0,Ref(C14,-1),-15); PlotShapes(IIf(Gb100Short AND Gb100Param, shapeDigit4 + shapePositionAbove, shapeNone), colorDarkRed,0,Ref(C14,-1),-15); } if ( TtParam ) { PlotShapes(IIf(TtLong, shapeDigit5, shapeNone), colorGreen,0,Ref(C14,-1),-5); PlotShapes(IIf(TtShort, shapeDigit5 + shapePositionAbove, shapeNone), colorDarkRed,0,Ref(C14,-1),-5); } if ( GhostParam ) { PlotShapes(IIf(GhostLong, shapeDigit6, shapeNone), colorGreen,0,Ref(C14,-1),-15); PlotShapes(IIf(GhostShort, shapeDigit6 + shapePositionAbove, shapeNone), colorDarkRed,0,Ref(C14,-1),-15); } _SECTION_END(); //Entry pattern recognition _SECTION_BEGIN("Exit pattern recognition"); // ******************************************************************************************** // Exit patterns // ******************************************************************************************** // WCCI hook exit ExitHookParam = ParamToggle("CCI hook", "No |Yes", False); HookLongExit = C14Falling AND NOT C14Flat; HookShortExit = C14Raising AND NOT C14Flat; // WCCI 100 line cross exit ExitCross100Param = ParamToggle("CCI 100 exit", "No |Yes", True); Cross100LongExit = C14CrossP100Downward; Cross100ShortExit = C14CrossM100Upward; // TCCI hooks into WCCI exit ExitTCCIHookParam = ParamToggle("TCCI hooks into WCCI", "No |Yes", False); TCCIHookLongExit = Ref(C6, -2) > Ref(C14, -2) AND Ref(C6, -1) > Ref(C14, -1) AND C6 < C14; //TCCI was above WCCI for 2 bars than falls below TCCIHookShortExit = Ref(C6, -2) < Ref(C14, -1) AND Ref(C6, -2) < Ref(C14, -1) AND C6 > C14; //TCCI was below WCCI for 2 bars than raises above // Mplay Exit ExitMplayParam = ParamToggle("Mplay exit", "No |Yes", False); MplayLongExit = C14Falling AND Ref(C14Falling, -1) AND C14 <= O; MplayShortExit = C14Raising AND Ref(C14Raising,-1) AND C14 >= O; // Heikin-Ashi bars and exit ExitHeikinParam = ParamToggle("Heikin-Ashi exit", "No |Yes", False); HaClose = EMA((O+H+L+C)/4,3); HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); HaHigh = Max( H, Max( HaClose, HaOpen ) ); HaLow = Min( L, Min( HaClose, HaOpen ) ); HaLongExit = HaLow < HaOpen; HaShortExit = HaHigh > HaOpen; // ******************************************************************************************** // Cummulate exit patterns // ******************************************************************************************** SellSignals = (ExitHookParam AND HookLongExit) OR (ExitTCCIHookParam AND TCCIHookLongExit) OR (ExitMplayParam AND MplayLongExit) OR (ExitHeikinParam AND HaLongExit) OR (ExitCross100Param AND Cross100LongExit); CoverSignals= (ExitHookParam AND HookShortExit) OR (ExitTCCIHookParam AND TCCIHookShortExit) OR (ExitMplayParam AND MplayShortExit) OR (ExitHeikinParam AND HaShortExit) OR (ExitCross100Param AND Cross100ShortExit); //Filter Sell/Cover signals SellPattern = ExRem(SellSignals,BuyPattern); CoverPattern= ExRem(CoverSignals,ShortPattern); SellPatternBars = BarsSince(SellPattern); CoverPatternBars = BarsSince(CoverPattern); // ******************************************************************************************** // Plotting filtered exit signals (arrows) // ******************************************************************************************** ExitDisplayParam = ParamToggle("Show sell/cover arrows for exits", "No|Yes", True); PlotShapes(IIf(SellPattern AND ExitDisplayParam, shapeDownArrow, shapeNone), colorRed,0, 250, 0); PlotShapes(IIf(CoverPattern AND ExitDisplayParam, shapeHollowUpArrow, shapeNone), colorGreen,0,-250, 0); _SECTION_END(); //Exit pattern recognition _SECTION_BEGIN("Title and WCCI highlights"); // ******************************************************************************************** // Other signals // ******************************************************************************************** HfeParam=ParamToggle("(Circles) Hfe","No|Yes", True); if ( HfeParam ) { PlotShapes(IIf(C14CrossM200Upward, shapeCircle, shapeNone),colorYellow,0, -220, 0); PlotShapes(IIf(C14CrossP200Downward, shapeCircle + shapePositionAbove, shapeNone), colorYellow,0, 220, 0); } // ******************************************************************************************** // Calculate pattern highlights and plotting the colored WCCI line // ******************************************************************************************** HighLightChoppyParam=ParamToggle("Highlight WCCI line when choppy","No|Yes",False); HighLightPositionParam=ParamToggle("Highlight WCCI line while in position","No|Yes",False); // Long position InLongPosition = IIf(BuyPatternBars <= SellPatternBars, BuyPatternBars, 0); //Short position InShortPosition = IIf(ShortPatternBars <= CoverPatternBars, ShortPatternBars, 0); // Plot colored Woodie CCI line C14LineColor = IIf(((InLongPosition OR InShortPosition) OR BuyPattern OR ShortPattern) AND HighLightPositionParam, colorWhite, IIf(NOT C14NoChopping AND HighLightChoppyParam, colorLightOrange,C14Color)); Plot(C14, "Woddie CCI", C14LineColor, styleThick); // ******************************************************************************************** // Calculating Woodie pivots and daily range values // // Notice: Calculating Woodie pivots might cause performance issues if database base time interval is small // Notice: Calculating Woodie pivots can fail or result misleading values depending on database time frame // ******************************************************************************************** YesterdayHigh = TimeFrameGetPrice("H", inDaily, -1); YesterdayLow = TimeFrameGetPrice("L", inDaily, -1); YesterdayClose = TimeFrameGetPrice("C", inDaily, -1); TodayOpen = TimeFrameGetPrice("O", inDaily); TodayHigh = TimeFrameGetPrice("H", inDaily); TodayLow = TimeFrameGetPrice("L", inDaily); //Pivot value calculation PP = (YesterdayHigh + YesterdayLow + TodayOpen + TodayOpen) / 4 ; R1 = (2 * PP) - YesterdayLow; S1 = (2 * PP) - YesterdayHigh; R2 = PP + R1 - S1; S2 = PP + S1 - R1; R3 = R2 + (R1 - PP); S3 = S2 - (PP - S1); // Calculation the distance between the current price and the closet pivots //Pivot level below current price ppDistB=C-pp; r1DistB=C-r1; s1DistB=C-s1; r2DistB=C-r2; s2DistB=C-s2; r3DistB=C-r3; s3DistB=C-s3; ppDistB=IIf(ppDistB>=0, ppDistB, 1000000); r1DistB=IIf(r1DistB>=0, r1DistB, 1000000); s1DistB=IIf(s1DistB>=0, s1DistB, 1000000); r2DistB=IIf(r2DistB>=0, r2DistB, 1000000); s2DistB=IIf(s2DistB>=0, s2DistB, 1000000); r3DistB=IIf(r3DistB>=0, r3DistB, 1000000); s3DistB=IIf(s3DistB>=0, s3DistB, 1000000); DistanceToPivotBelow = Min(ppDistB, Min(r1DistB, Min(s1DistB, Min(r2DistB, Min(s2DistB, Min(r3DistB, s3DistB)))))); //Pivot level above current price ppDistA=pp-C; r1DistA=r1-C; s1DistA=s1-C; r2DistA=r2-C; s2DistA=s2-C; r3DistA=r3-C; s3DistA=s3-C; ppDistA=IIf(ppDistA>=0, ppDistA, 1000000); r1DistA=IIf(r1DistA>=0, r1DistA, 1000000); s1DistA=IIf(s1DistA>=0, s1DistA, 1000000); r2DistA=IIf(r2DistA>=0, r2DistA, 1000000); s2DistA=IIf(s2DistA>=0, s2DistA, 1000000); r3DistA=IIf(r3DistA>=0, r3DistA, 1000000); s3DistA=IIf(s3DistA>=0, s3DistA, 1000000); DistanceToPivotAbove = Min(ppDistA, Min(r1DistA, Min(s1DistA, Min(r2DistA, Min(s2DistA, Min(r3DistA, s3DistA)))))); // ******************************************************************************************** // Building title parts to display data on the chart panel, in tooltip // and in the interpretation/commentary window // ******************************************************************************************** EnableTextOutput(False); //Timer parts ChartInterval = Interval(0); ChartMode=0; if (ChartInterval > 0) //Time chart { //Calculating (seconds) time remaining from the last bar BarSize = ChartInterval; TempTimeNum = Now(4) - LastValue(TimeNum()); BarRemaining = IIf( BarIndex() < BarCount-1, 0, BarSize - ((int(TempTimeNum[BarCount - 1] / 100) * 60) + (TempTimeNum[BarCount - 1] - int(TempTimeNum[BarCount - 1] / 100) * 100))); BarRemainingTitle = NumToStr(LastValue(BarRemaining), 3.0) + " sec"; } else if (ChartInterval > -1000000 AND ChartInterval < 0) //Tick chart { ChartMode=1; BarSize = -1 * ChartInterval; BarRemaining = BarSize; //BUGBUG: no way to get ticks in a bar BarRemainingTitle = ""; //NumToStr(BarRemaining, 3.0) + "ticks"; } else if (ChartInterval > -2000000 AND ChartInterval < -1000000) //Range chart { ChartMode=2; BarSize = -0.01 * ( ChartInterval + 1000000 ); //Point value BarRemaining = (BarSize - H + L); //Point value BarRemaining = IIf(BarRemaining < 0, 0, BarRemaining); //AmiBroker has "funny" range chart... BarRemainingTitle = NumToStr(LastValue(BarRemaining), SecurityPriceFormat) + "p / " + NumToStr(LastValue(BarRemaining) * PriceToTickMult, 1.0)+ "t / " + NumToStr(LastValue(BarRemaining/BarSize*100), 3.0) + "%" ; } else if (ChartInterval < -2000000) //V-Tick chart { ChartMode=3; BarSize = -0.01 * ( ChartInterval + 2000000 ); BarRemaining = (BarSize - Volume); BarRemainingTitle = NumToStr(LastValue(BarRemaining), 4.0); } MarginLongTicks = (C-O)*PriceToTickMult; MarginShortTicks = (O-C)*PriceToTickMult; MarginLongVal = round(-1*(Close - Low + StopSizeInPrice)) * PriceToTickMult; MarginShortVal = round(Close - High - StopSizeInPrice) * PriceToTickMult; function BuildPatternTitle(PIndex) { PatternTitle = ""; if ( ZlrParam ) { PatternTitle = PatternTitle + WriteIf(ZlrLong[PIndex] OR ZlrShort[PIndex], "ZLR,", ""); } if ( FamirParam ) { PatternTitle = PatternTitle + WriteIf(FamirLong[PIndex] OR FamirShort[PIndex], "FAMIR,", ""); } if ( VegasParam ) { PatternTitle = PatternTitle + WriteIf(VtLong[PIndex] OR VtShort[PIndex], "VEGAS,", ""); } if ( Gb100Param ) { PatternTitle = PatternTitle + WriteIf(Gb100Long[PIndex] OR Gb100Short[PIndex], "GB,", ""); } if ( TtParam ) { PatternTitle = PatternTitle + WriteIf(TtLong[PIndex] OR TtShort[PIndex], "TONY,", ""); } if ( GhostParam ) { PatternTitle = PatternTitle + WriteIf(GhostLong[PIndex] OR GhostShort[PIndex], "GHOST,", ""); } PatternTitle = StrLeft(PatternTitle, StrLen(PatternTitle)-1); //Remove comma at the end PatternTitle = WriteIf( PatternTitle == "", "NO PATTERN\n", PatternTitle + WriteIf(BuySignals[PIndex], " LONG", WriteIf(ShortSignals[PIndex], " SHORT", "")) + "\n"); return PatternTitle; } function MarginLongTitle(PIndex) { return WriteVal(MarginLongTicks[PIndex], 3.0) + " (Stop: " + WriteVal(MarginLongVal[PIndex], 3.0) +")\n"; } function MarginShortTitle(PIndex) { return WriteVal(MarginShortTicks[PIndex], 3.0) + " (Stop: " + WriteVal(MarginShortVal[PIndex], 3.0) +")\n"; } function ChoppyTitleStr(PChoppy) { return WriteIf(PChoppy, "CHOPPY", ""); } function SwiTitleStr(PSwi) { return WriteIf( PSwi == 2, "TRENDING", WriteIf( PSwi == 1, "NORMAL", "FLAT" )); } function CziTitleStr(PCzi) { return WriteIf( PCzi == 1, "UPTREND", WriteIf( PCzi == -1, "DOWNTREND", "FLAT" )); } function PivotWarningTitle(PIndex) { return "Pivot above:" + NumToStr(DistanceToPivotAbove[PIndex] * PriceToTickMult, 1.0) + "\n" + "Pivot below:" + NumToStr(DistanceToPivotBelow[PIndex] * PriceToTickMult, 1.0) + "\n"; } function C14MovementTitle(PIndex) { return WriteIf(C14Movement[PIndex]<15, EncodeColor(colorDarkRed), WriteIf(C14Movement[PIndex]>=15 AND C14Movement[PIndex]<20, EncodeColor(colorYellow), EncodeColor(colorBrightGreen))) + "WCCI Points: " + NumToStr(C14Movement[PIndex], 5.0) + " (" + NumToStr(C14Movement[PIndex -1], 1.0) + ")\n"; } function TodayHighTitle() { return "HOD " + NumToStr(TodayHigh, SecurityPriceFormat) + NumToStr((TodayHigh-C) * PriceToTickMult, 8.0) + "\n"; } function RangeTitle() { return "Range " + NumToStr(TodayHigh - TodayLow, SecurityPriceFormat) + NumToStr((TodayHigh - TodayLow) * PriceToTickMult, 8.0) + "\n"; } function TodayLowTitle() { return "LOD " + NumToStr(TodayLow, SecurityPriceFormat) + NumToStr((TodayLow-C) * PriceToTickMult, 8.0) + "\n"; } function DayStatTitle() { return EncodeColor(colorGreen) + TodayHighTitle() + EncodeColor(colorWhite) + " " + RangeTitle() + EncodeColor(colorRed) + TodayLowTitle(); } function BarTitle(PIndex) { return WriteIf(H[PIndex]>H[PIndex-1], EncodeColor(colorBrightGreen), EncodeColor(colorBlack)) + H[PIndex-1] + " " + H[PIndex] + "\n" + EncodeColor(colorBlack) + " " + Close[PIndex] + "\n" + WriteIf(L[PIndex]H[LastBarIndex-1]) PlotText(NumToStr(H[LastBarIndex-1], SecurityPriceFormat) + " " + NumToStr(H[LastBarIndex], SecurityPriceFormat), BarCount + 1, 100, colorGreen) ; else PlotText(NumToStr(H[LastBarIndex-1], SecurityPriceFormat) + " " + NumToStr(H[LastBarIndex], SecurityPriceFormat), BarCount + 1, 100, colorBlack); PlotText(NumToStr(Close[LastBarIndex], SecurityPriceFormat), BarCount + 1, 0, colorBlack ); if (L[LastBarIndex]= 2/3) PlotText(BarRemainingTitle + "\n" + LastPatternTitle, BarCount + 1, 250, colorRed); else if (LastValue(BarRemaining/BarSize) >= 1/3) PlotText(BarRemainingTitle + "\n" + LastPatternTitle, BarCount + 1, 250, colorYellow); else PlotText(BarRemainingTitle + "\n" + LastPatternTitle, BarCount + 1, 250, colorGreen); //if range bars then show market entry levels at next bar open if (ChartMode==2) { PlotText("L:" + NumToStr(L[LastBarIndex] + BarSize, SecurityPriceFormat), BarCount + 1, 150, colorBlack); PlotText("S:" + NumToStr(H[LastBarIndex] - BarSize, SecurityPriceFormat), BarCount + 1, -150, colorBlack); } EnableTextOutput(True); if( Status("action") == actionCommentary ) { printf( "Ticker:" + Name() + "\n" + "Bar interval:" + Interval(2) + "\n" + "Date:" + Date() + "\n" + "Remaining bar:" + BarRemainingTitle + "\n" + "Czi:" + NumToStr(Czi, 1.0) + "\n" + "Swi:" + NumToStr(Swi, 1.0) + "\n" + "MarginLong:" + WriteVal(MarginLongTicks, 2.0) + " (Stop: " + WriteVal(MarginLongVal, 2.0) +")\n" + "MarginLong:" + WriteVal(MarginShortTicks, 2.0) + " (Stop: " + WriteVal(MarginShortVal, 2.0) +")\n" + "Highs:" + Ref(H,-1) + " " + H + "\n" + "Close:" + Close + "\n" + "Lows:" + Ref(L,-1) + " " + L + "\n" + "Entry:" + CurPatternTitle + "Chop zone:" + ChoppyTitleStr(C14NoChopping == 0) + "\n" + "Pivot above:" + NumToStr(DistanceToPivotAbove * PriceToTickMult, 1.0) + "\n" + "Pivot below:" + NumToStr(DistanceToPivotBelow * PriceToTickMult, 1.0) + "\n" + TodayHighTitle() + TodayLowTitle() + RangeTitle() + "WCCI Points: " + NumToStr(C14Movement,5.0) + " (" + NumToStr(Ref(C14Movement, -1), 1.0) + ")\n" + "\n" + Revision + "\n"); } EnableTextOutput(False); ToolTip = "WCCI value=" + NumToStr(C14, 4.0) + " /" + NumToStr(C14Movement, 2.0) + "\n" + "TCCI value=" + NumToStr(C6, 4.0) + " /" + NumToStr(C6- Ref(C6,-1), 2.0) + "\n" + "LCCI value=" + NumToStr(C50, 4.0) + " /" + NumToStr(C50-Ref(C50,-1), 2.0) + "\n" + "Pattern=" + CurPatternTitle + "\n" + //"WCCI range=" + NumToStr(C14Low, 1.1) + " - " + NumToStr(C14High, 1.1) + "\n" + ToolTipDebug; // ******************************************************************************************** // Buy/Sell values // ******************************************************************************************** //Filter Buy/Sell, Short/Cover signals Sell = ExRem(SellSignals, BuyPattern); Cover= ExRem(CoverSignals, ShortPattern); Buy = ExRem(BuyPattern, SellSignals); Short= ExRem(ShortPattern, CoverSignals); _SECTION_END(); //Display Woodie title // ******************************************************************************************** // Pattern alerting // ******************************************************************************************** _SECTION_BEGIN("Pattern alert"); PatternAlertParam = ParamToggle("Pattern alert sound", "Off|On", True); if (PatternAlertParam) { //Alert commands, change them to your wish PatternAlertEntryCmd = "SOUND C:\\WINDOWS\\Media\\Windows XP Notify.wav"; PatternAlertExitCmd = "SOUND C:\\WINDOWS\\Media\\Windows XP Notify.wav"; PatternAlertSound = 2; PatternAlertSoundMsg = "ALARM"; } else { //Alert commands, change them to your wish PatternAlertEntryCmd = ""; PatternAlertExitCmd = ""; PatternAlertSound = 0; PatternAlertSoundMsg = "QUIET"; } function BuildPatternAlertMsg(Message) { return Now(2) + " Close: " + WriteVal( LastValue(Close), SecurityPriceFormat ) + ": " + Message; } function PatternAlertEntry(Message) { //it send alert only once for each pattern appearance if (StaticVarGet("EntryPatternAlerted" + Name()) != LastValue(TimeNum())) { AlertIf(True, PatternAlertEntryCmd, "Entry: " + BuildPatternAlertMsg(Message), 0, 1 + PatternAlertSound); StaticVarSet("EntryPatternAlerted" + Name(), LastValue(TimeNum()) ); //store bar time to alert on new pattern on the next bar } } function PatternAlertExit(Message) { //it send alert only once for each pattern appearance if (StaticVarGet("ExitPatternAlerted" + Name()) != LastValue(TimeNum())) { AlertIf(True, PatternAlertExitCmd, "Exit: " + BuildPatternAlertMsg(Message), 0, 1 + PatternAlertSound); StaticVarSet("ExitPatternAlerted" + Name(), LastValue(TimeNum()) ); //store bar time to alert on new pattern on the next bar } } //if there is an entry signal if (LastValue(BuySignals OR ShortSignals)) { PatternAlertEntry(LastPatternTitle + " pattern"); } //if entry signal disappears than we delete alerted flag else { StaticVarSet("EntryPatternAlerted" + Name(), 0); } //if there is an exit signal if (LastValue(SellSignals OR CoverSignals)) { PatternAlertExit("Look for possible exits"); } //if exit signal disappears than we delete alerted flag else { StaticVarSet("ExitPatternAlerted" + Name(), 0); } PlotText(PatternAlertSoundMsg, BarCount + 1, -200, colorRed, colorWhite); //Store price at the signal if (LastValue(BuySignals) OR LastValue(ShortSignals)) { if (Nz(StaticVarGet(Name() + "TradeTimeAtSignal")) != LastValue(TimeNum())) //is it a new bar { StaticVarSet(Name() + "TradePriceAtSignal", LastValue(Close)); StaticVarSet(Name() + "TradeTimeAtSignal", LastValue(TimeNum())); } } if (Nz(StaticVarGet(Name() + "TradePriceAtSignal")) != 0) PlotText(WriteVal(StaticVarGet(Name() + "TradePriceAtSignal"), SecurityPriceFormat), BarCount + 1, -250, colorRed, colorWhite); _SECTION_END(); //Pattern alert