Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
fq_head_fake
//+------------------------------------------------------------------+
//| FQ - Head Fake |
//| Copyright 2014, fxquickroute |
//| http://www.fxquickroute.com |
//+------------------------------------------------------------------+
#property copyright "FX Quick Route, ©2014"
#property link "www.fxquickroute.com"
#property description "FQ - Head Fake"
#property version "1.00"
#property strict
//+----------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrGreen
#property indicator_color2 clrRed
#property indicator_width1 0
#property indicator_width2 0
//+----------------------+
input string Name = "FQ Head Fake";
input string Author = "www.fxquickroute.com";
input int BarsToAnalyze = 1000;
input bool AlertOn = True;
input bool AlertEmail = True;
input bool PushNotification = True;
//+----------------------+
double bull_head[];
double bear_head[];
datetime last_time;
bool first_alert_off;
bool signal_on;
string position;
//+----------------------+
int OnInit(void)
{
Reset();
SetIndexBuffer(0,bear_head);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,233);
SetIndexLabel(0,"Bear HeadFake");
SetIndexBuffer(1,bull_head);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,234);
SetIndexLabel(1,"Bull HeadFake");
return(INIT_SUCCEEDED);
}
//+----------------------+
void Reset()
{
last_time = 0;
first_alert_off = true;
signal_on = false;
position = "";
}
//+----------------------+
void OnDeinit(const int reason)
{
if(reason==1)Alert(AuthorComment());
}
//+----------------------+
int OnCalculate
(
const int rates_total,
const int 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 int &spread[]
)
{
//+----------------------+
if(prev_calculated==0){ArrayInitialize(bear_head, EMPTY_VALUE);ArrayInitialize(bull_head, EMPTY_VALUE);}
int limit=rates_total-prev_calculated;
if (rates_total<3) return(0);
Comment(AuthorComment());
//Loop
for(int shift=limit; shift >= 1 && !IsStopped() ; shift--)
{
//Ignore Bars
if(shift<=BarsToAnalyze)
{
//Drawing Offset
double offset = iATR(NULL,0,1,shift)/5;
if (Close[shift]>Close[shift+1] && Low[shift+1]>Low[shift+2] && (High[shift]-Close[shift])>(High[shift+1]-Close[shift+1]))
{
bull_head[shift] = High[shift]+offset;
signal_on = true;
position = "Bull Head Fake Signal, Possible Sell @"+DoubleToStr(Close[shift],Digits);
}
else if (Close[shift]<Close[shift+1] && High[shift+1]<High[shift+2] && (Close[shift]-Low[shift])>(Close[shift+1]-Low[shift+1]))
{
bear_head[shift] = Low[shift]-offset;
signal_on = true;
position = "Bear Head Fake Signal, Possible Buy @"+DoubleToStr(Close[shift],Digits);
}
else
{
bull_head[shift] = EMPTY_VALUE;
bear_head[shift] = EMPTY_VALUE;
signal_on = false;
}
}
}//END LOOP
//ALERTS
if (last_time != Time[0])
{
if (signal_on && first_alert_off == FALSE)
{
if (AlertOn) Alert ("FQ - Head Fake: " + Symbol() +" "+ position );
if (AlertEmail) SendMail ("FQ - Head Fake", Symbol() +" "+ position );
if (PushNotification)SendNotification ("FQ - Head Fake: " + Symbol() +" "+ position );
Comment("FQ - Head Fake: " + Symbol() +" "+ position );
}
last_time=Time[0];
first_alert_off=FALSE;
}
//+----------------------+
return(rates_total);
}
//+----------------------+
string AuthorComment()
{
return("© www.fxquickroute.com");
}
//+----------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---