SFP pattern mql4
A Swing Failure Pattern (SFP) is a trade setup in which big traders hunt stop-losses above a key swing high or below a key swing low for the purpose of generating the liquidity needed to push price in the opposite direction.
When price 1) pierces above a key swing high but then 2) closes back below that swing high, we have a potential bearish SFP. Bearish SFPs offer opportunities for short trades. When price 1) dumps below a key swing low but then 2) closes back above that swing low, we have a potential bullish SFP. Bullish SFPs offer opportunities for long trades.
Indicator finds SFP patterns on selected symbols and time frames and depending on your choice alerts or sends an email. All information is
shown in the dashboard. You can open selected chart from the table and see the drawn pattern.
- Select all symbols from Market Watch? - if Yes the program scans through all the symbols displayed in Market
Watch, if No - only selected in next input symbols are scanned
- Enter symbols separated by commas - enter symbols separated by commas (they must be selected in Market Watch)
- Enter time frames separated by commas - enter time frames separated by commas (M1,M5,M15,H1,H4,D1,W1,MN1)
- Line color - choose the color for drawing
- Line width - enter number for line thickness
- Place mark for stop loss (in ATR units)? - choose Yes or No
- Multiplier for stop loss (in ATR units) - enter number what size for stop loss in ATR units you want
- ATR period - period for ATR indicator
- Show alerts when SFP detected? - choose Yes or No
- Send email alert when SFP detected? - choose Yes or No, also
you have to configure your email settings in Tools/Options/Email.
- In tester mode the patterns are drawn only for symbols and time frames of the current chart ant alerts are shown in menu's Journal tab. Also email will not be sent.
• Buffer 0 for signal – returned values can be 1 for buy and 2 for sell
• Buffer 1 for stop loss reference – returned value is of the last price peak
• Buffer 2 for take profit reference – returned value is of the second price peak from the last one
So iCustom indicator in your EA have to look:
iCustom(NULL,0," SFP_Pattern","Algo",0,”Symbol name”,”TF_Period”,0,0)
Where parameters are:
• NULL – current symbol (no matter for output)
• 0 – current timeframe (no matter for output)
• " SFP_Pattern" - indicator name, relative to the root indicators directory (MQL4/Indicators/)
• "Algo" – first parameter of SFP pattern indicator
• 0 – second parameter
• ”Symbol name” – third parameter, enter exact name of the symbol that is shown in Market Watch
• ”TF_Period” – fourth parameter, enter timeframe period you need in the format: “M1”,”M5”, “M15”,”M30”, “H1”,”H4”, “D1”,”W1” or ”MN1”.
• Other SFP_Pattern parameters can be omitted
• 0 – buffer number, can be 0, 1 or 2
• 0 – shift, use only 0
Example how to use:
input string TF_Period="H1"; //Timeframe
input string Symbol_name="EURUSD"; //Symbol name
input double K_ATR_SL=1.5; //Multiplier for stop loss in ATR values
double StopLoss = iCustom(NULL,0,”SFP_Pattern","Algo",0,Symbol_name,TF_Period,1,0) - K_ATR_SL*iATR(Symbol_name,PERIOD_H1,14,1); //use the same Symbol_name and TF_Period in iATR
double TakeProfit = iCustom(NULL,0,"SFP_Pattern","Algo",0,Symbol_name,TF_Period,2,0);
int result = OrderSend(Symbol(),OP_BUY,volume,Ask,Slippage,NormalizeDouble(StopLoss,Digits),NormalizeDouble(TakeProfit,Digits)," SFP_Pattern",MagicNumber,0,Blue);
An option to mark the place for stop loss in ATR units is added.
You have to configure your email settings in Tools/Options/Email.