Navigation:Home > Content >

7_ScalperSignal_v~.mq4

Time: 2016-03-26 | Download file:7_ScalperSignal_v~.mq4

/*
   Generated by EX4-TO-MQ4 decompiler FREEWARE V4.0.451.1 [-]
   Website: http://www.metaquotes.net
   E-mail : support@metaquotes.net
*/
#property copyright "Copyright © 2007, NiX @ www.forex-tsd.com"
#property link      "http://www.forex-tsd.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 LightGreen
#property indicator_color4 Red

extern int CountBars = 300;
extern string FS = " ** Filter sensitivity: High <-[1..3]-> Low ** ";
extern int Sensitivity = 2;
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
int gi_unused_108 = -1;

int init() {
   IndicatorBuffers(4);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 233);
   SetIndexBuffer(2, g_ibuf_92);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 234);
   SetIndexBuffer(3, g_ibuf_96);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 3, White);
   SetIndexBuffer(0, g_ibuf_100);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 3, White);
   SetIndexBuffer(1, g_ibuf_104);
   SetIndexEmptyValue(0, 0);
   SetIndexEmptyValue(1, 0);
   SetIndexEmptyValue(2, 0);
   SetIndexEmptyValue(3, 0);
   SetIndexLabel(2, "Buy Signal");
   SetIndexLabel(3, "Sell Signal");
   SetIndexLabel(0, "High");
   SetIndexLabel(1, "Low");
   SetIndexEmptyValue(0, EMPTY_VALUE);
   SetIndexEmptyValue(1, EMPTY_VALUE);
   SetIndexEmptyValue(2, EMPTY_VALUE);
   SetIndexEmptyValue(3, EMPTY_VALUE);
   string ls_0 = "Scalper Signal";
   IndicatorShortName(ls_0);
   if (Sensitivity < 1) Sensitivity = 1;
   if (Sensitivity > 3) Sensitivity = 3;
   return (0);
}

int deinit() {
   return (0);
}

double sellSignal(int ai_0) {
   bool li_4 = TRUE;
   if (Sensitivity > 2)
      if (iHigh(Symbol(), Period(), ai_0 + 6) >= iHigh(Symbol(), Period(), ai_0 + 5)) li_4 = FALSE;
   if (Sensitivity > 1)
      if (iHigh(Symbol(), Period(), ai_0 + 5) >= iHigh(Symbol(), Period(), ai_0 + 4)) li_4 = FALSE;
   if (Sensitivity > 0)
      if (iHigh(Symbol(), Period(), ai_0 + 4) >= iHigh(Symbol(), Period(), ai_0 + 3)) li_4 = FALSE;
   if (li_4) {
      if (iClose(Symbol(), Period(), ai_0 + 2) < iHigh(Symbol(), Period(), ai_0 + 3))
         if (iClose(Symbol(), Period(), ai_0 + 1) < iLow(Symbol(), Period(), ai_0 + 3)) return (iLow(Symbol(), Period(), ai_0 + 3) - 10.0 * Point);
   }
   return (0);
}

double buySignal(int ai_0) {
   bool li_4 = TRUE;
   if (Sensitivity > 2)
      if (iLow(Symbol(), Period(), ai_0 + 6) <= iLow(Symbol(), Period(), ai_0 + 5)) li_4 = FALSE;
   if (Sensitivity > 1)
      if (iLow(Symbol(), Period(), ai_0 + 5) <= iLow(Symbol(), Period(), ai_0 + 4)) li_4 = FALSE;
   if (Sensitivity > 0)
      if (iLow(Symbol(), Period(), ai_0 + 4) <= iLow(Symbol(), Period(), ai_0 + 3)) li_4 = FALSE;
   if (li_4) {
      if (iClose(Symbol(), Period(), ai_0 + 2) > iLow(Symbol(), Period(), ai_0 + 3))
         if (iClose(Symbol(), Period(), ai_0 + 1) > iHigh(Symbol(), Period(), ai_0 + 3)) return (iHigh(Symbol(), Period(), ai_0 + 3) + 10.0 * Point);
   }
   return (0);
}

int start() {
   if (!LicenceCHK()) return (0);
   int li_0 = IndicatorCounted();
   if (li_0 < 0) return (-1);
   if (li_0 > 0) li_0--;
   int li_4 = Bars - li_0;
   for (int count_8 = 0; count_8 < li_4; count_8++) {
      g_ibuf_92[count_8 + 3] = buySignal(count_8);
      g_ibuf_96[count_8 + 3] = sellSignal(count_8);
      if (buySignal(count_8) > 0.0 || sellSignal(count_8) > 0.0) {
         g_ibuf_100[count_8 + 3] = iHigh(Symbol(), Period(), count_8 + 3);
         g_ibuf_104[count_8 + 3] = iLow(Symbol(), Period(), count_8 + 3);
      }
   }
   return (0);
}

bool LicenceCHK() {
   if (IsDemo()) return (TRUE);
   if (TimeYear(TimeCurrent()) > 2020) {
      Comment("Demo Expired! - contact nix @ www.forex-tsd.com");
      Print("Demo Expired!");
      return (FALSE);
   }
   return (TRUE);
}

Recommend