Author: Roberto Jacobs (3rjfx) | Featured on Forex Home Expert
Introduction
In the world of professional trading, price action is the language of the market. While indicators provide context, candlestick patterns provide the signal. Today, we are diving deep into the FCP (Forex Candlestick Patterns) for MT5, a high-performance tool designed to identify high-probability reversal and continuation patterns with surgical precision.
FCP is the Forex Candlestick Patterns indicator with alert based on Japanese Candlestick Strategies by the legendary Japanese Munehisa Homma, which can help traders penetrate price action inside of financial markets.
Why Candlestick Patterns Matter
Every candle tells a story of the battle between bulls and bears. However, identifying these patterns manually across multiple timeframes can be exhausting and prone to human error. The FCP Indicator automates this process, allowing you to focus on decision-making rather than chart hunting.
The Evolution of a Legend: From MT4 to MT5
The Forex Candlestick Patterns (FCP) has a long-standing history of success. The original MT4 version, we have published it on the MQL5 CodeBase in 2019, proving its effectiveness among the global trading community. You can find that legacy version here: [ForexCandlestickPatterns for MT4]
Today, we bring that same reliability to MetaTrader 5, enhanced with modern coding standards and significantly expanded capabilities.
The Ultimate Library: 58 Patterns Identified
While most candlestick indicators only detect 5 or 10 basic formations, the FCP for MT5 is in a league of its own. It is programmed to identify 58 distinct candlestick patterns, covering everything from classic reversals like Morning Stars and Engulfing patterns to advanced formations like Three Line Strike, Tasuki Gaps, and Unique Three River Bottoms.
Having 58 patterns at your fingertips means you will never miss a market shift, no matter how subtle the formation.
What FCP (Forex Candlestick Patterns) Does?
Core responsibilities of the indicator are:
- Recognize candlestick types (Doji, Marubozu, Hammer, Engulfing, Morning/Evening Star, Three White Soldiers, Three Black Crows, and many more).
- Map two indicator buffers (one for bullish signals and one for bearish signals) so signals can be plotted on the chart.
- Draw labels and text on the chart to show pattern name, bar shift, direction, and trigger price.
- Send alerts via popup, email, or push notification when a pattern is detected (configurable).
Technical Powerhouse: The GMM_ Dynamic Buffers
To ensure professional-grade stability and accuracy, I have integrated specialized buffers (`FCPUp` and `FCPDw`) utilizing the dynamic `GMM_bars` variable for precise memory management:
GMM_bars=iBars(Symbol(),TFcp);
//--
ArrayResize(cp.FCPUp,GMM_bars,GMM_bars);
ArrayResize(cp.FCPDw,GMM_bars,GMM_bars);
ArraySetAsSeries(cp.FCPUp,true);
ArraySetAsSeries(cp.FCPDw,true);
ArrayInitialize(FCPUp,0.0);
ArrayInitialize(FCPDw,0.0);
***Copyright © 2026 3rjfx ~ For educational purposes only.***
So, the indicator runs inside the chart window and uses two indicator buffers named FCPUp and FCPDw to mark bullish and bearish signals respectively.
How Pattern Detection Works
The detection pipeline is implemented in a compact, readable way. The main steps are:
- Price snapshot — the indicator copies recent OHLC and time arrays using
CopyOpen,CopyHigh,CopyLow,CopyClose, andCopyTime. This is done insideUpdatePrice. - Candle classification — a helper function
RecognizeCandlebuilds aCandle_Structurefor each relevant bar. It computes body size, high-low range, shadow sizes, and assigns enumerated types such asCand_Long,Cand_Doji,Cand_Hammer, etc. The routine also computes average body size across a configurable averaging period to decide thresholds. - Pattern rules — the indicator evaluates a sequence of candle structures (bar1, bar2, bar3, etc.) against explicit logical conditions. Each pattern is encoded as an
ifblock that checks trend, candle types, wick sizes, relative highs/lows, and body-size comparisons. When a pattern matches, the code sets a pattern code (e.g.,cp.cal = 12for Morning Star Bull), draws labels, and optionally triggers alerts. - Visual and buffer output — when a bullish pattern is found the code writes a value into
FCPUp[barIndex]; when bearish, it writes intoFCPDw[barIndex]. The indicator then uses those buffers to plot markers on the chart.
Key Patterns Implemented
The indicator implements a long list of classic patterns. Below are the most relevant ones with short practical notes.
| Pattern | Aim | Practical note |
|---|---|---|
| Doji Star Bull / Doji Star Bear | Bull / Bear | Small doji after a long candle; reversal signal when confirmed by next candle. |
| Engulfing Bull / Engulfing Bear | Bull / Bear | Strong reversal when a candle fully engulfs the previous body. |
| Morning Star / Evening Star | Bull / Bear | Three-bar reversal pattern; look for confirmation on the following bar. |
| Harami / Harami Cross | Reversal | Smaller body inside previous large body; cross (doji) increases significance. |
| Three White Soldiers / Three Black Crows | Bull / Bear | Strong trend continuation or reversal depending on prior context. |
| Hammer / Shooting Star | Bull / Bear | Single-bar reversal; check wick length relative to body. |
| Piercing Line / Dark Cloud Cover | Bull / Bear | Two-bar reversal patterns with specific midpoint rules. |
| Many others (Tweezers, Tasuki Gaps, Kicking, Abandoned Baby) | Varies | Indicator includes 58 patterns encoded as explicit rules. |
The source contains explicit if blocks for dozens of patterns (e.g., Engulfing, Morning Star, Harami, Piercing Line, Three White Soldiers, Three Black Crows, Tweezers, Tasuki Gap, Kicking, Abandoned Baby). Each block sets a pattern code and calls DrawSignal to annotate the chart.
1–58: Pattern explanations (concise, practical)
Each entry: Pattern name — role — short structural description and a practical trading note.
- Doji Star Bull — Bullish reversal. Doji after a long bearish candle; confirmation by a bullish follow-through. Use at support or oversold context.
- Doji Star Bear — Bearish reversal. Doji after a long bullish candle; confirm with bearish follow-through near resistance.
- Engulfing Bull — Bullish reversal. A bullish body fully engulfs the prior bearish body; ber at swing lows.
- Engulfing Bear — Bearish reversal. Bearish body engulfs prior bullish body; ber at swing highs.
- Morning Star Bull — Bullish three-bar reversal. Long bearish → small star → long bullish closing into first bar’s body; wait for confirmation.
- Evening Star Bear — Bearish three-bar reversal. Mirror of Morning Star; confirm with bearish follow-through.
- Morning Doji Star Bull — Bullish three-bar with doji middle. Doji middle increases significance; confirm with bullish close.
- Evening Doji Star Bear — Bearish three-bar with doji middle. Mirror of #7.
- Three Star in the South Bull — Bullish multi-star bottoming pattern; indicates selling exhaustion; confirm with a b bullish bar.
- Harami Bull — Bullish two-bar reversal. Small bullish body inside prior large bearish body; confirmation required.
- Harami Bear — Bearish two-bar reversal. Small bearish body inside prior large bullish body.
- Harami Cross Bull — Bullish harami where the second bar is a doji; ber signal.
- Harami Cross Bear — Bearish harami cross; mirror of #12.
- Long White Body (Marubozu Long bullish) — Strong bullish momentum candle with tiny wicks; use as trend confirmation.
- Long Bear Body (Marubozu Long bearish) — Strong bearish momentum candle with tiny wicks; use as trend confirmation.
- Hammer — Bullish single-bar reversal with long lower wick after downtrend; confirm with next bullish close.
- Shooting Star — Bearish single-bar reversal with long upper wick after uptrend; confirm with bearish follow-through.
- Belt Hold Bull — Bullish one-bar reversal (open near low, close near high); indicates b buying interest.
- Belt Hold Bear — Bearish one-bar reversal (mirror of #18).
- Inverted Hammer Bullish — Bullish reversal with long upper wick after downtrend; confirm with bullish follow-through.
- Hanging Man Bearish — Bearish warning after uptrend; same shape as hammer but context differs; confirm with bearish close.
- Piercing Line Bull — Bullish two-bar reversal; second bar closes above midpoint of prior bearish body.
- Dark Cloud Cover — Bearish two-bar reversal; second bar closes below midpoint of prior bullish body.
- Tweezers Bull — Bullish tweezer bottom (matching lows); ber at support.
- Tweezers Bear — Bearish tweezer top (matching highs); ber at resistance.
- Homing Pigeon Bull — Bullish two-bar variant (harami-like) with specific wick/body relationships.
- Three Inside Down Bear — Bearish three-bar confirmation pattern; harami + confirmation.
- Three White Soldiers Bull — Strong bullish sequence of three long bullish candles; indicates sustained buying pressure.
- Three Black Crows Bear — Strong bearish sequence of three long bearish candles; indicates sustained selling pressure.
- Deliberation Bear — Bearish three-bar pattern showing loss of bullish momentum; watch for reversal.
- Three Outside Up Bull — Bullish three-bar confirmation (engulfing + confirmation).
- Three Outside Down Bear — Bearish three-bar confirmation (mirror of #31).
- Three Inside Up Bull — Bullish three-bar pattern (harami + confirmation).
- Three Inside Down Bear — Bearish three-bar pattern (mirror of #33).
- Three Star Bull — Sequence of three doji-like stars near a low; signals exhaustion of selling.
- Three Star Bear — Sequence of three doji-like stars near a high; signals exhaustion of buying.
- Three Line Strike Bull — Bullish reversal where three bearish bars are followed by a bullish bar that engulfs them.
- Three Line Strike Bear — Bearish mirror of #37.
- Meeting Lines Bull — Two-bar pattern where closes meet; bullish variant depends on context.
- Meeting Lines Bear — Bearish variant of meeting lines.
- Matching Low Bull — Two bars with matching lows; bullish implication at support.
- Upside Gap Two Crows Bear — Gap-up followed by two bearish bars; signals reversal.
- Unique Three River Bottom Bull — Multi-bar bottoming formation with specific wick/body relationships; bullish.
- Two Crows Bear — Two bearish bars following a bullish bar (gap-based); bearish reversal.
- Upside Tasuki Gap Bull — Gap-up continuation pattern; bullish continuation when the gap remains unfilled.
- Downside Tasuki Gap Bear — Bearish mirror of #45.
- Upside Gap Three Method Bull — Bullish continuation: b candle, small counter candles, then continuation candle.
- Downside Gap Three Method Bear — Bearish mirror of #47.
- Kicking Bull — Strong gap-based bullish reversal (opposite-color marubozu); high momentum.
- Kicking Bear — Strong gap-based bearish reversal (mirror of #49).
- Breakaway Bull — Multi-bar breakaway from congestion; bullish when context supports it.
- Breakaway Bear — Bearish breakaway (mirror of #51).
- Concealing Baby Swallow Bull — Complex bullish pattern where a small candle is concealed and followed by bullish confirmation.
- Thrusting Line Bear — Bearish nuance: a bearish candle that closes into prior bullish body but not fully engulfing; weaker reversal.
- Abandoned Baby Bull — Rare, high-significance bullish reversal: gap down → isolated doji → gap up; b when present.
- Abandoned Baby Bear — Rare bearish mirror of #55.
- On Neck Line Bear — Bearish continuation nuance: second candle closes near prior low but slightly above; indicates continued selling pressure.
- In Neck Line Bear — Bearish nuance similar to On Neck but with slightly different close placement; indicates bearish pressure continuing.
Fully annotated extract — RecognizeCandle(...)
void RecognizeCandle(string symbol,ENUM_TIMEFRAMES period,datetime time,int aver_period,Candle_Structure &res)
{
//--- Ensure price arrays are current (copies OHLC/time into cp.Op, cp.Hi, cp.Lo, cp.Cl)
cp.UpdatePrice(cp.arper); // <-- refresh internal price arrays used by the function
//--- Find the bar index that matches the requested timestamp on the given timeframe
int bar=iBarShift(symbol,period,time,false); // <-- map timestamp to series index (series is set as "as series")
//--- Read raw OHLC and time into the result structure
res.open=cp.Op[bar]; // <-- open price of the bar
res.high=cp.Hi[bar]; // <-- high price of the bar
res.low=cp.Lo[bar]; // <-- low price of the bar
res.close=cp.Cl[bar]; // <-- close price of the bar
res.time=cp.Tm[bar]; // <-- bar timestamp
//--- Determine direction of the bar (trend for that single candle)
if(res.open<res.close) res.trend=Rise; // <-- bullish candle
else if(res.open>res.close) res.trend=Down; // <-- bearish candle
else res.trend=Lateral; // <-- open == close (doji / lateral)
//--- Boolean flag for bullish vs bearish (used by other logic)
res.bull=res.close>=res.open; // <-- true for bullish or neutral close
//--- Body size and full range
res.bodysize=fabs(res.open-res.close); // <-- absolute body size (pips/price units)
res.HiLo=res.high-res.low; // <-- total candle range (high-low)
//--- Compute shadow sizes (lower and upper) relative to body
res.shlow=res.close-res.low; // <-- default lower shadow (for bearish orientation)
res.shigh=res.high-res.open; // <-- default upper shadow (for bearish orientation)
if(res.bull)
{
// <-- if bullish, shadows are measured relative to open/close swapped positions
res.shlow=res.open-res.low; // <-- lower shadow for bullish candle
res.shigh=res.high-res.close; // <-- upper shadow for bullish candle
}
//--- Classify wick sizes using multiples of body size
if(res.shigh>res.bodysize*2) res.hiwick=Long_Wick; // <-- very long upper wick
if(res.shigh<res.bodysize*2 && res.shigh>res.bodysize*0.16) res.hiwick=Small_Wick; // <-- moderate upper wick
if(res.shigh<res.bodysize*0.1) res.hiwick=Tiny_Wick; // <-- tiny upper wick
if(res.shlow>res.bodysize*2) res.lowick=Long_Wick; // <-- very long lower wick
if(res.shlow<res.bodysize*2 && res.shlow>res.bodysize*0.16) res.lowick=Small_Wick; // <-- moderate lower wick
if(res.shlow<res.bodysize*0.1) res.lowick=Tiny_Wick; // <-- tiny lower wick
//--- Calculate average body size across the configured averaging window
double sumavgbody=0.0;
for(int i=cp.avbars-1; i>=1; i--)
sumavgbody=sumavgbody+fabs(cp.Op[i]-cp.Cl[i]); // <-- sum of absolute bodies for previous bars
double avgbody=sumavgbody/aver_period; // <-- average body used as dynamic threshold
//--- Determine base candlestick type using body vs average body
if(res.bodysize>avgbody*1.35) {res.type=Cand_Long; res.bclr=Clr_Long;} // <-- long body
if(res.bodysize>avgbody*1.0 && res.bodysize<=avgbody*1.35) {res.type=Cand_Median; res.bclr=Clr_Long;} // <-- median
if(res.bodysize>=avgbody*0.5 && res.bodysize<=avgbody*1.0) {res.type=Cand_Short; res.bclr=Clr_Short;} // <-- short
if(res.bodysize<avgbody*0.5) {res.type=Cand_Mini; res.bclr=Clr_Star;} // <-- mini / small body
//--- Doji detection (very small body relative to full range or lateral bar)
if(res.bodysize<res.HiLo*0.03 || res.trend==Lateral) {res.type=Cand_Doji; res.bclr=Clr_Doji;} // <-- doji or near-doji
//--- Marubozu detection (tiny wick on one side + non-zero body)
if((res.lowick==Tiny_Wick || res.hiwick==Tiny_Wick) && res.bodysize>0)
{
if(res.type==Cand_Long)
{res.type=Cand_Maribozu_Long; res.bclr=Clr_Maribozu_Long;} // <-- long marubozu
else
if(res.type==Cand_Median)
{res.type=Cand_Maribozu; res.bclr=Clr_Maribozu_Long;} // <-- marubozu variant
}
//--- Hammer detection (mini body + long lower wick + tiny upper wick)
if(res.type==Cand_Mini && res.lowick==Long_Wick && res.hiwick==Tiny_Wick) {res.type=Cand_Hammer; res.bclr=Clr_Hammer;}
//--- Inverted hammer detection (mini body + long upper wick + tiny lower wick)
if(res.type==Cand_Mini && res.lowick==Tiny_Wick && res.hiwick==Long_Wick) {res.type=Cand_Invert_Hammer; res.bclr=Clr_Invert_Hammer;}
//--- Spinning top detection (mini body with both shadows larger than body)
if(res.type==Cand_Mini && res.shlow>res.bodysize && res.shigh>res.bodysize) {res.type=Cand_Spin_Top; res.bclr=Clr_Spin_Top;}
//--- Star detection (mini body with one small and one tiny wick combination)
if(res.type==Cand_Mini && ((res.lowick==Small_Wick||res.hiwick==Tiny_Wick)||(res.lowick==Tiny_Wick||res.hiwick==Small_Wick)))
{res.type=Cand_Star; res.bclr=Clr_Star;}
//--- Return: res is filled with OHLC, body, wicks, type, trend, and color index
return;
}
***Copyright © 2026 3rjfx ~ For educational purposes only.***
The Reality of Trading: Probability, Not Certainty
Key point:
It is important to understand that the FCP for MT5 is a tool for statistical probability, not a magic crystal ball. Based on extensive tests in the Strategy Tester, candlestick patterns should be viewed as benchmarks or potential price action signals that require further validation. In trading, there is no such thing as 100% accuracy. Therefore, always combine FCP with proper risk management and other technical filters like trend and momentum indicators to increase your winning edge.
Candlestick patterns are statistical signals, not guaranteed predictions. They describe how price has behaved recently and estimate the likelihood of a particular short-term directional move, but they do not force the market to move in any direction.
Why patterns are probabilistic?
Market context varies. The same pattern can behave differently depending on timeframe, volatility, liquidity, news events, and nearby support or resistance. A pattern that worked repeatedly on a daily chart may produce many false signals on a one-minute chart.
Patterns encode structure, not certainty. A pattern like Three Outside Up or Engulfing Bull highlights a change in buyer-seller balance, but it does not guarantee follow-through. The pattern increases the probability of bullish continuation or reversal; it does not create it.
Example from Strategy Tester screenshot
1. This screenshot below shows a detected pattern labeled Three Outside Up on AUD/USD M1 with a trigger price and bar details. That detection is a valid pattern match, but in the Strategy Tester we observed that not every match produced a profitable move. This is expected: pattern detection is a probabilistic filter that must be combined with confirmation and risk controls.
2. This screenshot below shows a detected pattern labeled Maribozu Long Bearish on AUD/USD M1 with a trigger price and bar details. That detection is a valid pattern match, but in the Strategy Tester we observed that not every match produced a profitable move. This is expected: pattern detection is a probabilistic filter that must be combined with confirmation and risk controls.
How to treat FCP signals in practice
- Use confirmation — wait for the next candle to close beyond the indicator’s trigger price or use an additional confirmation signal such as a momentum oscillator, volume spike, or a break of a nearby structure.
- Consider timeframe and volatility — higher timeframes generally produce more reliable patterns; lower timeframes are noisier and require tighter risk management.
- Backtest and forward-test — measure hit rate, average win/loss, and expectancy across instruments and sessions before trading live.
- Apply position sizing — treat each signal as a probabilistic edge and size positions so that a string of losses does not threaten your account.
- Filter by context — prefer patterns that occur at support/resistance, trend confluence, or after volatility contraction rather than trading every detected pattern blindly.
Practical checklist for evaluating a pattern signal
- Is the pattern on a higher timeframe? If yes, it is more meaningful.
- Does the next candle confirm the trigger? Wait for confirmation when possible.
- Are there nearby structural levels? Support, resistance, trendlines, or pivot points add weight.
- Is spread and slippage acceptable? On low timeframes, spread can turn a valid signal into a losing trade.
- Is there a clear stop and target? Define them before entering and stick to your plan.
Strategy Tester Backtest Checklist — metrics and procedures
Use this checklist to evaluate the real edge and robustness of FCP signals across instruments and timeframes.
1. Test setup and environment
- Data quality: use high-quality tick or 1-minute data for accurate simulation of spreads and slippage.
- Model: choose Every tick for the most realistic results when testing intraday patterns.
- Spread handling: test with both current market spread and a fixed spread scenario to measure sensitivity.
- Commission and slippage: include realistic commission and slippage values matching your broker.
2. Metrics to collect
| Metric | Why it matters |
|---|---|
| Hit rate (wins / total signals) | Shows how often a pattern leads to a profitable trade before costs. |
| Average win / average loss | Measures reward-to-risk per trade; critical for expectancy. |
| Expectancy = (HitRate * AvgWin) - ((1-HitRate) * AvgLoss) | Core profitability metric per trade. |
| Profit factor (gross profit / gross loss) | Shows overall profitability resilience to losing streaks. |
| Max drawdown | Risk tolerance and capital requirement indicator. |
| Average trade duration | Helps size positions and choose timeframes. |
| Signals per month / per timeframe | Operational cadence and sample size for statistical confidence. |
| Slippage & spread sensitivity | Shows how fragile the edge is to execution costs. |
| Sharpe ratio / Sortino ratio | Risk-adjusted performance measures for strategy comparison. |
3. Testing procedure
- Baseline run: run the indicator-only scan in the Strategy Tester to log every detected signal with timestamp, pattern name, pattern code, trigger price, and bar close price.
- Define entry rule: require the next candle to close beyond the trigger price or use a fixed entry offset (e.g., entry = trigger + 1 pip for buys).
- Define stop and target: use fixed R:R (e.g., 1:1, 1:2) and also test ATR-based stops to compare robustness.
- Run parameter sweep: vary
avg_period, confirmation rule (next-bar close vs immediate), and timeframe to find stable regions. - Collect raw signal log: export CSV with columns: timestamp, symbol, timeframe, pattern_name, pattern_code, trigger_price, entry_price, stop, target, result, pips, duration.
- Analyze by context: segment results by trend (above/below moving average), by proximity to support/resistance, and by session (London, New York, Asian).
- Robustness checks: test with increased spread, added slippage, and on out-of-sample periods to detect overfitting.
- Statistical confidence: ensure sample size is large enough; use at least several hundred signals per instrument/timeframe for meaningful statistics.
4. Practical rules to derive a trading plan
- Only trade patterns with positive expectancy after costs and realistic slippage.
- Combine with context filters such as trend direction, support/resistance, or momentum confirmation to improve hit rate.
- Use position sizing based on volatility and drawdown tolerance rather than fixed lot sizes.
- Keep a signal log and review monthly to detect regime changes or degradation in performance.
Strategic Combination: The Triple Threat
To achieve maximum consistency, I recommend combining FCP with the tools we discussed in articles previously:
- 1. Trend Identification: Use MAW_MTF indicator to determine the overall market direction.
- 2. Momentum Validation: Check StochDegree indicator to ensure the market isn't overextended.
- 3. The Entry (The Trigger): Use SPM_MTF indicator to find the perfect candlestick confirmation to enter the trade.
Conclusion
“Candlestick patterns detected by FCP are probabilistic signals. They increase the likelihood of a directional move but are not guarantees. Always require confirmation, manage risk, and test across timeframes and instruments.”
Trading success isn't about finding a "Holy Grail"; it's about having a disciplined system. By integrating the Forex Candlestick Patterns (FCP) indicator into your workflow, you are trading with data-driven confidence rather than guesswork.
⚠️ Important: Risk Disclaimer
- Demo Testing: You are strongly advised to test this indicator on an MT5 Demo Account.
- Real Account Trading: If you proceed to use this indicator for automated trading on a Real Account, you do so at your own risk. Algorithmic trading involves substantial risk to your capital.
- Always remember the rules: Never trade with money you cannot afford to lose.
- Trading foreign exchange on margin carries a high level of risk and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in foreign exchange, you should carefully consider your investment objectives, level of experience, and risk appetite.
- The FCP indicator logic provided in this article are for educational purposes and do not guarantee profits. Past performance is not indicative of future results.
- For more details, please read our full Risk Disclaimer and Terms of Service.
Vital Records
We hope this article and the Forex Candlestick Patterns (FCP) for MT5 indicator program will be useful for traders in learning and generating new ideas, thereby will be able improving your trading performance.
See you in the next article on Expert Advisor programs or indicators for MetaTrader 4 and MetaTrader 5 or Phyton program.
If you have any ideas for developing this indicator program or have a new ideas, please leave your comments below this article.
Thanks for reading this article.
Explore more algorithmic trading resources:
- Content Sitemap – All articles and pages.
- Categories – Browse by topic (Indicators, EA, Python, etc).
Note: Please see the source program and download at the bottom of this article.
Risk Warning: Trading Forex and CFDs involves significant risk and may not be suitable for all investors. All content provided is for educational purposes only and does not constitute financial advice.
//+------------------------------------------------------------------+
//| FCP.mq5 |
//| Copyright 2026, Roberto Jacobs (3rjfx) ~ Date: 2026-04-13 |
//| https://www.mql5.com/en/users/3rjfx |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Roberto Jacobs (3rjfx) ~ Date: 2026-04-13"
#property link "https://www.mql5.com/en/users/3rjfx"
#property version "1.00"
#property strict
#property description "FCP is the Forex Candlestick Patterns indicator with alert based on"
#property description "Japanese Candlestick Strategies by the legendary Japanese Munehisa Homma,"
#property description "which can help traders penetrate price action inside of financial markets."
//--
#property indicator_chart_window
#property indicator_plots 2
#property indicator_buffers 2
//---
#include <Trade\SymbolInfo.mqh>
CSymbolInfo m_symbol;
//--
enum corner
{
LeftHand=0,
RightHand=1
};
//--
enum YN
{
No,
Yes
};
//---
input group "==== Input Indicator Properties ===="
input int avg_period = 7; // Period of averaging
input corner cor = RightHand; // Corner Position
input color BuyColor = clrDodgerBlue; // Bullish Color
input color SellColor = clrOrangeRed; // Bearish Color
input color clrNT = clrYellow; // Candle Flat Color
input color clrDOW = clrCrimson; // Day of Week Color
input color clrfont = clrSnow; // Font Color
input color clrtime = clrLime; // Time Color
input group "==== Input parameters for alerts ===="
input YN UseAlert = Yes; // Display Alerts Pop-up on Chart (Yes) or (No)
input YN UseEmailAlert = No; // Email Alert (Yes) or (No)
input YN UseSendnotify = No; // Send Notification (Yes) or (No)
//---
//---------//
//+------------------------------------------------------------------+
//| class for Forex Candlestick Patterns indicator |
//+------------------------------------------------------------------+
class FCP
{
//---
public:
//--
//-- buffers
double Hi[],
Op[],
Lo[],
Cl[];
datetime Tm[];
double FCPUp[],
FCPDw[];
//--
datetime ctime,
ptime,
tms1;
//--
int cal,
pal,
nbb1,
nbs1,
xdis,
ydis,
patx,
paty,
xpip,
dgts,
arper,
avbars,
GMM_bars;
//--
double pip,
space,
point,
e_ask,
e_bid,
askbid,
e_pread;
//--
long CId;
//--
string indname,
days[],
patname[];
//--
color barclr,
barcolor[],
cancolor[];
//--
ENUM_BASE_CORNER encorner;
ENUM_ANCHOR_POINT enanchor;
ENUM_TIMEFRAMES TFcp;
//---
//------------
FCP(void);
~FCP(void);
//---
virtual void FCP_Config(void);
//--
void UpdatePrice(int bars=0);
void RefreshPrice(int bars);
void CurrentSymbolSet(void);
void Pips(void);
void Do_Alerts(string msg);
void CreateModel(long chart_id,
string lable_name,
string label_text,
string font_model,
int font_size,
color label_color,
int chart_corner,
int chart_anchor,
int x_cor,
int y_cor);
void DrawSignal(string txtprice,
datetime bartm,
double barprc,
double triprc,
double dspread,
string txtbar,
string txtpatt,
string txtdirect,
string txttrig,
color sigclr);
void CreateLabel(long chart_id,
string lable_name,
string label_text,
string font_model,
int font_size,
color label_color,
int chart_corner,
int x_cor,
int y_cor);
void CreateText(long chart_id,
string text_name,
datetime txt_time,
double txt_price,
string label_text,
string font_model,
int font_size,
color text_color,
int anchor);
//--
bool RefreshTick(void);
//--
int ThisTime(const int reqmode);
//--
string strTF(ENUM_TIMEFRAMES period);
string getUninitReasonText(int reasonCode);
//---
}; //-end class FCP()
//---------//
FCP cp;
//+------------------------------------------------------------------+
//| Constructor |
//+------------------------------------------------------------------+
FCP::FCP(void): ydis(90),
paty(214),
arper(100),
CId(ChartID()),
indname("FCP"),
TFcp(Period())
{
}
//---------//
//+------------------------------------------------------------------+
//| Destructor |
//+------------------------------------------------------------------+
FCP::~FCP(void)
{
}
//---------//
void FCP::FCP_Config(void)
{
//---
//--
if(cor==LeftHand)
{
encorner=CORNER_LEFT_UPPER;
enanchor=ANCHOR_LEFT_UPPER;
xdis=95;
patx=10;
}
else
{
encorner=CORNER_RIGHT_UPPER;
enanchor=ANCHOR_RIGHT_UPPER;
xdis=190;
patx=10;
}
//--
//-- Checking the Digits Point
Pips();
if(dgts==3||dgts==5) { space=0.15*pip; }
else if(dgts==2||dgts==4) { space=1.5*pip; }
//--
avbars=avg_period+1;
UpdatePrice(arper);
ptime=Tm[1];
GMM_bars=iBars(Symbol(),TFcp);
//--
ArrayResize(cp.FCPUp,GMM_bars,GMM_bars);
ArrayResize(cp.FCPDw,GMM_bars,GMM_bars);
ArraySetAsSeries(cp.FCPUp,true);
ArraySetAsSeries(cp.FCPDw,true);
ArrayInitialize(FCPUp,0.0);
ArrayInitialize(FCPDw,0.0);
//--
string daysx[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
string patnamex[]={"MARIBOZU","DOJI","SPINNING TOP","HAMMER","TURN HAMMER","LONG","SHORT","STAR"};
color barcolorx[]={clrAqua,clrDeepPink,clrMagenta,clrAquamarine,clrMediumOrchid,clrYellow,clrLightCoral,clrCrimson};
color cancolorx[]={clrAqua,clrAqua,clrDeepPink,clrMagenta,clrAquamarine,clrMediumOrchid,clrYellow,clrYellow,clrLightCoral,clrCrimson,clrCrimson};
//--
ArrayCopy(days,daysx,0,0,WHOLE_ARRAY);
ArrayCopy(patname,patnamex,0,0,WHOLE_ARRAY);
ArrayCopy(barcolor,barcolorx,0,0,WHOLE_ARRAY);
ArrayCopy(cancolor,cancolorx,0,0,WHOLE_ARRAY);
//--
return;
//---
} //-end FCP_Config()
//---------//
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
cp.FCP_Config();
//--- Indicator buffers mapping
SetIndexBuffer(0,cp.FCPUp,INDICATOR_DATA);
SetIndexBuffer(1,cp.FCPDw,INDICATOR_DATA);
PlotIndexSetString(0,PLOT_LABEL,"FCP_Rise");
PlotIndexSetString(1,PLOT_LABEL,"FCP_Down");
//--
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);
PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0);
//--
IndicatorSetString(INDICATOR_SHORTNAME,cp.indname);
IndicatorSetInteger(INDICATOR_DIGITS,cp.dgts);
//--
ChartSetInteger(cp.CId,CHART_MODE,CHART_CANDLES);
ChartSetInteger(cp.CId,CHART_FOREGROUND,0,false);
ChartSetInteger(cp.CId,CHART_COLOR_CHART_LINE,clrLime);
//--
for(int i=0; i<ArraySize(cp.patname); i++)
cp.CreateModel(cp.CId,cp.patname[i],cp.patname[i],"Arial Black",7,
cp.barcolor[i],cp.encorner,cp.enanchor,cp.patx,cp.paty+i*14);
//--
//---
return(INIT_SUCCEEDED);
} //-end OnInit()
//---------//
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
Comment("");
Print(cp.getUninitReasonText(reason));
ObjectsDeleteAll(cp.CId,-1,-1);
//--
ChartRedraw(cp.CId);
//---
return;
//---
} //-end OnDeinit()
//-------//
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int32_t rates_total,
const int32_t prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int32_t &spread[])
{
//---
ResetLastError();
ChartRedraw(cp.CId);
cp.Pips();
//--
//--- check for rates total
if(rates_total<cp.arper)
return(0);
//--
ArraySetAsSeries(time,true);
ArraySetAsSeries(open,true);
ArraySetAsSeries(high,true);
ArraySetAsSeries(low,true);
ArraySetAsSeries(close,true);
//--
cp.ctime=time[0];
if(cp.ctime!=cp.ptime)
cp.UpdatePrice(cp.avbars);
//--
cp.barclr=clrNT;
cp.e_ask=m_symbol.Ask();
cp.e_bid=m_symbol.Bid();
cp.askbid=cp.e_ask-cp.e_bid;
cp.e_pread = (cp.e_ask-cp.e_bid)/cp.pip;
int dayofweek=cp.ThisTime(TimeReturn(day_of_week));
//--
//--- create indicator labels time
cp.CreateLabel(cp.CId,"txDay",cp.days[dayofweek],"Verdana",14,clrDOW,cp.encorner,cp.xdis,cp.ydis);
cp.CreateLabel(cp.CId,"txTime",TimeToString(TimeCurrent(),TIME_DATE),"Verdana",10,clrtime,cp.encorner,cp.xdis,cp.ydis+21);
cp.CreateLabel(cp.CId,"txDate",TimeToString(TimeCurrent(),TIME_SECONDS),"Verdana",8,clrtime,cp.encorner,cp.xdis,cp.ydis+35);
//--
if(cp.ctime!=cp.ptime)
{
//--
cp.cal=0;
string pattern="";
string textbar="";
string trigger="";
string textprice="";
string direction="";
string pattalert="";
double barprice=0;
double trigprice=0;
datetime bartime=0;
color signalclr=0;
string exname="*"+cp.indname+": ";
string symtf=Symbol()+", TF: "+cp.strTF(Period());
//--
Candle_Structure bar1;
RecognizeCandle(Symbol(),cp.TFcp,time[1],cp.avbars,bar1);
Candle_Structure bar2;
RecognizeCandle(Symbol(),cp.TFcp,time[2],cp.avbars,bar2);
Candle_Structure bar3;
RecognizeCandle(Symbol(),cp.TFcp,time[3],cp.avbars,bar3);
Candle_Structure bar4;
RecognizeCandle(Symbol(),cp.TFcp,time[4],cp.avbars,bar4);
Candle_Structure bar5;
RecognizeCandle(Symbol(),cp.TFcp,time[5],cp.avbars,bar5);
//--
int Hies=iHighest(Symbol(),cp.TFcp,MODE_HIGH,6,0);
int Lows=iLowest(Symbol(),cp.TFcp,MODE_LOW,6,0);
int ibar=iBarShift(Symbol(),cp.TFcp,time[1],false);
string altime=", @ "+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
//--
//-- Bullish Bearish Candlestick Patterns
//-- 1. Doji Star Bull
if((bar2.trend==Down)&&(bar2.type==Cand_Long)&&(bar1.low<=cp.Lo[Lows])&&(bar1.bodysize<bar2.bodysize)&&
(bar1.open>=bar2.close)&&(bar1.HiLo<bar2.HiLo)&&(bar1.low>=bar2.low)&&(bar1.high<bar2.high)&&(bar1.type==Cand_Doji)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Doji_Star_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Doji Star Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=7;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==7)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 2. Doji Star Bear
else
if((bar2.trend==Rise)&&(bar2.type==Cand_Long)&&(bar1.high>=cp.Hi[Hies])&&(bar1.bodysize<bar2.bodysize)&&
(bar1.open<=bar2.close)&&(bar1.HiLo<bar2.HiLo)&&(bar1.low>bar2.low)&&(bar1.high<bar2.high)&&(bar1.type==Cand_Doji)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Doji_Star_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Doji Star Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-7;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-7)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 3. Engulfing Bull
else
if((bar2.trend==Down)&&(bar1.trend==Rise)&&(bar1.open==bar2.close)&&(bar1.high>bar2.high)&&(bar1.bodysize>bar2.bodysize)&&
(bar2.type==Cand_Median||bar2.type==Cand_Maribozu||bar2.type==Cand_Long||bar2.type==Cand_Maribozu_Long)&&
(bar2.hiwick==Small_Wick||bar2.hiwick==Tiny_Wick)&&(bar2.lowick==Small_Wick||bar2.lowick==Tiny_Wick)&&
(bar1.hiwick==Small_Wick||bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Small_Wick||bar1.lowick==Tiny_Wick)&&
(bar2.low<=cp.Lo[Lows]||bar1.low<=cp.Lo[Lows])&&(bar1.type==Cand_Long||bar1.type==Cand_Maribozu_Long))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Engulfing_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Engulfing Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=4;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==4)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 4. Engulfing Bear
else
if((bar2.trend==Rise)&&(bar1.trend==Down)&&(bar1.open==bar2.close)&&(bar1.low<bar2.low)&&(bar1.bodysize>bar2.bodysize)&&
(bar2.type==Cand_Median||bar2.type==Cand_Maribozu||bar2.type==Cand_Long||bar2.type==Cand_Maribozu_Long)&&
(bar2.hiwick==Small_Wick||bar2.hiwick==Tiny_Wick)&&(bar2.lowick==Small_Wick||bar2.lowick==Tiny_Wick)&&
(bar1.hiwick==Small_Wick||bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Small_Wick||bar1.lowick==Tiny_Wick)&&
(bar2.high>=cp.Hi[Hies]||bar1.high>=cp.Hi[Hies])&&(bar1.type==Cand_Long||bar1.type==Cand_Maribozu_Long))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Engulfing_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Engulfing Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-4;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-4)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 5. Morning Star Bull
else
if((bar3.trend==Down)&&(bar3.type==Cand_Long)&&(bar2.trend==Down)&&(bar2.type==Cand_Star)&&(bar1.trend==Rise)&&
(bar1.type==Cand_Maribozu || bar1.type==Cand_Maribozu_Long)&&(bar2.open<=bar3.close)&&(bar1.close<bar3.open)&&
(bar1.close>((bar3.open+bar3.close)/2))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Morning_Star_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Morning Star Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=12;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==12)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 6. Evening Star Bear
else
if((bar3.trend==Rise)&&(bar3.type==Cand_Long)&&(bar2.trend==Rise)&&(bar2.type==Cand_Star)&&(bar1.trend==Down)&&
(bar1.type==Cand_Maribozu || bar1.type==Cand_Maribozu_Long)&&(bar2.open>=bar3.close)&&(bar1.close>bar3.open)&&
(bar1.close<((bar3.close+bar3.open)/2))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Evening_Star_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Evening Star Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-12;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-12)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 7. Morning Doji Star Bull
else
if((bar3.trend==Down)&&(bar3.type==Cand_Long)&&(bar2.trend==Down)&&(bar2.type==Cand_Doji)&&(bar1.trend==Rise)&&
(bar1.type==Cand_Maribozu_Long || bar1.type==Cand_Maribozu)&&(bar2.open<=bar3.close)&&(bar1.close<bar3.open)&&
(bar1.close>((bar3.open+bar3.close)/2))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Morning_Doji_Star_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Morning Doji Star Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=13;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==13)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 8. Evening Doji Star Bear
else
if((bar3.trend==Rise)&&(bar3.type==Cand_Long)&&(bar2.trend==Rise)&&(bar2.type==Cand_Doji)&&(bar1.trend==Down)&&
(bar1.type==Cand_Maribozu_Long || bar1.type==Cand_Maribozu)&&(bar2.open>=bar3.close)&&(bar1.close>bar3.open)&&
(bar1.close<((bar3.close+bar3.open)/2))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Evening_Doji_Star_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Evening Doji Star Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-13;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-13)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 9. Three Star in the South Bull
else
if((bar3.trend==Down)&&(bar3.type==Cand_Long)&&(bar2.trend==Down)&&(bar2.type==Cand_Short || bar1.type==Cand_Star)&&
(bar1.trend==Down)&&(bar1.type==Cand_Maribozu || bar1.type==Cand_Star)&&(bar2.low>bar3.low)&&(bar3.low<=cp.Lo[Lows]&&
(bar3.high<cp.Hi[Hies])&&(bar1.low>bar2.low))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Long_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Three_Star_in_the_South_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Star in the South";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=14;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==14)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 10. Harami Bull
else
if((bar2.trend==Down)&&(bar2.type==Cand_Long)&&(bar2.low<=cp.Lo[Lows])&&(bar1.open>=bar2.close)&&(bar1.bodysize<bar2.bodysize)&&
(bar1.HiLo<bar2.HiLo)&&(bar1.low>bar2.low)&&(bar1.high<bar2.high)&&(bar1.trend==Rise)&&(bar1.type==Cand_Short)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Harami_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Harami Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=5;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==5)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 11. Harami Bear
else
if((bar2.trend==Rise)&&(bar2.type==Cand_Long)&&(bar2.high>=cp.Hi[Hies])&&(bar1.open<=bar2.close)&&(bar1.bodysize<bar2.bodysize)&&
(bar1.HiLo<bar2.HiLo)&&(bar1.low>bar2.low)&&(bar1.high<bar2.high)&&(bar1.trend==Down)&&(bar1.type==Cand_Short)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Harami_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Harami Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-5;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-5)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 12. Harami Cross Bull
else
if((bar2.trend==Down)&&(bar2.type==Cand_Long)&&(bar2.low<=cp.Lo[Lows])&&(bar1.open>=bar2.close)&&(bar1.bodysize<bar2.bodysize)&&
(bar1.HiLo<bar2.HiLo)&&(bar1.low>bar2.low)&&(bar1.high<bar2.high)&&(bar1.trend==Rise)&&(bar1.type==Cand_Doji)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Harami_Corss_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Harami Cross Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=6;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==6)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 13. Harami Cross Bear
else
if((bar2.trend==Rise)&&(bar2.type==Cand_Long)&&(bar2.high>=cp.Hi[Hies])&&(bar1.open<=bar2.close)&&(bar1.bodysize<bar2.bodysize)&&
(bar1.HiLo<bar2.HiLo)&&(bar1.low>bar2.low)&&(bar1.high<bar2.high)&&(bar1.trend==Down)&&(bar1.type==Cand_Doji)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Harami_Cross_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Harami Cross Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-6;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-6)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 14. Long White Body (Maribozu Long bullish model)
else
if((bar1.high<bar2.high)&&(bar1.trend==Rise)&&(bar1.low<=cp.Lo[Lows])&&(bar1.type==Cand_Maribozu_Long)&&
(bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Maribozu_Long_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Maribozu Long";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=1;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==1)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 15. Long Bear Body (Maribozu Long bearish model)
else
if((bar1.low>bar2.low)&&(bar1.trend==Down)&&(bar1.high>=cp.Hi[Hies])&&(bar1.type==Cand_Maribozu_Long)&&
(bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Maribozu_Long_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Maribozu Long";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-1;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-1)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 16. Hammer
else
if((bar1.high<bar2.high)&&(bar1.trend==Rise)&&(bar1.low<=cp.Lo[Lows])&&(bar1.type==Cand_Hammer)&&
(bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Long_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Hammer_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Hammer";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=2;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==2)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 17. Shooting Star
else
if((bar1.low>bar2.low)&&(bar1.trend==Down)&&(bar1.high>=cp.Hi[Hies])&&(bar1.type==Cand_Invert_Hammer)&&
(bar1.hiwick==Long_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Shooting_Star_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Shooting Star";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-2;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-2)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 18. Belt Hold Bull
else
if((bar1.high<bar2.low)&&(bar1.trend==Rise)&&(bar1.low<=cp.Lo[Lows])&&(bar1.type==Cand_Long || bar1.type==Cand_Maribozu_Long)&&
(bar1.bodysize>bar2.bodysize)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Belt_Hold_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Belt Hold";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=3;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==3)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 19. Belt Hold Bear
else
if((bar1.low>bar2.high)&&(bar1.trend==Down)&&(bar1.high>=cp.Hi[Hies])&&(bar1.type==Cand_Long || bar1.type==Cand_Maribozu_Long)&&
(bar1.bodysize>bar2.bodysize)&&(bar1.hiwick==Tiny_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Belt_Hold_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Belt Hold";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-3;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-3)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 20. Inverted Hammer Bullish model
else
if((bar1.trend==Rise)&&(bar1.low<=cp.Lo[Lows])&&(bar1.type==Cand_Invert_Hammer)&&
(bar1.high>bar2.high)&&(bar1.hiwick==Long_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Inverted_Hammer_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Inverted Hammer";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=22;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==22)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 21. Hanging Man Bearish model
else
if((bar1.trend==Down)&&(bar1.high>=cp.Hi[Hies])&&(bar1.type==Cand_Hammer)&&
(bar1.low<bar2.low)&&(bar1.lowick==Long_Wick)&&(bar1.hiwick==Tiny_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Hanging_Man_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Hanging Man Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-22;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-22)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 22. Piercing Line Bull
else
if((bar2.trend==Down)&&(bar2.type==Cand_Long)&&(bar2.low<=cp.Lo[Lows])&&(bar1.open==bar2.close)&&
(bar1.close>(bar2.open+bar2.low)/2)&&(bar1.trend==Rise)&&(bar1.type==Cand_Long)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Piercing_Line_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Piercing Line Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=8;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==8)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 23. Dark Cloud Cover
else
if((bar2.trend==Rise)&&(bar2.type==Cand_Long)&&(bar2.high>=cp.Hi[Hies])&&(bar1.open==bar2.close)&&
(bar1.close<(bar2.open+bar2.low)/2)&&(bar1.trend==Down)&&(bar1.type==Cand_Long)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Dark_Cloud_Cover_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Dark Cloud Cover Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-8;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-8)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 24. Tweezers Bull
else
if((bar2.trend==Down)&&(bar2.type==Cand_Long)&&(bar1.low==bar2.low)&&(bar1.open>bar2.close)&&(bar1.trend==Rise)&&
(bar1.type==Cand_Short)&&(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Tweezers_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Tweezers Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=9;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==9)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 25. Tweezers Bear
else
if((bar2.trend==Rise)&&(bar2.type==Cand_Long)&&(bar1.high==bar2.high)&&(bar1.open<=bar2.close)&&(bar1.trend==Down)&&
(bar1.type==Cand_Short)&&(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Tweezers_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Tweezers Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-9;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-9)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 26. Homing Pigeon Bull
else
if((bar2.trend==Down)&&(bar2.type==Cand_Long)&&(bar1.trend==Down)&&(bar1.type==Cand_Short)&&(bar2.low<=cp.Lo[Lows])&&
(bar1.bodysize<bar2.bodysize)&&(bar1.open>bar2.close)&&(bar1.low>bar2.close)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Homing_Pigeon_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Homing Pigeon Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=10;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==10)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 27. Three Inside Down Bear
else
if((bar3.trend==Rise)&&(bar3.type==Cand_Long)&&(bar2.trend==Down)&&(bar2.type==Cand_Short)&&(bar1.trend==Down)&&(bar1.type==Cand_Long)&&
(bar2.bodysize<bar3.bodysize)&&(bar1.bodysize>bar2.bodysize)&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Three_Inside_Down_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Inside Down";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-10;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-10)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 28. Three White Soldier Bull
else
if(((bar3.trend==Rise)&&(bar2.trend==Rise)&&(bar1.trend==Rise))&&(((bar3.type==Cand_Maribozu)&&(bar2.type==Cand_Maribozu)&&
(bar1.type==Cand_Maribozu))||((bar3.type==Cand_Maribozu_Long)&&(bar2.type==Cand_Maribozu_Long)&&(bar1.type==Cand_Maribozu_Long)))&&
(bar3.low<=cp.Lo[Lows]&&(bar3.open<bar4.close)&&(bar2.open<bar3.close)&&
(bar1.open<bar2.close)&&(bar3.lowick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.lowick==Small_Wick)))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Three_White_Soldier_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three White Soldier";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=11;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==11)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 29. Three Black Crows Bear
else
if(((bar3.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Down))&&(((bar3.type==Cand_Maribozu)&&(bar2.type==Cand_Maribozu)&&
(bar1.type==Cand_Maribozu))||((bar3.type==Cand_Maribozu_Long)&&(bar2.type==Cand_Maribozu_Long)&&(bar1.type==Cand_Maribozu_Long)))&&
(bar3.high>=cp.Hi[Hies]&&(bar3.open>bar4.close)&&(bar2.open>bar3.close)&&
(bar1.open>bar2.close)&&(bar3.hiwick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&(bar1.hiwick==Small_Wick)))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Three Black Crows_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Black Crows";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish Reversal";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-11;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-11)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 30. Deliberation Bear
else
if((bar3.trend==Rise)&&(bar3.type==Cand_Long)&&(bar2.trend==Rise)&&(bar2.type==Cand_Long)&&(bar1.trend==Rise)&&
(bar1.type==Cand_Star || bar1.type==Cand_Spin_Top)&&(bar2.open<=bar3.close)&&(bar1.open>bar2.close)&&
(bar3.low>cp.Lo[Lows])&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Tiny_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Deliberation_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Deliberation Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-14;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-14)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 31. Three Outside Up Bull
else
if((bar3.trend==Down)&&(bar2.trend==Rise)&&(bar1.trend==Rise)&&(bar2.open>=bar3.close)&&(bar2.low>=bar3.low)&&(bar2.high>bar3.high)&&
(bar2.close>bar3.open)&&(bar2.bodysize>bar3.bodysize)&&(bar1.open>=bar2.close)&&(bar1.close>bar2.high)&&
(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&
(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Three_Outside_Up_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Outside Up";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=15;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==15)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 32. Three Outside Down Bear
else
if((bar3.trend==Rise)&&(bar2.trend==Down)&&(bar1.trend==Down)&&(bar2.open<=bar3.close)&&(bar2.high<=bar3.high)&&(bar2.low<bar3.low)&&
(bar2.close<bar3.open)&&(bar2.bodysize>bar3.bodysize)&&(bar1.open<=bar2.close)&&(bar1.close<bar2.low)&&
(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&
(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Three_Outside_Down_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Outside Down";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-15;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-15)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 33. Three Inside Up Bull
else
if((bar3.trend==Down)&&(bar3.type==Cand_Long)&&(bar2.trend==Rise)&&(bar2.type==Cand_Short)&&(bar1.trend==Rise)&&
(bar1.type==Cand_Long)&&(bar2.low<=cp.Lo[Lows])&&(bar2.close<((bar3.open+bar3.close)/2.0))&&
(bar1.close>fmax(bar2.high,bar3.high))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&
(bar2.hiwick==Long_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Three_Inside_Up_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Inside Up";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=16;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==16)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 34. Three Inside Down Bear
else
if((bar3.trend==Rise)&&(bar3.type==Cand_Long)&&(bar2.trend==Down)&&(bar2.type==Cand_Short)&&(bar1.trend==Down)&&
(bar1.type==Cand_Long)&&(bar2.high>=cp.Hi[Hies])&&(bar2.close>((bar3.close+bar3.open)/2))&&
(bar1.close<fmin(bar2.low,bar3.low))&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Long_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Three_Inside_Down_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Inside Down";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-16;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-16)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 35. Three Star Bull
else
if((bar3.type==Cand_Doji)&&(bar2.type==Cand_Doji)&&(bar1.type==Cand_Doji)&&(bar2.low<=cp.Lo[Lows])&&
(bar1.open==bar2.open)&&(bar2.open==bar3.open))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Three_Star_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Star Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=17;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==17)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 36. Three Star Bear
else
if((bar3.type==Cand_Doji)&&(bar2.type==Cand_Doji)&&(bar1.type==Cand_Doji)&&(bar2.high>=cp.Hi[Hies])&&
(bar1.open==bar2.open)&&(bar2.open==bar3.open))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Three_Star_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Star Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-17;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-17)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 37. Three Line Strike Bull
else
if((bar4.type==Cand_Long)&&(bar3.type==Cand_Long)&&(bar2.type==Cand_Long)&&(bar1.type==Cand_Long)&&
(bar4.trend==Rise)&&(bar3.trend==Rise)&&(bar2.trend==Rise)&&(bar1.trend==Down)&&
(bar1.open==bar2.close)&&(bar1.close<bar4.low)&&(bar2.high>=cp.Hi[Hies])&&
(bar4.hiwick==Small_Wick)&&(bar4.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Three_Line_Strike_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Line Strike Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish Reversal";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=18;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==18)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 38. Three Line Strike Bear
else
if((bar4.type==Cand_Long)&&(bar3.type==Cand_Long)&&(bar2.type==Cand_Long)&&(bar1.type==Cand_Long)&&
(bar4.trend==Down)&&(bar3.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Rise)&&
(bar1.open==bar2.close)&&(bar1.close>bar4.high)&&(bar2.low<=cp.Lo[Lows])&&
(bar4.hiwick==Small_Wick)&&(bar4.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Three_Line_Strike_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Three Line Strike Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-18;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-18)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 39. Meeting Lines the bullish model
else
if((bar1.trend==Rise)&&(bar2.trend==Down)&&(bar1.type==Cand_Long)&&(bar2.type==Cand_Long)&&
(bar1.open<bar2.low)&&(bar1.close==bar2.close)&&(bar1.bodysize>bar2.bodysize))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Meeting_Lines_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Meeting Lines Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=19;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==19)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 40. Meeting Lines, the bearish model
else
if((bar1.trend==Down)&&(bar2.trend==Rise)&&(bar1.type==Cand_Long)&&(bar2.type==Cand_Long)&&
(bar1.open>bar2.high)&&(bar1.close==bar2.close)&&(bar1.bodysize>bar2.bodysize))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Meeting_Lines_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Meeting Lines Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-19;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-19)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 41. Matching Low, the bullish model
else
if((bar1.trend==Down)&&(bar2.trend==Down)&&(bar1.close==bar2.close)&&(bar1.open>bar2.close)&&
(bar1.bodysize<bar2.bodysize)&&(bar2.lowick==Tiny_Wick)&&(bar1.lowick==Tiny_Wick)&&
(bar2.hiwick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Matching_Low_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Matching Low Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=20;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==20)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 42. Upside Gap Two Crows, the bearish model
else
if((bar1.trend==Down)&&(bar2.trend==Down)&&(bar3.trend==Rise)&&(bar1.type==Cand_Long || bar1.type==Cand_Maribozu_Long)&&
(bar3.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&(bar2.type==Cand_Short)&&(bar1.bodysize>bar2.bodysize)&&
(bar2.open>bar3.high)&&(bar2.low>bar3.high)&&(bar1.open>bar2.high)&&(bar1.low<bar2.low)&&(bar1.close<bar2.close)&&
(bar1.low>bar3.high)&&(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Upside_Gap_Two_Crows_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Upside Gap Two Crows";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-20;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-20)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 43. Unique Three River Bottom, the Bullish model
else
if((bar3.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Rise)&&(bar3.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&
(bar2.type==Cand_Hammer)&&(bar1.type==Cand_Short)&&(bar2.low<=cp.Lo[Lows])&&(bar2.open>bar3.close)&&
(bar2.close>bar3.close)&&(bar1.open>bar3.close)&&(bar1.open<bar2.close)&&(bar1.close<bar2.close)&&(bar1.high>bar2.close)&&
(bar3.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Unique_Three_River_Bottom_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Unique Three River Bottom";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=21;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==21)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 44. Two Crows, the Bearish model
else
if((bar1.trend==Down)&&(bar2.trend==Down)&&(bar3.trend==Rise)&&(bar1.type==Cand_Long || bar1.type==Cand_Maribozu_Long)&&
(bar3.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&(bar2.type==Cand_Short)&&(bar1.bodysize>bar2.bodysize)&&
(bar2.open>bar3.high)&&(bar2.low>bar3.high)&&(bar1.open>bar2.close)&&(bar1.open<bar2.open)&&(bar1.close<bar3.close)&&
(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar2.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Two_Crows_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Two Crows";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-21;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-21)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 45. Upside Tasuki Gap Bullish model
else
if((bar3.trend==Rise)&&(bar2.trend==Rise)&&(bar1.trend==Down)&&(bar2.low>bar3.high)&&(bar1.open<bar2.close)&&(bar1.open>bar2.open)&&
(bar1.low>bar3.high)&&(bar1.close<=bar2.low)&&(bar3.type==Cand_Long)&&(bar2.type==Cand_Long)&&(bar1.type==Cand_Long)&&
(bar3.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Upside_Tasuki_Gap_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Upside Tasuki Gap";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=23;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==22)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 46. Downside Tasuki Gap Bearish model
else
if((bar3.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Rise)&&(bar2.high<bar3.low)&&(bar1.open>bar2.close)&&(bar1.open<bar2.open)&&
(bar1.high<bar3.low)&&(bar1.close<=bar2.high)&&(bar3.type==Cand_Long)&&(bar2.type==Cand_Long)&&(bar1.type==Cand_Long)&&
(bar3.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&
(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Downside_Tasuki_Gap_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Downside Tasuki Gap";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-23;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-22)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 47. Upside Gap Three Method Bullish model
else
if((bar3.trend==Rise)&&(bar2.trend==Rise)&&(bar1.trend==Down)&&(bar2.open>bar3.high)&&(bar1.open<bar2.close)&&(bar1.open>bar2.open)&&
(bar1.close<bar3.close)&&(bar3.type==Cand_Long)&&(bar2.type==Cand_Long)&&(bar1.type==Cand_Long)&&(bar3.lowick==Small_Wick)&&
(bar3.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Upside_Tasuki_Gap_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Upside Tasuki Gap";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=24;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==23)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 48. Downside Gap Three Method Bearish model
else
if((bar3.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Rise)&&(bar2.open<bar3.low)&&(bar1.open>bar2.close)&&(bar1.open<bar2.open)&&
(bar1.close>bar3.close)&&(bar3.type==Cand_Long)&&(bar2.type==Cand_Long)&&(bar1.type==Cand_Long)&&(bar3.lowick==Small_Wick)&&
(bar3.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Downside_Tasuki_Gap_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Downside Tasuki Gap";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-24;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-23)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 49. Kicking Bullish model
else
if((bar2.trend==Down)&&(bar1.trend==Rise)&&(bar1.open>bar2.high)&&(bar2.type==Cand_Maribozu_Long || bar2.type==Cand_Maribozu)&&
(bar1.type==Cand_Maribozu_Long || bar1.type==Cand_Maribozu)&&(bar2.lowick==Tiny_Wick)&&(bar2.hiwick==Tiny_Wick)&&
(bar1.lowick==Tiny_Wick)&&(bar1.hiwick==Tiny_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Kicking_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Kicking Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=25;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==24)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 50. Kicking Bearish model
else
if((bar2.trend==Rise)&&(bar1.trend==Down)&&(bar1.open<bar2.low)&&(bar2.type==Cand_Maribozu_Long || bar2.type==Cand_Maribozu)&&
(bar1.type==Cand_Maribozu_Long || bar1.type==Cand_Maribozu)&&(bar2.lowick==Tiny_Wick)&&(bar2.hiwick==Tiny_Wick)&&
(bar1.lowick==Tiny_Wick)&&(bar1.hiwick==Tiny_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Kicking_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Kicking Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-25;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-24)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 51. Breakaway Bullish model
else
if((bar5.trend==Down)&&(bar4.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Rise)&&(bar5.type==Cand_Long)&&(bar4.type==Cand_Short)&&
(bar3.type==Cand_Short)&&(bar2.type==Cand_Short)&&(bar1.type==Cand_Long)&&(bar4.open<bar5.low)&&(bar3.low<=cp.Lo[Lows])&&
(bar1.open>=bar2.close)&&(bar1.close<bar5.close)&&(bar5.lowick==Small_Wick)&&(bar5.hiwick==Small_Wick)&&(bar4.lowick==Small_Wick)&&
(bar4.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Kicking_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Kicking Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=25;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==25)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 52. Breakaway Bearish model
else
if((bar5.trend==Rise)&&(bar4.trend==Rise)&&(bar2.trend==Rise)&&(bar1.trend==Down)&&(bar5.type==Cand_Long)&&(bar4.type==Cand_Short)&&
(bar3.type==Cand_Short)&&(bar2.type==Cand_Short)&&(bar1.type==Cand_Long)&&(bar4.open>bar5.high)&&(bar3.low>=cp.Hi[Hies])&&
(bar1.open<=bar2.close)&&(bar1.close>bar5.close)&&(bar5.lowick==Small_Wick)&&(bar5.hiwick==Small_Wick)&&(bar4.lowick==Small_Wick)&&
(bar4.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar3.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar2.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Kicking_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Kicking Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-25;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-25)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 53. Cocealing Baby Swallow Bullish model
else
if((bar4.trend==Down)&&(bar3.trend==Down)&&(bar2.trend==Down)&&(bar1.trend==Down)&&(bar4.type==Cand_Long || bar4.type==Cand_Maribozu_Long)&&
(bar3.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&(bar2.type==Cand_Short)&&(bar1.type==Cand_Maribozu_Long)&&
(bar2.open<bar3.close)&&(bar2.high>bar2.close)&&(bar1.open>bar2.high)&&(bar1.close<bar2.low)&&
(bar1.bodysize>bar2.bodysize)&&(bar4.lowick==Tiny_Wick)&&(bar4.hiwick==Tiny_Wick)&&(bar3.lowick==Tiny_Wick)&&
(bar3.hiwick==Tiny_Wick)&&(bar2.hiwick==Long_Wick)&&(bar2.lowick==Tiny_Wick)&&(bar1.lowick==Tiny_Wick)&&(bar1.hiwick==Tiny_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Cocealing_Baby_Swallow_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Cocealing Baby Swallow";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=26;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==26)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 54. Thrusting Line Bearish model
else
if((bar2.trend==Down)&&(bar1.trend==Rise)&&(bar2.type==Cand_Long)&&(bar1.open<bar2.low)&&(bar1.close<(bar2.open+bar2.close)/2)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Thrusting_Line_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Thrusting Line Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-26;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-26)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 55. Abandoned Baby Bullish model
else
if((bar3.trend==Down)&&(bar2.trend==Lateral)&&(bar1.trend==Rise)&&(bar3.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&
(bar2.type==Cand_Doji)&&(bar1.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&(bar2.high<bar3.low)&&
(bar2.low<=cp.Lo[Lows])&&(bar1.open<bar3.close)&&(bar1.close>bar3.close)&&(bar1.close<bar3.open)&&
(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbb1=ibar;
cp.nbs1=0;
textprice="Abandoned_Baby_Bull_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Abandoned Baby Bull";
textbar="Bar Shift: "+string(cp.nbb1);
direction="Direction: Bullish";
trigger="Trigger: BUY above ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=27;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.low-cp.space,
bar1.low,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==27)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//--
//-- 56. Abandoned Baby Bearish model
else
if((bar3.trend==Rise)&&(bar2.trend==Lateral)&&(bar1.trend==Down)&&(bar3.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&
(bar2.type==Cand_Doji)&&(bar1.type==Cand_Long || bar3.type==Cand_Maribozu_Long)&&(bar2.low>bar3.high)&&
(bar2.high>=cp.Hi[Hies])&&(bar1.open>bar3.close)&&(bar1.close>bar3.open)&&(bar1.close<bar3.close)&&
(bar3.hiwick==Small_Wick)&&(bar3.lowick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="Abandoned_Baby_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="Abandoned Baby Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-27;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-27)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 57. On Neck Line Bearish model
else
if((bar2.trend==Down)&&(bar1.trend==Rise)&&(bar2.type==Cand_Long)&&(bar1.open<bar2.low)&&(bar1.close<bar2.low)&&
(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="On_Neck_Line_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="On Neck Line Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-28;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-28)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
//-- 58. In Neck Line Bearish model
else
if((bar2.trend==Down)&&(bar1.trend==Rise)&&(bar2.type==Cand_Long)&&(bar1.open<bar2.low)&&(bar1.close>bar2.low)&&
(bar1.bodysize<bar2.bodysize)&&(bar2.hiwick==Small_Wick)&&(bar2.lowick==Small_Wick)&&(bar1.lowick==Small_Wick)&&(bar1.hiwick==Small_Wick))
{
cp.nbs1=ibar;
cp.nbb1=0;
textprice="In_Neck_Line_Bear_"+TimeToString(time[1],TIME_DATE|TIME_MINUTES);
pattern="In Neck Line Bear";
textbar="Bar Shift: "+string(cp.nbs1);
direction="Direction: Bearish";
trigger="Trigger: SELL below ";
signalclr=cp.cancolor[bar1.bclr];
cp.tms1=time[1];
cp.cal=-29;
pattalert=" -- FCP ~ Found bars appears as "+pattern+" pattern";
cp.DrawSignal(textprice,
time[1],
bar1.high+cp.space,
bar1.high,
cp.askbid,
textbar,
pattern,
direction,
trigger,
signalclr);
//--
if((UseAlert==Yes)&&(cp.cal==-29)&&(cp.cal!=cp.pal))
cp.Do_Alerts(exname+symtf+altime+pattalert);
}
//--
else
if(cp.nbb1==0 && cp.nbs1==0)
{
cp.CreateLabel(cp.CId,"Pattern","Pattern: Not found yet","Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+60);
cp.CreateLabel(cp.CId,"Position","Bar Shift: Not found yet","Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+75);
cp.CreateLabel(cp.CId,"Direction","Direction: Not found yet","Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+90);
cp.CreateLabel(cp.CId,"Trigger","Trigger: Not found yet","Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+105);
}
else
if((cp.nbb1!=0 && cp.nbs1==0)||(cp.nbs1!=0 && cp.nbb1==0))
{
int inbar=iBarShift(Symbol(),cp.TFcp,cp.tms1,false);
if(cp.nbb1!=0 && cp.nbs1==0) { cp.FCPUp[ibar]=NormalizeDouble(cp.Lo[ibar],cp.dgts); cp.FCPDw[ibar]=EMPTY_VALUE; }
if(cp.nbs1!=0 && cp.nbb1==0) { cp.FCPDw[ibar]=NormalizeDouble(cp.Hi[ibar],cp.dgts); cp.FCPUp[ibar]=EMPTY_VALUE; }
cp.CreateLabel(cp.CId,"Position","Bar Shift: " +string(inbar),
"Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+75);
}
//--
}
//--- create indicator OHLC price
int aj=cor==1 ? -2 : 2;
if(close[0]>open[0]) { cp.barclr=BuyColor; }
else if(close[0]<open[0]) { cp.barclr=SellColor; }
else { cp.barclr=clrNT; }
cp.CreateLabel(cp.CId,"OPEN","O: "+DoubleToString(open[0],cp.dgts),"Verdana",9,cp.barclr,cp.encorner,cp.xdis,cp.ydis+125);
cp.CreateLabel(cp.CId,"HIGH","H: "+DoubleToString(high[0],cp.dgts),"Verdana",9,cp.barclr,cp.encorner,cp.xdis,cp.ydis+140);
cp.CreateLabel(cp.CId,"LOW","L: "+DoubleToString(low[0],cp.dgts),"Verdana",9,cp.barclr,cp.encorner,cp.xdis+aj,cp.ydis+155);
cp.CreateLabel(cp.CId,"CLOSE","C: "+DoubleToString(close[0],cp.dgts),"Verdana",9,cp.barclr,cp.encorner,cp.xdis,cp.ydis+170);
cp.CreateLabel(cp.CId,"ASK","Ask: "+DoubleToString(cp.e_ask,cp.dgts),"Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+190);
cp.CreateLabel(cp.CId,"BID","Bid : "+DoubleToString(cp.e_bid,cp.dgts),"Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+205);
cp.CreateLabel(cp.CId,"SPREAD","Spread: "+DoubleToString(cp.e_pread,2)+" pips","Verdana",8,clrfont,cp.encorner,cp.xdis,cp.ydis+220);
//--
cp.ptime=cp.ctime;
//--
//--- return value of prev_calculated for next call
return(rates_total);
}
//---------//
//+------------------------------------------------------------------+
void FCP::UpdatePrice(int bars=0)
{
//---
int xbar=bars==0 ? arper : bars;
//--
ArrayFree(Op);
ArrayFree(Hi);
ArrayFree(Lo);
ArrayFree(Cl);
ArrayFree(Tm);
//--
ArrayResize(Op,arper,arper);
ArrayResize(Hi,arper,arper);
ArrayResize(Lo,arper,arper);
ArrayResize(Cl,arper,arper);
ArrayResize(Tm,arper,arper);
//--
ArraySetAsSeries(Op,true);
ArraySetAsSeries(Hi,true);
ArraySetAsSeries(Lo,true);
ArraySetAsSeries(Cl,true);
ArraySetAsSeries(Tm,true);
//--
ArrayInitialize(Op,0.0);
ArrayInitialize(Hi,0.0);
ArrayInitialize(Lo,0.0);
ArrayInitialize(Cl,0.0);
ArrayInitialize(Tm,0);
//--
RefreshPrice(bars);
//--
int co=CopyOpen(Symbol(),TFcp,0,xbar,Op);
int ch=CopyHigh(Symbol(),TFcp,0,xbar,Hi);
int cl=CopyLow(Symbol(),TFcp,0,xbar,Lo);
int cc=CopyClose(Symbol(),TFcp,0,xbar,Cl);
int ct=CopyTime(Symbol(),TFcp,0,xbar,Tm);
//--
return;
//---
} //-end UpdatePrice()
//---------//
void FCP::RefreshPrice(int bars)
{
//---
MqlRates parray[];
ArraySetAsSeries(parray,true);
int copied=CopyRates(Symbol(),TFcp,0,bars,parray);
//--
return;
//---
} //-end RefreshPrice()
//---------//
bool FCP::RefreshTick(void)
{
//---
m_symbol.Name(Symbol());
if(m_symbol.RefreshRates()) return(true);
//--
return(false);
//---
} //-end RefreshTick()
//---------//
void FCP::CurrentSymbolSet(void)
{
//---
m_symbol.Name(Symbol());
m_symbol.Refresh();
m_symbol.RefreshRates();
//--
return;
//---
} //-end CurrentSymbolSet()
//---------//
void FCP::Pips(void)
{
//---
CurrentSymbolSet();
//--
point=m_symbol.Point();
dgts=(int)m_symbol.Digits();
//--
xpip=10.0;
pip=point*xpip;
//--
return;
//---
} //-end Pips()
//---------//
//+------------------------------------------------------------------+
//| ENUM TYPE CANDLESTICK |
//+------------------------------------------------------------------+
enum Type_Candlestick
{
Cand_Maribozu, //Maribozu
Cand_Maribozu_Long, //Maribozu long
Cand_Doji, //Doji
Cand_Spin_Top, //Spins
Cand_Hammer, //Hammer
Cand_Invert_Hammer, //Inverted Hammer
Cand_Long, //Long
Cand_Median, //Median
Cand_Short, //Short
Cand_Star, //Star
Cand_Mini //Mini
};
//---------//
//+------------------------------------------------------------------+
//| ENUM CANDLESTICK COLOR |
//+------------------------------------------------------------------+
enum Bar_Color
{
Clr_Maribozu, //Maribozu Color
Clr_Maribozu_Long, //Maribozu long Color
Clr_Doji, //Doji Color
Clr_Spin_Top, //Spins Color
Clr_Hammer, //Hammer Color
Clr_Invert_Hammer, //Inverted Hammer Color
Clr_Long, //Long Color
Clr_Median, //Long Color
Clr_Short, //Short Color
Clr_Star, //Star
Clr_Mini //Mini
};
//---------//
//+------------------------------------------------------------------+
//| ENUM Type_Trend |
//+------------------------------------------------------------------+
enum Type_Trend
{
Rise, //Ascending
Down, //Descending
Lateral //Lateral
};
//---------//
//+------------------------------------------------------------------+
//| ENUM TYPE_WICK |
//+------------------------------------------------------------------+
enum Type_Wick
{
Long_Wick, //Long Wick
Small_Wick, //Small Wick
Tiny_Wick //Tiny Wick
};
//---------//
//+------------------------------------------------------------------+
//| Candle_Structure |
//+------------------------------------------------------------------+
struct Candle_Structure
{
double open,high,low,close; // OHLC
datetime time; //Time
Type_Trend trend; //Trend
bool bull; //Bullish candlestick
double HiLo; //Size of High - Low
double bodysize; //Size of body
double shigh; //Size of High Wick
double shlow; //Size of Low Wick
Type_Wick hiwick; //Size of Wick High
Type_Wick lowick; //Size of Wick Low
Bar_Color bclr; //Candle Color
Type_Candlestick type; //Type of candlestick
};
//---------//
//+------------------------------------------------------------------+
//| Function of determining of candlestick |
//+------------------------------------------------------------------+
void RecognizeCandle(string symbol,ENUM_TIMEFRAMES period,datetime time,int aver_period,Candle_Structure &res)
{
//--- Get details of the previous candlestick
cp.RefreshTick();
cp.UpdatePrice(cp.arper);
//--
int bar=iBarShift(symbol,period,time,false);
res.open=cp.Op[bar];
res.high=cp.Hi[bar];
res.low=cp.Lo[bar];
res.close=cp.Cl[bar];
res.time=cp.Tm[bar];
//--- Determine direction of trend
//--
if(res.open<res.close) res.trend=Rise;
else if(res.open>res.close) res.trend=Down;
else res.trend=Lateral;
//--- Determine if it's a bullish or a bearish candlestick
res.bull=res.close>=res.open;
//--- Get the absolute size of body of candlestick
res.bodysize=fabs(res.open-res.close);
//--
res.HiLo=res.high-res.low;
//--- Get sizes of shadows
res.shlow=res.close-res.low;
res.shigh=res.high-res.open;
if(res.bull)
{
res.shlow=res.open-res.low;
res.shigh=res.high-res.close;
}
//--
if(res.shigh>res.bodysize*2) res.hiwick=Long_Wick;
if(res.shigh<res.bodysize*2 && res.shigh>res.bodysize*0.16) res.hiwick=Small_Wick;
if(res.shigh<res.bodysize*0.1) res.hiwick=Tiny_Wick;
//--
if(res.shlow>res.bodysize*2) res.lowick=Long_Wick;
if(res.shlow<res.bodysize*2 && res.shlow>res.bodysize*0.16) res.lowick=Small_Wick;
if(res.shlow<res.bodysize*0.1) res.lowick=Tiny_Wick;
//--
//--- Calculate average size of body of previous candlesticks
double sumavgbody=0.0;
for(int i=cp.avbars-1; i>=1; i--)
sumavgbody=sumavgbody+fabs(cp.Op[i]-cp.Cl[i]);
//--
double avgbody=sumavgbody/aver_period;
//--
//--- Determine type of candlestick
//--- long
if(res.bodysize>avgbody*1.35) {res.type=Cand_Long; res.bclr=Clr_Long;}
//--- median
if(res.bodysize>avgbody*1.0 && res.bodysize<=avgbody*1.35) {res.type=Cand_Median; res.bclr=Clr_Long;}
//--- sort
if(res.bodysize>=avgbody*0.5 && res.bodysize<=avgbody*1.0) {res.type=Cand_Short; res.bclr=Clr_Short;}
//--- mini
if(res.bodysize<avgbody*0.5) {res.type=Cand_Mini; res.bclr=Clr_Star;}
//--- doji
if(res.bodysize<res.HiLo*0.03 || res.trend==Lateral) {res.type=Cand_Doji; res.bclr=Clr_Doji;}
//--- maribozu
if((res.lowick==Tiny_Wick || res.hiwick==Tiny_Wick) && res.bodysize>0)
{
if(res.type==Cand_Long)
{res.type=Cand_Maribozu_Long; res.bclr=Clr_Maribozu_Long;}
else
if(res.type==Cand_Median)
{res.type=Cand_Maribozu; res.bclr=Clr_Maribozu_Long;}
}
//--- hammer
if(res.type==Cand_Mini && res.lowick==Long_Wick && res.hiwick==Tiny_Wick) {res.type=Cand_Hammer; res.bclr=Clr_Hammer;}
//--- invert hammer
if(res.type==Cand_Mini && res.lowick==Tiny_Wick && res.hiwick==Long_Wick) {res.type=Cand_Invert_Hammer; res.bclr=Clr_Invert_Hammer;}
//--- spinning top
if(res.type==Cand_Mini && res.shlow>res.bodysize && res.shigh>res.bodysize) {res.type=Cand_Spin_Top; res.bclr=Clr_Spin_Top;}
//--- star
if(res.type==Cand_Mini && ((res.lowick==Small_Wick||res.hiwick==Tiny_Wick)||(res.lowick==Tiny_Wick||res.hiwick==Small_Wick)))
{res.type=Cand_Star; res.bclr=Clr_Star;}
//---
return;
}
//---------//
string FCP::strTF(ENUM_TIMEFRAMES period)
{
//---
switch(period)
{
//--
case PERIOD_M1: return("M1");
case PERIOD_M2: return("M2");
case PERIOD_M3: return("M3");
case PERIOD_M4: return("M4");
case PERIOD_M5: return("M5");
case PERIOD_M6: return("M6");
case PERIOD_M10: return("M10");
case PERIOD_M12: return("M12");
case PERIOD_M15: return("M15");
case PERIOD_M20: return("M20");
case PERIOD_M30: return("M30");
case PERIOD_H1: return("H1");
case PERIOD_H2: return("H2");
case PERIOD_H3: return("H3");
case PERIOD_H4: return("H4");
case PERIOD_H6: return("H6");
case PERIOD_H8: return("H8");
case PERIOD_H12: return("H12");
case PERIOD_D1: return("D1");
case PERIOD_W1: return("W1");
case PERIOD_MN1: return("MN1");
//--
}
//--
return(string(period));
//---
} //-end strTF()
//---------//
enum TimeReturn
{
year = 0, // Year
mon = 1, // Month
day = 2, // Day
hour = 3, // Hour
min = 4, // Minutes
sec = 5, // Seconds
day_of_week = 6, // Day of week (0-Sunday, 1-Monday, ... ,6-Saturday)
day_of_year = 7 // Day number of the year (January 1st is assigned the number value of zero)
};
//---------//
int FCP::ThisTime(const int reqmode)
{
//---
MqlDateTime tm;
TimeCurrent(tm);
int valtm=0;
//--
switch(reqmode)
{
case 0: valtm=tm.year; break; // Return Year
case 1: valtm=tm.mon; break; // Return Month
case 2: valtm=tm.day; break; // Return Day
case 3: valtm=tm.hour; break; // Return Hour
case 4: valtm=tm.min; break; // Return Minutes
case 5: valtm=tm.sec; break; // Return Seconds
case 6: valtm=tm.day_of_week; break; // Return Day of week (0-Sunday, 1-Monday, ... ,6-Saturday)
case 7: valtm=tm.day_of_year; break; // Return Day number of the year (January 1st is assigned the number value of zero)
}
//--
return(valtm);
//---
} //-end ThisTime()
//---------//
void FCP::Do_Alerts(string msg)
{
//---
Print("--- "+Symbol()+","+strTF(TFcp)+": "+msg+
"\n--- at: ",TimeToString(TimeCurrent(),TIME_DATE|TIME_MINUTES));
//--
if(UseAlert==Yes)
{
Alert("--- "+Symbol()+","+strTF(TFcp)+": "+msg);
pal=cal;
}
//--
if(UseEmailAlert==Yes)
{
SendMail(indname,"--- "+Symbol()+" "+strTF(TFcp)+": "+msg+
"\n--- at: "+TimeToString(TimeCurrent(),TIME_DATE|TIME_MINUTES));
pal=cal;
}
//--
if(UseSendnotify==Yes)
{
SendNotification(Symbol()+"--- "+Symbol()+" "+strTF(TFcp)+": "+msg+
"\n--- at: "+TimeToString(iTime(Symbol(),TFcp,0),TIME_DATE|TIME_MINUTES));
pal=cal;
}
//--
return;
//---
} //-end Do_Alerts()
//---------//
void FCP::DrawSignal(string txtprice,
datetime bartm,
double barprc,
double triprc,
double dspread,
string txtbar,
string txtpatt,
string txtdirect,
string txttrig,
color sigclr)
{
//---
string trigprice=StringFind(txttrig,"BUY",0)>0 ? DoubleToString(triprc,dgts) : DoubleToString(triprc,dgts);
ENUM_ANCHOR_POINT anchor=StringFind(txttrig,"BUY",0)>0 ? ANCHOR_UPPER : ANCHOR_LOWER;
CreateText(cp.CId,txtprice,bartm,barprc,CharToString(108),"Wingdings",8,sigclr,anchor);
CreateLabel(cp.CId,"Pattern","Pattern: "+txtpatt,"Verdana",8,clrfont,encorner,xdis,ydis+60);
CreateLabel(cp.CId,"Position",txtbar,"Verdana",8,clrfont,encorner,xdis,ydis+75);
CreateLabel(cp.CId,"Direction",txtdirect,"Verdana",8,clrfont,encorner,xdis,ydis+90);
CreateLabel(cp.CId,"Trigger",txttrig+trigprice,"Verdana",8,clrfont,encorner,xdis,ydis+105);
//---
return;
//---
} //-end DrawSignal()
//---------//
void FCP::CreateModel(long chart_id,
string lable_name,
string label_text,
string font_model,
int font_size,
color label_color,
int chart_corner,
int chart_anchor,
int x_cor,
int y_cor)
{
//---
if(ObjectFind(chart_id,lable_name)<0)
{
if(ObjectCreate(chart_id,lable_name,OBJ_LABEL,0,0,0,0,0))
{
ObjectSetString(chart_id,lable_name,OBJPROP_TEXT,label_text);
ObjectSetString(chart_id,lable_name,OBJPROP_FONT,font_model);
ObjectSetInteger(chart_id,lable_name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,lable_name,OBJPROP_COLOR,label_color);
ObjectSetInteger(chart_id,lable_name,OBJPROP_CORNER,chart_corner);
ObjectSetInteger(chart_id,lable_name,OBJPROP_ANCHOR,chart_anchor);
ObjectSetInteger(chart_id,lable_name,OBJPROP_XDISTANCE,x_cor);
ObjectSetInteger(chart_id,lable_name,OBJPROP_YDISTANCE,y_cor);
}
else
{Print("Failed to create the object OBJ_LABEL ",lable_name,", Error code = ", GetLastError());}
}
else
{
ObjectSetString(chart_id,lable_name,OBJPROP_TEXT,label_text);
ObjectSetString(chart_id,lable_name,OBJPROP_FONT,font_model);
ObjectSetInteger(chart_id,lable_name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,lable_name,OBJPROP_COLOR,label_color);
ObjectSetInteger(chart_id,lable_name,OBJPROP_CORNER,chart_corner);
ObjectSetInteger(chart_id,lable_name,OBJPROP_ANCHOR,chart_anchor);
ObjectSetInteger(chart_id,lable_name,OBJPROP_XDISTANCE,x_cor);
ObjectSetInteger(chart_id,lable_name,OBJPROP_YDISTANCE,y_cor);
}
//---
return;
//---
} //-end CreateModel()
//---------//
void FCP::CreateLabel(long chart_id,
string lable_name,
string label_text,
string font_model,
int font_size,
color label_color,
int chart_corner,
int x_cor,
int y_cor)
{
//---
if(ObjectFind(chart_id,lable_name)<0)
{
if(ObjectCreate(chart_id,lable_name,OBJ_LABEL,0,0,0,0,0))
{
ObjectSetString(chart_id,lable_name,OBJPROP_TEXT,label_text);
ObjectSetString(chart_id,lable_name,OBJPROP_FONT,font_model);
ObjectSetInteger(chart_id,lable_name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,lable_name,OBJPROP_COLOR,label_color);
ObjectSetInteger(chart_id,lable_name,OBJPROP_CORNER,chart_corner);
ObjectSetInteger(chart_id,lable_name,OBJPROP_XDISTANCE,x_cor);
ObjectSetInteger(chart_id,lable_name,OBJPROP_YDISTANCE,y_cor);
}
else
{Print("Failed to create the object OBJ_LABEL ",lable_name,", Error code = ", GetLastError());}
}
else
{
ObjectSetString(chart_id,lable_name,OBJPROP_TEXT,label_text);
ObjectSetString(chart_id,lable_name,OBJPROP_FONT,font_model);
ObjectSetInteger(chart_id,lable_name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,lable_name,OBJPROP_COLOR,label_color);
ObjectSetInteger(chart_id,lable_name,OBJPROP_CORNER,chart_corner);
ObjectSetInteger(chart_id,lable_name,OBJPROP_XDISTANCE,x_cor);
ObjectSetInteger(chart_id,lable_name,OBJPROP_YDISTANCE,y_cor);
}
//---
return;
//---
} //-end CreateLabel()
//---------//
void FCP::CreateText(long chart_id,
string text_name,
datetime txt_time,
double txt_price,
string label_text,
string font_model,
int font_size,
color text_color,
int anchor)
{
//---
if(ObjectFind(chart_id,text_name)<0)
{
if(ObjectCreate(chart_id,text_name,OBJ_TEXT,0,txt_time,txt_price))
{
ObjectSetString(chart_id,text_name,OBJPROP_TEXT,label_text);
ObjectSetString(chart_id,text_name,OBJPROP_FONT,font_model);
ObjectSetInteger(chart_id,text_name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,text_name,OBJPROP_COLOR,text_color);
ObjectSetInteger(chart_id,text_name,OBJPROP_ANCHOR,anchor);
}
else
{Print("Failed to create the object OBJ_TEXT ",text_name,", Error code = ", GetLastError());}
}
else
{
ObjectSetString(chart_id,text_name,OBJPROP_TEXT,label_text);
ObjectSetString(chart_id,text_name,OBJPROP_FONT,font_model);
ObjectSetInteger(chart_id,text_name,OBJPROP_FONTSIZE,font_size);
ObjectSetInteger(chart_id,text_name,OBJPROP_COLOR,text_color);
ObjectSetInteger(chart_id,text_name,OBJPROP_ANCHOR,anchor);
}
//---
return;
//---
} //-end CreateText()
//---------//
string FCP::getUninitReasonText(int reasonCode)
{
//---
string text="";
//---
switch(reasonCode)
{
case REASON_PROGRAM:
text="The EA has stopped working calling by remove function."; break;
case REASON_REMOVE:
text="Program "+__FILE__+" was removed from chart"; break;
case REASON_RECOMPILE:
text="Program recompiled."; break;
case REASON_CHARTCHANGE:
text="Symbol or timeframe was changed"; break;
case REASON_CHARTCLOSE:
text="Chart was closed"; break;
case REASON_PARAMETERS:
text="Input-parameter was changed"; break;
case REASON_ACCOUNT:
text="Account was changed"; break;
case REASON_TEMPLATE:
text="New template was applied to chart"; break;
case REASON_INITFAILED:
text="The OnInit() handler returned a non-zero value."; break;
case REASON_CLOSE:
text="Terminal closed."; break;
default: text="Another reason"; break;
}
//--
return text;
//---
} //-end getUninitReasonText()
//---------//
***Copyright © 2026 3rjfx ~ For educational purposes only.***
Please download the FCP indicator: Forex Candlestick Patterns (FCP)
If you want to get the source code of the program, please send your request via the Contact page by mentioning the article and program you want.







0 comments:
Post a Comment