// Downloaded From https://www.WiseStockTrader.com FormulaName = "Alert Price"; SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle ); #pragma nocache #include_once <\PEInc\PatternExplorer_f0.afl> #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl" #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl" AddCustomCodeBeforePE(); /*******************************************************************************************/ AddAlertParam( def_AudioAlert = 1, def_EmailAlert, def_BarComplete ); _SECTION_BEGIN( "Main Parameters" ); Switch2 = ParamToggle( "Points/Percent", "Points,Percent", 1 ); Centering = ParamToggle( "Range Centering", "Off,On", 1 ); Offset = Param( "Maximum Deviation", 0.5, 0.0, 5, 0.01 ); SuRangeColor = ParamColor( "Support Range", colorGreen ); ReRangeColor = ParamColor( "Resistance Range", colorRed ); _SECTION_END(); /*******************************************************************************************/ #include_once <\PEInc\Lib\PatternExplorer_f02.afl> #include_once <\PEInc\PatternExplorer_1.afl> AddAlert( Buy_1, Audio, Email, "Close in Support Range", 1, BarComplete, def_BuySound1 ); AddAlert( Buy_2, Audio, Email, "Resistance broken", 1, BarComplete, def_BuySound2 ); AddAlert( Sell_1, Audio, Email, "Support broken", 2, BarComplete, def_SellSound1 ); AddAlert( Sell_2, Audio, Email, "Close in Resistance Range", 2, BarComplete, def_SellSound2 ); /*******************************************************************************************/ Buy = def_Buy AND ( Buy_1 OR Buy_2 ); Sell = def_Sell AND ( Sell_1 OR sell_2 ); /*******************************************************************************************/ Plot( IIf( Lx, SuAL_L, Null ), "", SuRangeColor, styleNoRescale, 0, 0, Shift ); Plot( IIf( Lx, SuAL_H, Null ), "", SuRangeColor, styleNoRescale, 0, 0, Shift ); Plot( IIf( Lx, ReAL_L, Null ), "", ReRangeColor, styleNoRescale, 0, 0, Shift ); Plot( IIf( Lx, ReAL_H, Null ), "", ReRangeColor, styleNoRescale, 0, 0, Shift ); /*******************************************************************************************/ ToolTip = def_ToolTip; AddCustomCodeAfterPE(); Title = "PatternExplorer.com - Alert 1" + default_priceTitle + EncodeColor( SuRangeColor ) + ", Support: " + WriteVal( LastValue( Study( "SU", GetChartID() ) ), digits2 ) + " (" + WriteVal( SuAL_L , digits2 ) + "-" + WriteVal( SuAL_H, digits2 ) + "), " + EncodeColor( ReRangeColor ) + "Resistance: " + WriteVal( LastValue( Study( "RE", GetChartID() ) ), digits2 ) + " (" + WriteVal( ReAL_L, digits2 ) + "-" + WriteVal( ReAL_H, digits2 ) + "), " + EncodeColor( def_Text2 ) + "" + "Max. Deviation: " + WriteVal( Offset, 1.2 ) + WriteIf( switch2, " %, ", " points, " ) + EncodeColor( def_Text1 ) + "Activated Alerts:" + WriteIf( Audio AND NOT Email, " Audio ", WriteIf( Email AND NOT Audio, " Email ", WriteIf( Email AND Audio, " Audio & Email ", " None " ) ) ) + WriteIf( Nd > 0, "\n", "" ) + EncodeColor( colorRed ) + WriteIf( Nd == 1, "SU not defined ", WriteIf( Nd == 2, "RE not defined", WriteIf( Nd == 3, "SU & RE not defined - No Alerts ", "" ) ) ); _SECTION_BEGIN("PE - Alert 3"); //|----------------------------------------------------------------------------------------- //|PatternExplorer.com - Alert 3 - Custom Condition //|Copyright © 2007, PatternExplorer.com //|http://www.PatternExplorer.com //|e-mail: support@PatternExplorer.com //|----------------------------------------------------------------------------------------- FormulaName = "PE - Alert 3 - Custom"; SetChartOptions( 0, chartShowDates | chartLogarithmic | chartWrapTitle ); #pragma nocache #include_once <\PEInc\PatternExplorer_f0.afl> #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl" #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl" AddAlertParam( def_AudioAlert = 1, def_EmailAlert, def_BarComplete ); #include_once <\PEInc\PatternExplorer_1.afl> /*******************************************************************************************/ AddCustomCodeBeforePE(); /*******************************************************************************************/ //The following part is used to define your personal signals. //Please save a copy of this file under another name to assure that your modifications //will NOT be overwritten when installing PatternExplorer updates. //Write = 0; to deativate alerts. Example: Short = 0; Buy = def_Buy AND Ref( PeTaio(), -1 ) == LLV( PeTaio(), 3 )AND Ref( PeTaio(), -1 ) < -80;//Your buy condition Buytext = "Sample buy signal"; Sell = def_Sell AND Ref( PeTaio(), -1 ) == HHV( PeTaio(), 3 )AND Ref( PeTaio(), -1 ) > 80;//Your sell condition Selltext = "Sample sell signal"; Short = def_Short AND Cross( 80, StochD() ); //Your short condition Shorttext = "Sample short signal"; Cover = def_Cover AND Cross( StochD(), 20 ); //Your cover condition Covertext = "Sample cover signal"; /*******************************************************************************************/ /* You can use the following code block to use buy signals only if last long trade was closed and short signals only if last short trade was closed. Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy); Cover = ExRem(Cover,Short); Short = ExRem(Short,Cover); */ /* The code below shows some basic implementation of stops AND profits with optimization. Digits = 0.001; TakeProfit=Optimize("profit",0.001*Digits,0.0006*Digits,0.002*Digits,0.0001*Digits); LossStop=Optimize("stop",0.0009*Digits,0.0006*Digits,0.002*Digits,0.0001*Digits); ApplyStop(type = 0, mode = 2, amount = LossStop, exitatstop = 1, volatile = False, ReEntryDelay = 0 ); ApplyStop(type = 1, mode = 2, amount = Takeprofit, exitatstop = 1, volatile = False, ReEntryDelay = 0 ); */ //Equity(1); //This line will also plot your exits at applystop/takeprofit /*******************************************************************************************/ AddAlert( Buy, Audio, Email, Buytext, 1, BarComplete, def_BuySound1 ); AddAlert( Sell, Audio, Email, Selltext, 2, BarComplete, def_SellSound1 ); AddAlert( Short, Audio, Email, Shorttext, 3, BarComplete, def_ShortSound1 ); AddAlert( Cover, Audio, Email, Covertext, 4, BarComplete, def_CoverSound1 ); /*******************************************************************************************/ Filter = def_Filter AND NOT GroupID() == 253; Filter = Filter AND ( Buy OR Sell OR Short OR Cover ); /*******************************************************************************************/ Addefaultcolumns(); Adddefaultcolumns( 3, 1 ); AddTextColumn( FullName(), "Full name" ); /*******************************************************************************************/ PlotShapes( def_BuyShape*Buy, def_BuyShapeColor, layer = 0, yposition = Low, offset = -def_BuyShapeOffset ); PlotShapes( def_SellShape*Sell, def_SellShapeColor, layer = 0, yposition = High, offset = -def_SellShapeOffset ); PlotShapes( def_ShortShape*Short, def_ShortShapeColor, layer = 0, yposition = High, offset = -def_ShortShapeOffset ); PlotShapes( def_CoverShape*Cover, def_CoverShapeColor, layer = 0, yposition = Low, offset = -def_CoverShapeOffset ); /*******************************************************************************************/ ToolTip = def_ToolTip; /*******************************************************************************************/ AddCustomCodeAfterPE(); /*******************************************************************************************/ Title = "PatternExplorer.com - Alert 3" + default_priceTitle + EncodeColor( def_Text1 ) + ", Activated Alerts:" + WriteIf( Audio AND NOT Email, " Audio ", WriteIf( Email AND NOT Audio, " Email ", WriteIf( Email AND Audio, " Audio & Email ", " None " ) ) ); _SECTION_END(); //|----------------------------------------------------------------------------------------- //|PatternExplorer.com - Fractals //|Copyright © 2007, PatternExplorer.com //|http://www.PatternExplorer.com //|e-mail: support@PatternExplorer.com //|----------------------------------------------------------------------------------------- FormulaName = "PE - Fractals"; SetChartOptions( 0, chartShowDates | chartWrapTitle ); #pragma nocache #include_once <\PEInc\PatternExplorer_f0.afl> #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl" #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl" /*******************************************************************************************/ AddCustomCodeBeforePE(); /*******************************************************************************************/ AddAlertParam( def_AudioAlert, def_EmailAlert, def_BarComplete ); /*******************************************************************************************/ _SECTION_BEGIN( "Alerts" ); SRbS = ParamToggle( "S/R broken", "Off,On", 1 ); SRcS = ParamToggle( "S/R confirmed", "Off,On", 1 ); PjabS = ParamToggle( "Price just above/below", "Off,On", 1 ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Main parameters" ); SRplot = ParamToggle( "Plot S/R", "Off,On", 1 ); Sswitch = ParamToggle( "PLot Swing Chart", "Off,On", 0 ); Shswitch = ParamToggle( "Plot Swing Shapes", "Off,On", 0 ); SwingSize = Param( "Swing Size %", 5, 0.1, 40, 0.1 ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Sensitivity" ); AddparamUsefromChart2( def_UseFromChart ); PatternPriceBasis = ParamToggle( "Pattern Price Basis", "Close|High & Low", def_PatternPriceBasisFractals ); Bars = Param( "Bars", 5, 2, 20, 1 ); MinVertSize = Param( "Minimum Vertical Size (*ATR)", 0, 0, 3.01, 0.05 ); if ( InChart ) StaticVarSet( "Ddf343", PatternPriceBasis ); if ( inAA AND Usefromchart ) PatternPriceBasis = StaticVarGet( "Ddf343" ); if ( InChart ) StaticVarSet( "P54972", Bars ); if ( inAA AND Usefromchart ) Bars = StaticVarGet( "P54972" ); if ( InChart ) StaticVarSet( "Adf343", MinVertSize ); if ( inAA AND Usefromchart ) MinVertSize = StaticVarGet( "Adf343" ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Styles" ); Swingstyle = ParamStyle( "Swing Line", styleLine | styleThick, maskDefault ); TopShape = Param( "Top Fractal Typ", 21, 0, 50, 1 ); ValleyShape = Param( "Valley Fractal Typ", 22, 0, 50, 1 ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Colors" ); SLC = ParamColor( "Swing Low", colorPaleGreen ); SHC = ParamColor( "Swing High", colorLightOrange ); Swingcolor = ParamColor( "Swing Line", def_Color6 ); Topshapecolor = ParamColor( "Top Fractal", def_SellShapeColor ); Valleyshapecolor = ParamColor( "Bottom Fractal", def_BuyShapeColor ); _SECTION_END(); /*******************************************************************************************/ #include_once <\PEInc\PatternExplorer_1.afl> #include_once <\PEInc\Lib\PatternExplorer_f13.afl> /*******************************************************************************************/ PlotShapes( IIf( Top, TopShape, -1e10 ), Topshapecolor, 0, H, def_BuyShapeOffset ); PlotShapes( IIf( Valley, Valleyshape, -1e10 ), ValleyShapecolor, 0, L, def_SellShapeOffset ); Plot( IIf( SRplot & x >= x_lasttop, LastValue( ValueWhen( top, TopInput, 1 ) ), Null ), "", Topshapecolor, 1 + styleNoRescale ); Plot( IIf( SRplot & x >= x_lastvalley, LastValue( ValueWhen( Valley, ValleyInput, 1 ) ), Null ), "", Valleyshapecolor, 1 + styleNoRescale ); /*******************************************************************************************/ Buy = def_Buy AND ( Sup_confirmed OR Res_break ); Sell = def_Sell AND ( Res_confirmed OR Sup_break ); /*******************************************************************************************/ Filter = def_Filter AND BarIndex() == LastValue( BarIndex() ) AND NOT GroupID() == 253; Filter = Filter AND ( SupSignals OR ResSignals ); /*******************************************************************************************/ Addefaultcolumns(); Adddefaultcolumns( 2, 1 ); AddTextColumn( WriteIf( Sup_pricejustabove, "Price just above", WriteIf( Sup_confirmed, "Confirmed", WriteIf( Sup_break, "Break", "" ) ) ), "Support", 1.2, IIf( Sup_pricejustabove OR sup_confirmed, colorGreen, colorRed ) ); AddTextColumn( WriteIf( Res_pricejustbelow, "Price just below", WriteIf( Res_confirmed, "Confirmed", WriteIf( Res_break, "Break", "" ) ) ), "Resistance", 1.2, IIf( Res_pricejustbelow OR Res_confirmed, colorRed, colorGreen ) ); AddTextColumn( FullName(), "Full name" ); /*******************************************************************************************/ PlotShapes( IIf( Shswitch AND PivotLow, shapeCircle, Null ), SLC, 0, L, -35 ) ; PlotShapes( IIf( Shswitch AND PivotHigh, shapeCircle, Null ), SHC, 0, H, 35 ) ; Plot( IIf( Sswitch, ZZ, Null ), " ", Swingcolor, Swingstyle + styleNoTitle ); /*******************************************************************************************/ if ( SRbS ) { AddAlert( Res_break, Audio, Email, "Resistance broken", 1, BarComplete, def_BuySound1 ); AddAlert( Sup_break, Audio, Email, "Support broken", 2, BarComplete, def_SellSound1 ); } if ( SRcS ) { AddAlert( Sup_confirmed, Audio, Email, "Support confirmed", 1, BarComplete, def_BuySound2 ); AddAlert( Res_confirmed, Audio, Email, "Resistance confirmed", 2, BarComplete, def_SellSound2 ); } if ( PjabS ) { AddAlert( Sup_pricejustabove, Audio, Email, "Price just above Support", 1, BarComplete, def_BuySound1 ); AddAlert( Res_pricejustbelow, Audio, Email, "Price just below Resistance", 2, BarComplete, def_SellSound1 ); } /*******************************************************************************************/ ToolTip = def_ToolTip; /*******************************************************************************************/ AddCustomCodeAfterPE(); /*******************************************************************************************/ Title = "PatternExplorer.com - Fractals" + default_priceTitle; //|----------------------------------------------------------------------------------------- //|PatternExplorer.com - Candlestick Recognition //|Copyright © 2007, PatternExplorer.com //|http://www.PatternExplorer.com //|e-mail: support@PatternExplorer.com //|----------------------------------------------------------------------------------------- FormulaName = "PE - Candlesticks"; SetChartOptions( 0, chartShowDates | chartLogarithmic | chartWrapTitle ); #pragma nocache #include_once <\PEInc\PatternExplorer_f0.afl> #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl" #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl" /*******************************************************************************************/ AddCustomCodeBeforePE(); /*******************************************************************************************/ def_PE_AB_Style = 0; //PatternExplorer style:0 //Amibroker style: 1 def_pricestyle = styleCandle;// + styleThick; //can be used at PatternExplorer mode def_Band_switch = 1;//Off:0 //On:1 def_BandTyp = 0;//Off:0 //Bollinger Bands:1 //Headley Acceleration Bands:2 //Keltner Channel:3 //Price Channel:4 /*******************************************************************************************/ //AddparamUsefromChart(1); AddAlertParam( def_AudioAlert, def_EmailAlert, def_BarComplete ); /*******************************************************************************************/ _SECTION_BEGIN( "Main Parameters" ); ActTrendFilter = ParamToggle( "Trend Filter", "Off,On", 0 ); SRplot = ParamToggle( "Plot S/R", "Off,On", 1 ); TextPlot = ParamToggle( "Plot Signal Text", "Off,On", 0 ); Buyshape = Param( "Buy Shape Typ", def_BuyShape, 1, 60, 1 ); Sellshape = Param( "Sell Shape Typ", def_SellShape, 1, 60, 1 ); BuyColor = ParamColor( "Buy Signals", def_BuyShapeColor ); SellColor = ParamColor( "Sell Signals", def_SellShapeColor ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Pattern Selection" ); Dojistar_s = ParamToggle( "Doji Star", "Off,On", 1 ); Hammer_s = ParamToggle( "Hammer/Shooting Star", "Off,On", 1 ); Hangingman_s = ParamToggle( "Hanging Man/Inverted Hammer", "Off,On", 1 ); Spinningtop_s = ParamToggle( "Spinning Top", "Off,On", 1 ); Eng_s = ParamToggle( "Engulfing", "Off,On", 1 ); Harami_s = ParamToggle( "Harami", "Off,On", 1 ); Piercingline_s = ParamToggle( "Piercing Line/Dark Cloud Cover", "Off,On", 1 ); Morning_evening_star_s = ParamToggle( "Morning Star/Evening Star", "Off,On", 1 ); _SECTION_END(); /*Static - currently not support by amibroker if(InChart)StaticVarSet("PQQAWN",Dojistar_s);if(inAA AND Usefromchart) Dojistar_s = StaticVarGet("PQQAWN"); if(InChart)StaticVarSet("ONLDUM",Hammer_s);if(inAA AND Usefromchart) Hammer_s = StaticVarGet("ONLDUM"); if(InChart)StaticVarSet("CPAWNL",Hangingman_s);if(inAA AND Usefromchart) Hangingman_s = StaticVarGet("CPAWNL"); if(InChart)StaticVarSet("MNHCWV",Spinningtop_s);if(inAA AND Usefromchart) Spinningtop_s = StaticVarGet("MNHCWV"); if(InChart)StaticVarSet("FLXSHT",Eng_s);if(inAA AND Usefromchart) Eng_s = StaticVarGet("FLXSHT"); if(InChart)StaticVarSet("FBDBRN",Harami_s);if(inAA AND Usefromchart) Harami_s = StaticVarGet("FBDBRN"); if(InChart)StaticVarSet("OVITBK",Piercingline_s);if(inAA AND Usefromchart) Piercingline_s = StaticVarGet("OVITBK"); if(InChart)StaticVarSet("VHVRAB",Morning_evening_star_s);if(inAA AND Usefromchart) Morning_evening_star_s = StaticVarGet("VHVRAB"); */ /*******************************************************************************************/ #include_once <\PEInc\Lib\PatternExplorer_f01.afl> #include_once <\PEInc\PatternExplorer_1.afl> /*******************************************************************************************/ if ( ActTrendFilter == 0 ) { Buy = def_Buy AND CandlePatternRank > 0; Sell = def_Sell AND CandlePatternRank < 0; } if ( ActTrendFilter ) { Buy = def_Buy AND CandlePatternRank > 0 AND PeTaio() > 0 AND TaioTimeFrame( 5, 6, 4, expandLast ) > 0 AND Taio2direction == 1; //define your conditions for the Trendfilter here. Sell = def_Sell AND CandlePatternRank < 0 AND PeTaio() < 0 AND TaioTimeFrame( 5, 6, 4, expandLast ) < 0 AND Taio2direction == 0; //define your conditions for the Trendfilter here. } /*******************************************************************************************/ Filter = def_Filter AND NOT GroupID() == 253; Filter = Filter AND ( Buy OR Sell ); /*******************************************************************************************/ Addefaultcolumns(); Adddefaultcolumns( 2, 1 ); if ( CandleColumnOn == 0 ) AddCandleColumn(); AddTextColumn( FullName(), "Full name" ); /*******************************************************************************************/ PlotShapes( IIf( Buy, Buyshape, IIf( Sell, Sellshape, Null ) ), IIf( Buy, BuyColor, SellColor ), 0, IIf( Buy, L, H ), IIf( Buy, -def_BuyShapeOffset, -def_SellShapeOffset ) ); Plot( IIf( SRplot, Plot_Buy, Null ), "Support", Buycolor, 1 + styleNoTitle ); Plot( IIf( SRplot, Plot_Sell, Null ), "Resistance", Sellcolor, 1 + styleNoTitle ); /*******************************************************************************************/ if ( TextPlot ) { //PlotSignalText (Condition,Text,AdText,AdTextArray,Distance,Array,TextColor,BGColor); PlotSignalText ( PR > 0, "Buy", 0, L, -0.8, L, BuyColor, colorDefault ); PlotSignalText ( PR < 0, "Sell", 0, H, 1.0, H, SellColor, colorDefault ); } /*******************************************************************************************/ AddAlert( Hammer, Audio, Email, "Bullish Hammer" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beSSTAR, Audio, Email, "Bearish Shooting Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( InvertedHammer, Audio, Email, "Bullish Inverted Hammer" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( HangingMan, Audio, Email, "Bearish Hanging Man" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( SpinningTop AND NOT buDS, Audio, Email, "Bearish Spinning Top" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buENG, Audio, Email, "Bullish Engulfing" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beENG, Audio, Email, "Bearish Engulfing" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buHARAMI, Audio, Email, "Bullish Harami" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beHARAMI, Audio, Email, "Bearish Harami" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buHARAMICROSS, Audio, Email, "Bullish Harami Cross" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beHARAMICROSS, Audio, Email, "Bearish Harami Cross" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buDS, Audio, Email, "Bullish Doji Star" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beDS, Audio, Email, "Bearish Doji Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buPIERCINGLINE, Audio, Email, "Bullish Piercingline" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beDARKCLOUDCOVER, Audio, Email, "Bearish Dark Cloud Cover" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buMorningStar, Audio, Email, "Bullish Morning Star" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( buMorningDojiStar, Audio, Email, "Bullish Morning Doji Star" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beEveningStar, Audio, Email, "Bearish Evening Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( beEveningDojiStar, Audio, Email, "Bearish Evening Doji Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); /*******************************************************************************************/ ToolTip = def_ToolTip + "\n\n" + CandlePattern; /*******************************************************************************************/ AddCustomCodeAfterPE(); /*******************************************************************************************/ Title = "PatternExplorer.com - Candlestick Recognition" + default_priceTitle + ", " + EncodeColor( def_Color3 ) + WriteIf( CandlePatternRank > 0, "Bullish ", WriteIf( CandlePatternRank < 0, "Bearish ", "" ) ) + CandlePattern + " "; //|----------------------------------------------------------------------------------------- //|PatternExplorer.com - Candlestick Recognition //|Copyright © 2007, PatternExplorer.com //|http://www.PatternExplorer.com //|e-mail: support@PatternExplorer.com //|----------------------------------------------------------------------------------------- FormulaName = "PE - Candlesticks"; SetChartOptions( 0, chartShowDates | chartLogarithmic | chartWrapTitle ); #pragma nocache #include_once <\PEInc\PatternExplorer_f0.afl> #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl" #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl" /*******************************************************************************************/ AddCustomCodeBeforePE(); /*******************************************************************************************/ def_PE_AB_Style = 0; //PatternExplorer style:0 //Amibroker style: 1 def_pricestyle = styleCandle;// + styleThick; //can be used at PatternExplorer mode def_Band_switch = 1;//Off:0 //On:1 def_BandTyp = 0;//Off:0 //Bollinger Bands:1 //Headley Acceleration Bands:2 //Keltner Channel:3 //Price Channel:4 /*******************************************************************************************/ //AddparamUsefromChart(1); AddAlertParam( def_AudioAlert, def_EmailAlert, def_BarComplete ); /*******************************************************************************************/ _SECTION_BEGIN( "Main Parameters" ); ActTrendFilter = ParamToggle( "Trend Filter", "Off,On", 0 ); SRplot = ParamToggle( "Plot S/R", "Off,On", 1 ); TextPlot = ParamToggle( "Plot Signal Text", "Off,On", 0 ); Buyshape = Param( "Buy Shape Typ", def_BuyShape, 1, 60, 1 ); Sellshape = Param( "Sell Shape Typ", def_SellShape, 1, 60, 1 ); BuyColor = ParamColor( "Buy Signals", def_BuyShapeColor ); SellColor = ParamColor( "Sell Signals", def_SellShapeColor ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Pattern Selection" ); Dojistar_s = ParamToggle( "Doji Star", "Off,On", 1 ); Hammer_s = ParamToggle( "Hammer/Shooting Star", "Off,On", 1 ); Hangingman_s = ParamToggle( "Hanging Man/Inverted Hammer", "Off,On", 1 ); Spinningtop_s = ParamToggle( "Spinning Top", "Off,On", 1 ); Eng_s = ParamToggle( "Engulfing", "Off,On", 1 ); Harami_s = ParamToggle( "Harami", "Off,On", 1 ); Piercingline_s = ParamToggle( "Piercing Line/Dark Cloud Cover", "Off,On", 1 ); Morning_evening_star_s = ParamToggle( "Morning Star/Evening Star", "Off,On", 1 ); _SECTION_END(); /*Static - currently not support by amibroker if(InChart)StaticVarSet("PQQAWN",Dojistar_s);if(inAA AND Usefromchart) Dojistar_s = StaticVarGet("PQQAWN"); if(InChart)StaticVarSet("ONLDUM",Hammer_s);if(inAA AND Usefromchart) Hammer_s = StaticVarGet("ONLDUM"); if(InChart)StaticVarSet("CPAWNL",Hangingman_s);if(inAA AND Usefromchart) Hangingman_s = StaticVarGet("CPAWNL"); if(InChart)StaticVarSet("MNHCWV",Spinningtop_s);if(inAA AND Usefromchart) Spinningtop_s = StaticVarGet("MNHCWV"); if(InChart)StaticVarSet("FLXSHT",Eng_s);if(inAA AND Usefromchart) Eng_s = StaticVarGet("FLXSHT"); if(InChart)StaticVarSet("FBDBRN",Harami_s);if(inAA AND Usefromchart) Harami_s = StaticVarGet("FBDBRN"); if(InChart)StaticVarSet("OVITBK",Piercingline_s);if(inAA AND Usefromchart) Piercingline_s = StaticVarGet("OVITBK"); if(InChart)StaticVarSet("VHVRAB",Morning_evening_star_s);if(inAA AND Usefromchart) Morning_evening_star_s = StaticVarGet("VHVRAB"); */ /*******************************************************************************************/ #include_once <\PEInc\Lib\PatternExplorer_f01.afl> #include_once <\PEInc\PatternExplorer_1.afl> /*******************************************************************************************/ if ( ActTrendFilter == 0 ) { Buy = def_Buy AND CandlePatternRank > 0; Sell = def_Sell AND CandlePatternRank < 0; } if ( ActTrendFilter ) { Buy = def_Buy AND CandlePatternRank > 0 AND PeTaio() > 0 AND TaioTimeFrame( 5, 6, 4, expandLast ) > 0 AND Taio2direction == 1; //define your conditions for the Trendfilter here. Sell = def_Sell AND CandlePatternRank < 0 AND PeTaio() < 0 AND TaioTimeFrame( 5, 6, 4, expandLast ) < 0 AND Taio2direction == 0; //define your conditions for the Trendfilter here. } /*******************************************************************************************/ Filter = def_Filter AND NOT GroupID() == 253; Filter = Filter AND ( Buy OR Sell ); /*******************************************************************************************/ Addefaultcolumns(); Adddefaultcolumns( 2, 1 ); if ( CandleColumnOn == 0 ) AddCandleColumn(); AddTextColumn( FullName(), "Full name" ); /*******************************************************************************************/ PlotShapes( IIf( Buy, Buyshape, IIf( Sell, Sellshape, Null ) ), IIf( Buy, BuyColor, SellColor ), 0, IIf( Buy, L, H ), IIf( Buy, -def_BuyShapeOffset, -def_SellShapeOffset ) ); Plot( IIf( SRplot, Plot_Buy, Null ), "Support", Buycolor, 1 + styleNoTitle ); Plot( IIf( SRplot, Plot_Sell, Null ), "Resistance", Sellcolor, 1 + styleNoTitle ); /*******************************************************************************************/ if ( TextPlot ) { //PlotSignalText (Condition,Text,AdText,AdTextArray,Distance,Array,TextColor,BGColor); PlotSignalText ( PR > 0, "Buy", 0, L, -0.8, L, BuyColor, colorDefault ); PlotSignalText ( PR < 0, "Sell", 0, H, 1.0, H, SellColor, colorDefault ); } /*******************************************************************************************/ AddAlert( Hammer, Audio, Email, "Bullish Hammer" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beSSTAR, Audio, Email, "Bearish Shooting Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( InvertedHammer, Audio, Email, "Bullish Inverted Hammer" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( HangingMan, Audio, Email, "Bearish Hanging Man" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( SpinningTop AND NOT buDS, Audio, Email, "Bearish Spinning Top" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buENG, Audio, Email, "Bullish Engulfing" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beENG, Audio, Email, "Bearish Engulfing" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buHARAMI, Audio, Email, "Bullish Harami" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beHARAMI, Audio, Email, "Bearish Harami" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buHARAMICROSS, Audio, Email, "Bullish Harami Cross" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beHARAMICROSS, Audio, Email, "Bearish Harami Cross" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buDS, Audio, Email, "Bullish Doji Star" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beDS, Audio, Email, "Bearish Doji Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buPIERCINGLINE, Audio, Email, "Bullish Piercingline" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beDARKCLOUDCOVER, Audio, Email, "Bearish Dark Cloud Cover" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( buMorningStar, Audio, Email, "Bullish Morning Star" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( buMorningDojiStar, Audio, Email, "Bullish Morning Doji Star" + def_AudioAlertText, 1, BarComplete, def_BuySound1 ); AddAlert( beEveningStar, Audio, Email, "Bearish Evening Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); AddAlert( beEveningDojiStar, Audio, Email, "Bearish Evening Doji Star" + def_AudioAlertText, 2, BarComplete, def_SellSound1 ); /*******************************************************************************************/ ToolTip = def_ToolTip + "\n\n" + CandlePattern; /*******************************************************************************************/ AddCustomCodeAfterPE(); /*******************************************************************************************/ Title = "PatternExplorer.com - Candlestick Recognition" + default_priceTitle + ", " + EncodeColor( def_Color3 ) + WriteIf( CandlePatternRank > 0, "Bullish ", WriteIf( CandlePatternRank < 0, "Bearish ", "" ) ) + CandlePattern + " "; //|----------------------------------------------------------------------------------------- //|PatternExplorer.com - Fractals //|Copyright © 2007, PatternExplorer.com //|http://www.PatternExplorer.com //|e-mail: support@PatternExplorer.com //|----------------------------------------------------------------------------------------- FormulaName = "PE - Fractals"; SetChartOptions( 0, chartShowDates | chartWrapTitle ); #pragma nocache #include_once <\PEInc\PatternExplorer_f0.afl> #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Defaults.afl" #include_once "Formulas\PatternExplorer\#Defaults & Mods\PE - Mods.afl" /*******************************************************************************************/ AddCustomCodeBeforePE(); /*******************************************************************************************/ AddAlertParam( def_AudioAlert, def_EmailAlert, def_BarComplete ); /*******************************************************************************************/ _SECTION_BEGIN( "Alerts" ); SRbS = ParamToggle( "S/R broken", "Off,On", 1 ); SRcS = ParamToggle( "S/R confirmed", "Off,On", 1 ); PjabS = ParamToggle( "Price just above/below", "Off,On", 1 ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Main parameters" ); SRplot = ParamToggle( "Plot S/R", "Off,On", 1 ); Sswitch = ParamToggle( "PLot Swing Chart", "Off,On", 0 ); Shswitch = ParamToggle( "Plot Swing Shapes", "Off,On", 0 ); SwingSize = Param( "Swing Size %", 5, 0.1, 40, 0.1 ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Sensitivity" ); AddparamUsefromChart2( def_UseFromChart ); PatternPriceBasis = ParamToggle( "Pattern Price Basis", "Close|High & Low", def_PatternPriceBasisFractals ); Bars = Param( "Bars", 5, 2, 20, 1 ); MinVertSize = Param( "Minimum Vertical Size (*ATR)", 0, 0, 3.01, 0.05 ); if ( InChart ) StaticVarSet( "Ddf343", PatternPriceBasis ); if ( inAA AND Usefromchart ) PatternPriceBasis = StaticVarGet( "Ddf343" ); if ( InChart ) StaticVarSet( "P54972", Bars ); if ( inAA AND Usefromchart ) Bars = StaticVarGet( "P54972" ); if ( InChart ) StaticVarSet( "Adf343", MinVertSize ); if ( inAA AND Usefromchart ) MinVertSize = StaticVarGet( "Adf343" ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Styles" ); Swingstyle = ParamStyle( "Swing Line", styleLine | styleThick, maskDefault ); TopShape = Param( "Top Fractal Typ", 21, 0, 50, 1 ); ValleyShape = Param( "Valley Fractal Typ", 22, 0, 50, 1 ); _SECTION_END(); /*******************************************************************************************/ _SECTION_BEGIN( "Colors" ); SLC = ParamColor( "Swing Low", colorPaleGreen ); SHC = ParamColor( "Swing High", colorLightOrange ); Swingcolor = ParamColor( "Swing Line", def_Color6 ); Topshapecolor = ParamColor( "Top Fractal", def_SellShapeColor ); Valleyshapecolor = ParamColor( "Bottom Fractal", def_BuyShapeColor ); _SECTION_END(); /*******************************************************************************************/ #include_once <\PEInc\PatternExplorer_1.afl> #include_once <\PEInc\Lib\PatternExplorer_f13.afl> /*******************************************************************************************/ PlotShapes( IIf( Top, TopShape, -1e10 ), Topshapecolor, 0, H, def_BuyShapeOffset ); PlotShapes( IIf( Valley, Valleyshape, -1e10 ), ValleyShapecolor, 0, L, def_SellShapeOffset ); Plot( IIf( SRplot & x >= x_lasttop, LastValue( ValueWhen( top, TopInput, 1 ) ), Null ), "", Topshapecolor, 1 + styleNoRescale ); Plot( IIf( SRplot & x >= x_lastvalley, LastValue( ValueWhen( Valley, ValleyInput, 1 ) ), Null ), "", Valleyshapecolor, 1 + styleNoRescale ); /*******************************************************************************************/ Buy = def_Buy AND ( Sup_confirmed OR Res_break ); Sell = def_Sell AND ( Res_confirmed OR Sup_break ); /*******************************************************************************************/ Filter = def_Filter AND BarIndex() == LastValue( BarIndex() ) AND NOT GroupID() == 253; Filter = Filter AND ( SupSignals OR ResSignals ); /*******************************************************************************************/ Addefaultcolumns(); Adddefaultcolumns( 2, 1 ); AddTextColumn( WriteIf( Sup_pricejustabove, "Price just above", WriteIf( Sup_confirmed, "Confirmed", WriteIf( Sup_break, "Break", "" ) ) ), "Support", 1.2, IIf( Sup_pricejustabove OR sup_confirmed, colorGreen, colorRed ) ); AddTextColumn( WriteIf( Res_pricejustbelow, "Price just below", WriteIf( Res_confirmed, "Confirmed", WriteIf( Res_break, "Break", "" ) ) ), "Resistance", 1.2, IIf( Res_pricejustbelow OR Res_confirmed, colorRed, colorGreen ) ); AddTextColumn( FullName(), "Full name" ); /*******************************************************************************************/ PlotShapes( IIf( Shswitch AND PivotLow, shapeCircle, Null ), SLC, 0, L, -35 ) ; PlotShapes( IIf( Shswitch AND PivotHigh, shapeCircle, Null ), SHC, 0, H, 35 ) ; Plot( IIf( Sswitch, ZZ, Null ), " ", Swingcolor, Swingstyle + styleNoTitle ); /*******************************************************************************************/ if ( SRbS ) { AddAlert( Res_break, Audio, Email, "Resistance broken", 1, BarComplete, def_BuySound1 ); AddAlert( Sup_break, Audio, Email, "Support broken", 2, BarComplete, def_SellSound1 ); } if ( SRcS ) { AddAlert( Sup_confirmed, Audio, Email, "Support confirmed", 1, BarComplete, def_BuySound2 ); AddAlert( Res_confirmed, Audio, Email, "Resistance confirmed", 2, BarComplete, def_SellSound2 ); } if ( PjabS ) { AddAlert( Sup_pricejustabove, Audio, Email, "Price just above Support", 1, BarComplete, def_BuySound1 ); AddAlert( Res_pricejustbelow, Audio, Email, "Price just below Resistance", 2, BarComplete, def_SellSound1 ); } /*******************************************************************************************/ ToolTip = def_ToolTip; /*******************************************************************************************/ AddCustomCodeAfterPE(); /*******************************************************************************************/ Title = "PatternExplorer.com - Fractals" + default_priceTitle; _SECTION_BEGIN("Stochastic_45-4-2_833"); periods = Param( "Periods", 20, 1, 200, 1 ); K1smooth = Param( "%K1 avg", 4, 1, 200, 1 ); //Plot( StochK( periods , K1smooth), _DEFAULT_NAME(), colorCustom3, styleNoLabel | styleThick | styleDots); periods = Param( "Periods", 20, 1, 200, 1 ); K1smooth = Param( "%K1 avg", 4, 1, 200, 1 ); D1smooth = Param( "%D1 avg", 2, 1, 200, 1 ); //Plot( StochD( periods , K1smooth, D1Smooth ), _DEFAULT_NAME(), colorCustom3, styleNoLabel | styleThick | styleDots); A = StochK( periods , K1smooth); B = StochD( periods , K1smooth, D1Smooth ); //Plot (20, "", colorTan, styleNoLabel); //Plot (50, "", colorLavender, styleNoLabel); //Plot (80, "", colorTan, styleNoLabel); //PlotOHLC( 100, 100 , 95 , 95 , "", IIf( a < 20 OR a > 80,colorBlack,IIf(A>B ,colorBrightGreen,colorRed)), styleCloud | styleNoLabel); //PlotOHLC( 5, 5 , 0 , 0 , "", IIf( a < 20 OR a > 80,colorBlack,IIf(AB,colorBrightGreen,colorRed); //Plot( M,"StoK", ColorK, styleNoLabel|styleThick); //Plot( N,"StoD", colorDarkYellow, styleNoLabel|styleDashed); style = Param("candle = yes",1,0,1,1); Plot(Close,"",IIf(A > B ,colorBrightGreen,colorRed),IIf(style==1,styleCandle,styleLine)); //PlotOHLC( O, H , L , C , "Cloud", IIf(A > B ,colorDarkGreen,colorDarkRed), styleCloud | styleNoLabel); _SECTION_END(); _SECTION_BEGIN("Fibo for all bars"); TimeFrameSet( inDaily ); DH=Ref(H,-1); DL=Ref(L,-1); DC=Ref(C,-1); pd = (O+ DH+ DL + DC )/4; sd1 = (2*pd)-DH; sd2 = pd -(DH - DL); sd3 = Sd1 - (DH-DL); rd1 = (2*pd)-DL; rd2 = pd +(DH -DL); rd3 = rd1 +(DH-DL); H4 = (dH - dL) * 1.1 / 2 + dC; H3 = (dH - dL) * 1.1 / 4 + dC; h2 = (dH - dL) * 1.1 / 6 + dC; H1 = (dH - dL) * 1.1 / 12 + dC; L1 = dC - (dH - dL) * 1.1 / 12; L2 = dC - (dH - dL) * 1.1 / 6; L3 = dC - (dH - dL) * 1.1 / 4; L4 = dC - (dH - dL) * 1.1 / 2 ; //Plot (pd,"Pivot",colorBlue,styleDots); //Plot (rd1," R1 ",35,styleDots); //Plot (rd2," R2 ",35,styleDots); //Plot (rd3," R3 ",35,styleDots); //Plot (sd1," S1 ",4,styleDots); //Plot (Sd2," S2 ",4,styleDots); //Plot (Sd3," S3 ",4,8+16); /* style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128+4); Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL */ TimeFrameRestore(); tgt_up = H4*5/1000 + H4; tgt_up2 = H4*10/1000 + H4; tgt_dn = L4-L4*5/1000; tgt_dn2 = L4-L4*10/1000; Title = EncodeColor(colorWhite)+ "LINKON'S PIVOT TRADING SYSTEM" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) + " - " + Date() +" - " //+ WriteIf(Col_action==colorGreen, EncodeColor(colorGreen)+"stay LONG","")+ WriteIf(Col_action==colorRed, EncodeColor(colorRed)+"stay SHORT","")+ WriteIf(Col_action==colorBlack, EncodeColor(colorYellow)+"No Trend","")+"\n" + "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+" UP "+ (V/MA(V,26))*100 + " %", EncodeColor(colorRed)+" DOWN "+ (V/MA(V,26))*100 + " %") + EncodeColor(colorGreen)+ "\n H4 : "+ EncodeColor(colorWhite)+H4+ EncodeColor(colorGreen)+ " tgt : "+ EncodeColor(colorWhite)+tgt_up +EncodeColor(colorGreen)+ " tgt2 : "+ EncodeColor(colorWhite)+tgt_up2 + EncodeColor(colorGreen)+ "\n H3 : "+ EncodeColor(colorWhite)+H3 + EncodeColor(colorGreen)+ "\n H2 : "+ EncodeColor(colorWhite)+H2 + EncodeColor(colorGreen)+ "\n H1 : "+ EncodeColor(colorWhite)+H1+ EncodeColor(colorGreen)+ "` Hi: "+ EncodeColor(colorWhite)+H + EncodeColor(colorBlue)+ "\n Pivot : "+ EncodeColor(colorWhite)+pd + EncodeColor(colorYellow)+ "` Op: "+ EncodeColor(colorWhite)+O+ EncodeColor(colorAqua)+ "Cl: "+ EncodeColor(colorBrightGreen)+C + EncodeColor(colorRed)+ "\n L1 : "+ EncodeColor(colorWhite)+L1+ EncodeColor(colorRed)+ "` Lo: "+ EncodeColor(colorWhite)+L + EncodeColor(colorRed)+ "\n L2 : "+ EncodeColor(colorWhite)+L2 + EncodeColor(colorRed)+ "\n L3 : "+ EncodeColor(colorWhite)+L3 + EncodeColor(colorRed)+ "\n L4 : "+ EncodeColor(colorWhite)+L4+ EncodeColor(colorRed)+ " tgt : "+ EncodeColor(colorWhite)+tgt_dn + EncodeColor(colorRed)+ " tgt2 : "+ EncodeColor(colorWhite)+tgt_dn2 ; _SECTION_END(); //Plot(6, "", IIf(PDI(7) > MDI(7) AND PDI(7) > 30,colorGreen,IIf (MDI(7) > PDI(7) AND MDI(7) > 30,colorRed,colorYellow)), styleOwnScale| styleArea|styleNoLabel,-0.5,100); _SECTION_BEGIN("EMA"); Plot( EMA( Close, 34 ), "", IIf(EMA( Close, 34 ) > Ref(EMA( Close, 34 ),-1),colorGreen,colorRed),styleThick ); Plot( EMA( Close, 33 ), "", IIf(EMA( Close, 34 ) > Ref(EMA( Close, 34 ),-1),colorGreen,colorRed),styleThick+styleNoLabel ); Plot( EMA( Close, 32 ), "", IIf(EMA( Close, 34 ) > Ref(EMA( Close, 34 ),-1),colorGreen,colorRed),styleThick+styleNoLabel ); _SECTION_END(); _SECTION_BEGIN("Price BetterColor "); Period = Param("Period", 20, 2, 300, 1, 10 ); LowColor = colorYellow; ClimaxColor = colorRed; ChurnColor = colorGreen; ClimaxChurnColor=colorBlue; LowChurnColor= colorWhite; Value1 = C; Value2 = C*(H-L); Value3 = C/(H-L); BarColor = IIf( (Value1 == LLV(Value1,Period)), LowColor, IIf( (Value2 == HHV(Value2,Period)), ClimaxColor, IIf( (Value3 == HHV(Value3,Period)), ChurnColor, IIf( ((Value2 == HHV(Value2,Period) AND (Value3 == HHV(Value3,Period)))), ClimaxChurnColor, IIf( (Value3 == LLV(Value3,Period)), LowChurnColor, colorBlueGrey))))); _SECTION_END(); _SECTION_BEGIN("Price"); Plot(C, "", BarColor, styleCandle); ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 ))); _SECTION_END();