Navigation:Home > Content >

MarketScalper_PRO_v5.5_.mq4

Time: 2012-01-07 | Download file:MarketScalper_PRO_v5.5_.mq4

#property copyright "©2010-12 Build-a-Signal Software, Marko Nikolic"
#property link      "http://mnikolic.com"//«¤§°•~‡^»

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 Black

extern string Indicator           = "MarketScalper PRO Series";
extern int    Trading_Style       = 2;//1=с высокой вероятностью ,2=сбалансированный,3=агрессивный режим
extern bool   Manual              = false;
extern int    Range               = 20;//Range=period_osc при Manual=true
extern int    Sensitivity         = 15;//Sensitivity=ld_DownOscLevel,ld_UpOscLevel=100-Sensitivity, при Manual=true
extern bool   Filter_Signals      = true;
extern bool   Display_Market_Bias = true;

extern string Razdel1             ="•••••••••Stochastic1•••••••••";//Настройки стохастика только для Display_Market_Bias
extern int    KperiodBias1        = 200;//
extern int    DperiodBias1        = 13;//
extern int    SlowingBias1        = 10;//
extern int    StochMAmodeBias1    = 0;//0=SMA,1=EMA,2=SMMA,3=LWMA
extern int    StochPriceBias1     = 0;//0=Low/High,1=Close/Close
extern int    StochModeBias1      = 1;//0=MODE_MAIN,1=MODE_SIGNAL

extern string Razdel2             ="•••••••••Stochastic2•••••••••";//Влияет на сигнал  при Filter_Signals= TRUE
extern int    KperiodBias2        = 200;//
extern int    DperiodBias2        = 16;//
extern int    SlowingBias2        = 5;//
extern int    StochMAmodeBias2    = 1;//0=SMA,1=EMA,2=SMMA,3=LWMA
extern int    StochPriceBias2     = 1;//0=Low/High,1=Close/Close
extern int    StochModeBias2      = 1;//0=MODE_MAIN,1=MODE_SIGNAL
extern int    LevelStochUpBias2   = 60;//
extern int    LevelStochDownBias2 = 40;//

extern string Razdel3             ="•••••••••••••••••••••••••••••";//Влияет на сигнал только при Manual = true;
extern string Set_DeMarker        = "DeMarker_Period and Level OVERBOUGHT OVERSOLD";//OVERBOUGHT-Перекуплен,OVERSOLD-Перепродан
extern bool   FlagDeMarker        = false;
extern int    DeMarkerPeriod      = 14;//6
extern double DeMarkerLevelUp     = 0.7;//1.0
extern double DeMarkerLevelDown   = 0.3;//0.0

extern string Razdel4             ="•••••••••••••••••••••••••••••";//Влияет на сигнал только при Manual = true;
extern string Set_RSI             = "RSI_Period and Level OVERBOUGHT OVERSOLD";
extern bool   FlagRSI             = false;
extern int    RSIPeriod           = 14;//5
extern int    RSILevelUp          = 70;//75
extern int    RSILevelDown        = 30;//25
extern int    RSIPrice            = PRICE_LOW;//0=PRICE_CLOSE,1=PRICE_OPEN,2=PRICE_HIGH,3=PRICE_LOW,4=PRICE_MEDIAN,5=PRICE_TYPICAL,6=PRICE_WEIGHTED

extern string Razdel5             ="•••••••••••••••••••••••••••••";//Влияет на сигнал только при Manual = true;
extern string Set_CCI             = "CCI_Period and Level OVERBOUGHT OVERSOLD";
extern bool   FlagCCI             = false;
extern int    CCIPeriod           = 14;//
extern int    CCILevelUp          = 100;//15
extern int    CCILevelDown        = -100;//-15
extern int    CCIPrice            = PRICE_TYPICAL;//0 0=PRICE_CLOSE,1=PRICE_OPEN,2=PRICE_HIGH,3=PRICE_LOW,4=PRICE_MEDIAN,5=PRICE_TYPICAL,6=PRICE_WEIGHTED

extern string Razdel6             ="•••••••••••••••••••••••••••••";//Влияет на сигнал только при Manual = true;
extern string Set_WPR             = "WPR_Period and Level OVERBOUGHT OVERSOLD";
extern bool   FlagWPR             = false;
extern int    WPRPeriod           = 14;//21
extern int    WPRLevelUp          = -20;//-2
extern int    WPRLevelDown        = -80;//-98

extern string Razdel7             ="•••••••••••••••••••••••••••••";//Влияет на сигнал только при Manual = true;
extern string Set_2MA             = "2MA Crossing";
extern bool   Flag2MA             = false;
extern int    MAFastPeriod        = 2;//
extern int    MASlowPeriod        = 3;//
extern int    MAFastPrice         = PRICE_CLOSE;//0=PRICE_CLOSE,1=PRICE_OPEN,2=PRICE_HIGH,3=PRICE_LOW,4=PRICE_MEDIAN,5=PRICE_TYPICAL,6=PRICE_WEIGHTED
extern int    MASlowPrice         = PRICE_CLOSE;
extern int    MAFastMethod        = MODE_LWMA;//0=SMA,1=EMA,2=SMMA,3=LWMA
extern int    MASlowMethod        = MODE_LWMA;
extern int    MaFast_shift        = 0;
extern int    MaSlow_shift        = 0;

extern string Razdel8             ="•••••••••••••••••••••••••••••";
extern bool   Alert_On            = true;
extern bool   Alert_PopUp_On      = false;
extern bool   Send_Email          = false;
extern string SetEmail            = "Set email in Tools>Opt.>Email";
extern int    Arrow_Distance      = 7;
extern int    ArrowType           = 3;//0-9
extern int    ArrowSize           = 1;
extern color  BuyArrowColor       = Lime;
extern color  SellArrowColor      = Coral;
extern int    Buy_Sound           = 1;//0-12
extern int    Sell_Sound          = 1;//0-12
extern int    Dashboard_Corner    = 1;//1-2
extern int    CountBars           = 1440;//7200
extern string About               = "Range scale is 0 and upwards";
extern string About2              = "Sensitivity scale is 0-100";
extern string EndNote             = "====Refer to manual for help====";
extern string Copyright.Marko.Nikolic  = "(c) 2009-12 | Marko Nikolic";
extern string Publisher.Build.a.Signal = "     Build-A-Signal Software";

double g_ibuf_BUY[];
double g_ibuf_SELL[];
int gi_flag_alert = 0;
//==================================================================================================
int init() {

   SetIndexStyle(0, DRAW_ARROW, EMPTY, ArrowSize, BuyArrowColor);
   SetIndexArrow(0, 225);
   SetIndexBuffer(0, g_ibuf_BUY);
   SetIndexStyle(1, DRAW_ARROW, EMPTY, ArrowSize, SellArrowColor);
   SetIndexArrow(1, 226);
   SetIndexBuffer(1, g_ibuf_SELL);
   switch ( ArrowType )
  {
   case 0: { SetIndexArrow(0, 233);SetIndexArrow(1, 234);} break;
   case 1: { SetIndexArrow(0, 225);SetIndexArrow(1, 226);} break;
   case 2: { SetIndexArrow(0, SYMBOL_ARROWUP);SetIndexArrow(1, SYMBOL_ARROWDOWN);} break;
   case 3: { SetIndexArrow(0, 221);SetIndexArrow(1, 222);} break;
   case 4: { SetIndexArrow(0, 217);SetIndexArrow(1, 218);} break;
   case 5: { SetIndexArrow(0, 228);SetIndexArrow(1, 230);} break;          
   case 6: { SetIndexArrow(0, 236);SetIndexArrow(1, 238);} break;
   case 7: { SetIndexArrow(0, 246);SetIndexArrow(1, 248);} break;
   case 8: { SetIndexArrow(0, SYMBOL_THUMBSUP);SetIndexArrow(1, SYMBOL_THUMBSDOWN);} break;
   case 9: { SetIndexArrow(0, 71); SetIndexArrow(1, 72); } break;
   default:{ SetIndexArrow(0, 233);SetIndexArrow(1, 234);} break;
  }
   IndicatorShortName("MarketScalper PRO Series");
   return (0);
}
//==================================================================================================
int start() {

   int limit;
   int ind_counted;
   double istochastic_Bias1;
   double istochastic_Bias2;
   double iosma_BiasFast1;
   double iosma_BiasFast2;
   double iosma_BiasFast3;
   double iosma_BiasFast4;
   double iosma_BiasSlow1;
   double iosma_BiasSlow2;
   double iosma_BiasSlow3;
   double iosma_BiasSlow4;
   int li_MarketBias;
   string text_Bias1;
   string text_Bias2;
   string text_Bias3;
   string text_Bias4;
   string ls_info;
   color color_info;
   int li_ScalperTrendLT;
   int li_ScalperTrendST;
   int li_ScalperTrendFast;
   int li_ScalperTrendSlow;
   string ls_info2;
   color color_info2;
   string ls_info3;
   color color_info3;
   bool ManualMode;
   int period_osc;
   int period_d;
   int slowing_s;
   double ld_DownOscLevel;
   double ld_UpOscLevel;
   int li_PfStoch;
   int li_MaStoch;
   int li_MdStoch;
   int li_MdStochP;
   double ld_iRSI;
   double istochastic_ModeManual;
   double istochastic_MODE_MAIN;
   double istochastic_MODE_SIGNAL;
   double Osc_Shift0;
   double Osc_Shift1;
   double Osc_Shift2;
   double Osc_Shift3;
   double idemarker_4;
   double idemarker_5;
   double idemarker_6;
   double idemarker_7;
   double idemarker_8;
   double idemarker_9;
   double idemarker_10;
   double idemarker_11;
   double idemarker_12;
   double ld_iCCI;
   double ld_iWPR;
   double ld_iMAFast;
   double ld_iMASlow;
   double ld_iDeMarker;
   double lda_Array[36];
   double ld_Manual;
   bool li_Filter_Signals;
   int li_ProcessSignal;

      ObjectCreate("CountBars_Limit_MSP", OBJ_VLINE, 0, Time[CountBars], 0);
      ObjectSet("CountBars_Limit_MSP", OBJPROP_STYLE, STYLE_SOLID);
      ObjectSet("CountBars_Limit_MSP", OBJPROP_COLOR, LimeGreen);
      ObjectSet("CountBars_Limit_MSP", OBJPROP_WIDTH, 2);
      ObjectCreate("counttxt_MSP", OBJ_TEXT, 0, Time[CountBars], Open[CountBars]);
      ObjectSetText("counttxt_MSP", StringConcatenate("MarketScalper PRO history (CountBars) set to ", CountBars), 8, "Arial Bold", Black);
      ObjectCreate("countback_MSP", OBJ_TEXT, 0, Time[CountBars], Open[CountBars]);
      ObjectSetText("countback_MSP", "ggggggggggg", 20, "Webdings", LimeGreen);
      
      if (Dashboard_Corner == 2) Dashboard_Corner = 4;
      if (Dashboard_Corner != 1 && Dashboard_Corner != 4) Dashboard_Corner = 1;

      ind_counted=IndicatorCounted();
      if (ind_counted<0) return(-1);
      if(ind_counted>0) ind_counted--;
       limit=Bars-ind_counted;
      if(limit>CountBars) limit=CountBars;
      
      for (int i = limit; i >= 0; i--) {
         g_ibuf_BUY[i]  = EMPTY_VALUE;
         g_ibuf_SELL[i] = EMPTY_VALUE;
            istochastic_Bias2 = iStochastic(NULL, 0, KperiodBias2, DperiodBias2, SlowingBias2, StochMAmodeBias2, StochPriceBias2, StochModeBias2, i);
            if (Display_Market_Bias) {//
               istochastic_Bias1 = iStochastic(NULL, 0, KperiodBias1, DperiodBias1, SlowingBias1, StochMAmodeBias1, StochPriceBias1, StochModeBias1, i);
               //iosma_Bias1 = iOsMA(NULL, 0, 75, 400, 125, PRICE_CLOSE, 0);
               //iosma_Bias2 = iOsMA(NULL, 0, 50, 75, 400, PRICE_CLOSE, 0);
               //iosma_Bias3 = iOsMA(NULL, 0, 35, 250, 75, PRICE_CLOSE, 0);
               //iosma_Bias4 = iOsMA(NULL, 0, 5, 75, 400, PRICE_CLOSE, 0);
               iosma_BiasFast1 = iOsMA(NULL, 0, 3, 8, 5, PRICE_CLOSE, 0);//LT=Fast Little Trend
               iosma_BiasFast2 = iOsMA(NULL, 0, 5, 13, 8, PRICE_CLOSE, 0);
               iosma_BiasFast3 = iOsMA(NULL, 0, 8, 21, 13, PRICE_CLOSE, 0);
               iosma_BiasFast4 = iOsMA(NULL, 0, 13, 34, 21, PRICE_CLOSE, 0);
               
               iosma_BiasSlow1 = iOsMA(NULL, 0, 21, 55, 34, PRICE_CLOSE, 0);//BT=Slow Big Trend
               iosma_BiasSlow2 = iOsMA(NULL, 0, 34, 89, 55, PRICE_CLOSE, 0);
               iosma_BiasSlow3 = iOsMA(NULL, 0, 55, 144, 89, PRICE_CLOSE, 0);
               iosma_BiasSlow4 = iOsMA(NULL, 0, 89, 233, 144, PRICE_CLOSE, 0);
               
               
               li_MarketBias = MarketBias(istochastic_Bias1);
               text_Bias1 = "__________________________________";
               text_Bias2 = "_____________________________";
               text_Bias3 = "---------------------------------------------";
               text_Bias4 = "----------------------------";
               string stoch_per=DoubleToStr(KperiodBias1,0);//ST=istochastic_Bias1
               
               switch ( li_MarketBias )
              {
               case 0: {ls_info = stoch_per+"-"+"NEUTRAL/TRENDING   ";  color_info = LimeGreen;} break;
               case 1: {ls_info = stoch_per+"-"+"SLIGHTLY OVERBOUGHT  ";color_info = Gold;}      break;
               case 2: {ls_info = stoch_per+"-"+"OVERBOUGHT        ";   color_info = LightCoral;}break;
               case 3: {ls_info = stoch_per+"-"+"ULTRA OVERBOUGHT!";    color_info = Red;}       break;
               case 4: {ls_info = stoch_per+"-"+"SLIGHTLY OVERSOLD  ";  color_info = Gold;}      break;
               case 5: {ls_info = stoch_per+"-"+"OVERSOLD         ";    color_info = LightCoral;}break;
               case 6: {ls_info = stoch_per+"-"+"ULTRA OVERSOLD!";      color_info = Red;}       break;
               default:ls_info = "";break;
              }

              li_ScalperTrendFast=ScalperTrend(iosma_BiasFast1,iosma_BiasFast2,iosma_BiasFast3,iosma_BiasFast4);
              
              switch ( li_ScalperTrendFast )
              {
               case 0: {
                  ls_info2 = "   STRONG BULLISH        ";
                  color_info2 = LimeGreen;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 48, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 47, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2", CharToStr(108), color_info2, 36, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2outline", CharToStr(161), Black, 35, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3", CharToStr(108), color_info2, 24, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3outline", CharToStr(161), Black, 23, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel4", CharToStr(108), color_info2, 12, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel4outline", CharToStr(161), Black, 11, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 1: {
                  ObjectDelete("MSPZULevel4");
                  ObjectDelete("MSPZULevel4Outline");
                  ls_info2 = "   BULLISH        ";
                  color_info2 = LimeGreen;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 49, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 48, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2", CharToStr(108), color_info2, 37, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2outline", CharToStr(161), Black, 36, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3", CharToStr(108), color_info2, 25, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3outline", CharToStr(161), Black, 24, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 2: {
                  ObjectDelete("MSPZULevel3");
                  ObjectDelete("MSPZULevel3Outline");
                  ObjectDelete("MSPZULevel4");
                  ObjectDelete("MSPZULevel4Outline");
                  ls_info2 = "   WEAK BULLISH        ";
                  color_info2 = LimeGreen;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 49, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 48, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2", CharToStr(108), color_info2, 37, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2outline", CharToStr(161), Black, 36, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 3: {
                  ObjectDelete("MSPZULevel2");
                  ObjectDelete("MSPZULevel2Outline");
                  ObjectDelete("MSPZULevel3");
                  ObjectDelete("MSPZULevel3Outline");
                  ObjectDelete("MSPZULevel4");
                  ObjectDelete("MSPZULevel4Outline");
                  ls_info2 = "   NEUTRAL        ";
                  color_info2 = LimeGreen;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 49, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 48, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 4: {
                  ls_info2 = "   STRONG BEARISH        ";
                  color_info2 = Red;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 48, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 47, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2", CharToStr(108), color_info2, 36, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2outline", CharToStr(161), Black, 35, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3", CharToStr(108), color_info2, 24, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3outline", CharToStr(161), Black, 23, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel4", CharToStr(108), color_info2, 12, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel4outline", CharToStr(161), Black, 11, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 5: {
                  ObjectDelete("MSPZULevel4");
                  ObjectDelete("MSPZULevel4Outline");
                  ls_info2 = "   BEARISH        ";
                  color_info2 = Red;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 49, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 48, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2", CharToStr(108), color_info2, 36, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2outline", CharToStr(161), Black, 35, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3", CharToStr(108), color_info2, 24, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel3outline", CharToStr(161), Black, 23, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 6: {
                  ObjectDelete("MSPZULevel3");
                  ObjectDelete("MSPZULevel3Outline");
                  ObjectDelete("MSPZULevel4");
                  ObjectDelete("MSPZULevel4Outline");
                  ls_info2 = "   WEAK BEARISH        ";
                  color_info2 = Red;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 49, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 48, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2", CharToStr(108), color_info2, 37, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel2outline", CharToStr(161), Black, 36, 94, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 7: {
                  ObjectDelete("MSPZULevel2");
                  ObjectDelete("MSPZULevel2Outline");
                  ObjectDelete("MSPZULevel3");
                  ObjectDelete("MSPZULevel3Outline");
                  ObjectDelete("MSPZULevel4");
                  ObjectDelete("MSPZULevel4Outline");
                  ls_info2 = "   NEUTRAL        ";
                  color_info2 = Red;
                  SetLabel("MSPZULevel1", CharToStr(108), color_info2, 49, 94, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZULevel1outline", CharToStr(161), Black, 48, 94, Dashboard_Corner, 11, "Wingdings");
                 } break; 
               }
                 
              li_ScalperTrendSlow=ScalperTrend(iosma_BiasSlow1,iosma_BiasSlow2,iosma_BiasSlow3,iosma_BiasSlow4);
               
              switch ( li_ScalperTrendSlow )
              {       
               case 0: {
                  ls_info3 = "   STRONG BULLISH        ";
                  color_info3 = LimeGreen;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 48, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 47, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2", CharToStr(108), color_info3, 36, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2outline", CharToStr(161), Black, 35, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3", CharToStr(108), color_info3, 24, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3outline", CharToStr(161), Black, 23, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel4", CharToStr(108), color_info3, 12, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel4outline", CharToStr(161), Black, 11, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 1: {
                  ObjectDelete("MSPZILevel4");
                  ObjectDelete("MSPZILevel4Outline");
                  ls_info3 = "   BULLISH        ";
                  color_info3 = LimeGreen;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 49, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 48, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2", CharToStr(108), color_info3, 37, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2outline", CharToStr(161), Black, 36, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3", CharToStr(108), color_info3, 25, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3outline", CharToStr(161), Black, 24, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 2: {
                  ObjectDelete("MSPZILevel3");
                  ObjectDelete("MSPZILevel3Outline");
                  ObjectDelete("MSPZILevel4");
                  ObjectDelete("MSPZILevel4Outline");
                  ls_info3 = "   WEAK BULLISH        ";
                  color_info3 = LimeGreen;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 49, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 48, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2", CharToStr(108), color_info3, 37, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2outline", CharToStr(161), Black, 36, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 3: {
                  ObjectDelete("MSPZILevel2");
                  ObjectDelete("MSPZILevel2Outline");
                  ObjectDelete("MSPZILevel3");
                  ObjectDelete("MSPZILevel3Outline");
                  ObjectDelete("MSPZILevel4");
                  ObjectDelete("MSPZILevel4Outline");
                  ls_info3 = "   NEUTRAL        ";
                  color_info3 = LimeGreen;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 49, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 48, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;       
               case 4: {
                  ls_info3 = "   STRONG BEARISH        ";
                  color_info3 = Red;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 48, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 47, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2", CharToStr(108), color_info3, 36, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2outline", CharToStr(161), Black, 35, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3", CharToStr(108), color_info3, 24, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3outline", CharToStr(161), Black, 23, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel4", CharToStr(108), color_info3, 12, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel4outline", CharToStr(161), Black, 11, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 5: {
                  ObjectDelete("MSPZILevel4");
                  ObjectDelete("MSPZILevel4Outline");
                  ls_info3 = "   BEARISH        ";
                  color_info3 = Red;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 49, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 48, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2", CharToStr(108), color_info3, 37, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2outline", CharToStr(161), Black, 36, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3", CharToStr(108), color_info3, 25, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel3outline", CharToStr(161), Black, 24, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 6: {
                  ObjectDelete("MSPZILevel3");
                  ObjectDelete("MSPZILevel3Outline");
                  ObjectDelete("MSPZILevel4");
                  ObjectDelete("MSPZILevel4Outline");
                  ls_info3 = "   WEAK BEARISH        ";
                  color_info3 = Red;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 49, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 48, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2", CharToStr(108), color_info3, 37, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel2outline", CharToStr(161), Black, 36, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               case 7: {
                  ObjectDelete("MSPZILevel2");
                  ObjectDelete("MSPZILevel2Outline");
                  ObjectDelete("MSPZILevel3");
                  ObjectDelete("MSPZILevel3Outline");
                  ObjectDelete("MSPZILevel4");
                  ObjectDelete("MSPZILevel4Outline");
                  ls_info3 = "   NEUTRAL        ";
                  color_info3 = LimeGreen;
                  SetLabel("MSPZILevel1", CharToStr(108), color_info3, 49, 75, Dashboard_Corner, 11, "Wingdings");
                  SetLabel("MSPZILevel1outline", CharToStr(161), Black, 48, 75, Dashboard_Corner, 11, "Wingdings");
                 } break;
               }
             }//
                
            if (Manual) ManualMode = TRUE;
             else ManualMode = FALSE;
            period_osc = PeriodK(Trading_Style, ManualMode, Range, Sensitivity);
            period_d   = PeriodD(Trading_Style, ManualMode, Range, Sensitivity);
            slowing_s  = PeriodS(Trading_Style, ManualMode, Range, Sensitivity);
            ld_DownOscLevel = DownOscLevel(Trading_Style, ManualMode, Range, Sensitivity);
            ld_UpOscLevel   = UpOscLevel(Trading_Style, ManualMode, Range, Sensitivity);
            li_PfStoch = PfStoch(Trading_Style, ManualMode);
            li_MaStoch = MaStoch(Trading_Style, ManualMode);
            li_MdStoch = MdStoch(Trading_Style, ManualMode);

            if (FlagRSI) ld_iRSI = iRSI(NULL, 0, RSIPeriod, RSIPrice, i);
             else {
               ld_iRSI      = 0;
               RSILevelDown = 0;
               RSILevelUp   = 0;
            }

            if (Manual) {
               istochastic_ModeManual  = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, li_MdStoch, i);
               istochastic_MODE_MAIN   = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, MODE_MAIN, i);
               istochastic_MODE_SIGNAL = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, MODE_SIGNAL, i);
               Osc_Shift0 = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, li_MdStoch, i + 1);
               Osc_Shift1 = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, li_MdStoch, i + 2);
               Osc_Shift2 = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, li_MdStoch, i + 3);
               Osc_Shift3 = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, li_MdStoch, i + 4);
            } else {
               istochastic_ModeManual  = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, li_MdStoch, i);
               istochastic_MODE_MAIN   = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, MODE_MAIN, i);
               istochastic_MODE_SIGNAL = iStochastic(NULL, 0, period_osc, period_d, slowing_s, li_MaStoch, li_PfStoch, MODE_SIGNAL, i);
               Osc_Shift0   = iDeMarker(NULL, 0, period_osc, i + 0);
               Osc_Shift1   = iDeMarker(NULL, 0, period_osc, i + 1);
               Osc_Shift2   = iDeMarker(NULL, 0, period_osc, i + 2);
               Osc_Shift3   = iDeMarker(NULL, 0, period_osc, i + 3);
               idemarker_4  = iDeMarker(NULL, 0, period_osc, i + 4);
               idemarker_5  = iDeMarker(NULL, 0, period_osc, i + 5);
               idemarker_6  = iDeMarker(NULL, 0, period_osc, i + 6);
               idemarker_7  = iDeMarker(NULL, 0, period_osc, i + 7);
               idemarker_8  = iDeMarker(NULL, 0, period_osc, i + 8);
               idemarker_9  = iDeMarker(NULL, 0, period_osc, i + 9);
               idemarker_10 = iDeMarker(NULL, 0, period_osc, i + 10);
               idemarker_11 = iDeMarker(NULL, 0, period_osc, i + 11);
               idemarker_12 = iDeMarker(NULL, 0, period_osc, i + 12);
            }
            
            if (FlagCCI) ld_iCCI = iCCI(NULL, 0, CCIPeriod, CCIPrice, i);
             else {
               ld_iCCI      = 0;
               CCILevelDown = 0;
               CCILevelUp   = 0;
            }
            if (FlagWPR) ld_iWPR = iWPR(NULL, 0, WPRPeriod, i);
             else {
               ld_iWPR      = 0;
               WPRLevelDown = 0;
               WPRLevelUp   = 0;
            }
            if (Flag2MA) {
               ld_iMAFast = iMA(NULL, 0, MAFastPeriod, MaFast_shift, MAFastMethod, MAFastPrice, i);
               ld_iMASlow = iMA(NULL, 0, MASlowPeriod, MaSlow_shift, MASlowMethod, MASlowPrice, i);
            } else {
               ld_iMAFast = 0;
               ld_iMASlow = 0;
            }
            if (FlagDeMarker) ld_iDeMarker = iDeMarker(NULL, 0, DeMarkerPeriod, i);
             else {
               ld_iDeMarker      = 0;
               DeMarkerLevelDown = 0;
               DeMarkerLevelUp   = 0;
            }
            
            SetLabel("TitleTextMSP", "MarketScalper PRO v5.5", Red, 5, 12, Dashboard_Corner, 9, "Arial Bold");

            if (!Manual && Trading_Style <= 1) {
               if (Filter_Signals) SetLabel("ModeMSP", "MODE: HIGH PROBABILITY (Filtered)", DeepSkyBlue, 5, 28, Dashboard_Corner, 8, "Arial");
                else SetLabel("ModeMSP", "MODE: HIGH PROBABILITY", DeepSkyBlue, 5, 27, Dashboard_Corner, 8, "Arial");
            }
            if (!Manual && Trading_Style == 2) {
               if (Filter_Signals) SetLabel("ModeMSP", "MODE: BALANCED (Filtered)", Yellow, 5, 27, Dashboard_Corner, 8, "Arial");
                else SetLabel("ModeMSP", "MODE: BALANCED", Yellow, 5, 27, Dashboard_Corner, 8, "Arial");
            }
            if (!Manual && Trading_Style >= 3) {
               if (Filter_Signals) SetLabel("ModeMSP", "MODE: AGGRESSIVE (Filtered)", Red, 5, 27, Dashboard_Corner, 8, "Arial");
                else SetLabel("ModeMSP", "MODE: AGGRESSIVE", Red, 5, 27, Dashboard_Corner, 8, "Arial");
            }

            if (Manual) {
               if (Filter_Signals) SetLabel("ModeMSP", "MANUAL MODE  |  RANGE: " + Range + "  SENSITIVITY: " + Sensitivity + " (Filtered)", Yellow, 5, 27, Dashboard_Corner, 8, "Arial");
                else SetLabel("ModeMSP", "MANUAL MODE  |  RANGE: " + Range + "  SENSITIVITY: " + Sensitivity , Yellow, 5, 27, Dashboard_Corner, 8, "Arial");
            }

         SetLabel("MSPBias", DoubleToStr(istochastic_Bias1, 0), color_info, 11, 52, Dashboard_Corner, 11, "Arial Bold");
         SetLabel("MSPBiasFrame", text_Bias1, color_info, 6, 37, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPBiasFrame2", text_Bias1, color_info, 6, 36, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPBiasFrame3", text_Bias1, color_info, 6, 35, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPBiasFrameBottom", text_Bias1, color_info, 9, 61, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPTrendFrame", text_Bias3, color_info, 30, 84, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPTrendFrameBrown", text_Bias4, Black, 6, 88, Dashboard_Corner, 5, "Arial");
         SetLabel("MSPTrendFrameBottom", text_Bias2, color_info, 30, 96, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPTrendFrameBottom2", text_Bias2, color_info, 30, 97, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPTrendFrameBottom3", text_Bias2, color_info, 30, 98, Dashboard_Corner, 8, "Arial");
         SetLabel("MSPBiasTxt", " " + ls_info, color_info, 40, 54, Dashboard_Corner, 8, "Arial Bold");
         SetLabel("MSPBiasBox", CharToStr(168), color_info, 3, 41, Dashboard_Corner, 28, "Wingdings");
         SetLabel("MSPBiasBoxL", CharToStr(168), color_info, 185, 41, Dashboard_Corner, 28, "Wingdings");
         SetLabel("MSPBiasBoxLTxt", "ST", color_info, 194, 52, Dashboard_Corner, 10, "Arial Bold");//istochastic_Bias1
         SetLabel("MSPSnapShotPaint", CharToStr(110), color_info, 185, 62, Dashboard_Corner, 34, "Wingdings");
         SetLabel("MSPSnapShotPaint2", CharToStr(110), color_info, 185, 74, Dashboard_Corner, 34, "Wingdings");
         SetLabel("MSPSnapShotPaint3", CharToStr(110), color_info, 2, 62, Dashboard_Corner, 34, "Wingdings");
         SetLabel("MSPSnapShotPaint4", CharToStr(110), color_info, 2, 74, Dashboard_Corner, 34, "Wingdings");
         SetLabel("MSPSnapShotPaint5", CharToStr(110), color_info, 2, 58, Dashboard_Corner, 48, "Wingdings");
         SetLabel("MSPSnapShotPaint3L", CharToStr(110), color_info, 32, 62, Dashboard_Corner, 34, "Wingdings");
         SetLabel("MSPSnapShotPaint4L", CharToStr(110), color_info, 32, 74, Dashboard_Corner, 34, "Wingdings");
         SetLabel("MSPSnapShotZIDot", CharToStr(108), Black, 49, 75, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZIDot2", CharToStr(108), Black, 36, 75, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZIDot3", CharToStr(108), Black, 24, 75, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZIDot4", CharToStr(108), Black, 12, 75, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZUDot", CharToStr(108), Black, 49, 94, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZUDot2", CharToStr(108), Black, 36, 94, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZUDot3", CharToStr(108), Black, 24, 94, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPSnapShotZUDot4", CharToStr(108), Black, 12, 94, Dashboard_Corner, 11, "Wingdings");
         SetLabel("MSPTrendBoxLI", CharToStr(110), Black, 192, 69, Dashboard_Corner, 20, "Wingdings");
         SetLabel("MSPTrendBoxLITxt", "BT", color_info3, 195, 76, Dashboard_Corner, 9, "Arial Bold");//Big Trend
         SetLabel("MSPTrendBoxLU", CharToStr(110), Black, 192, 86, Dashboard_Corner, 20, "Wingdings");
         SetLabel("MSPTrendBoxLUTxt", "LT", color_info2, 195, 93, Dashboard_Corner, 9, "Arial Bold");//Little Trend
         SetLabel("MSPTrendIm", " " + ls_info3, color_info3, 55, 76, Dashboard_Corner, 8, "Arial Bold");
         SetLabel("MSPTrendUn", " " + ls_info2, color_info2, 55, 94, Dashboard_Corner, 8, "Arial Bold");
         
         if (!Display_Market_Bias) {
          for (int j=ObjectsTotal(); j>= 0; j--) {
           string name = ObjectName(j);
            if (StringSubstr(name,0,3) == "MSP") ObjectDelete(name);  
           }
         }
            if (Manual) ld_Manual = 1;
             else ld_Manual = 0;
            lda_Array[0] = ld_iRSI;
            lda_Array[1] = RSILevelDown;
            lda_Array[2] = RSILevelUp;
            lda_Array[3] = ld_iCCI;
            lda_Array[4] = istochastic_MODE_MAIN;
            lda_Array[5] = istochastic_MODE_SIGNAL;
            lda_Array[6] = istochastic_ModeManual;
            lda_Array[7] = Osc_Shift0;
            lda_Array[8] = Osc_Shift1;
            lda_Array[9] = Osc_Shift2;
            lda_Array[10] = Osc_Shift3;
            lda_Array[11] = idemarker_4;
            lda_Array[12] = idemarker_5;
            lda_Array[13] = idemarker_6;
            lda_Array[14] = idemarker_7;
            lda_Array[15] = idemarker_8;
            lda_Array[16] = idemarker_9;
            lda_Array[17] = idemarker_10;
            lda_Array[18] = idemarker_11;
            lda_Array[19] = idemarker_12;
            lda_Array[20] = istochastic_MODE_MAIN;
            lda_Array[21] = istochastic_MODE_SIGNAL;
            if (Manual) lda_Array[22] = ld_DownOscLevel;
             else lda_Array[22] = ld_DownOscLevel/100;
            if (Manual) lda_Array[23] = ld_UpOscLevel;
             else lda_Array[23] = ld_UpOscLevel/100;
            lda_Array[24] = ld_iWPR;
            lda_Array[25] = WPRLevelDown;
            lda_Array[26] = WPRLevelUp;
            lda_Array[27] = ld_iDeMarker;
            lda_Array[28] = DeMarkerLevelDown;
            lda_Array[29] = DeMarkerLevelUp;
            lda_Array[30] = istochastic_Bias2;
            lda_Array[31] = ld_Manual;
            lda_Array[32] = CCILevelUp;
            lda_Array[33] = CCILevelDown;
            lda_Array[34] = ld_iMAFast;
            lda_Array[35] = ld_iMASlow;
            
            if (Filter_Signals) li_Filter_Signals = TRUE;
             else li_Filter_Signals = FALSE;
             
            li_ProcessSignal = ProcessSignal(lda_Array, li_Filter_Signals);
            
            if (li_ProcessSignal == 1) g_ibuf_BUY[i] = Low[i] - Arrow_Distance * Point;
             else if (li_ProcessSignal == 0) g_ibuf_SELL[i] = High[i] + Arrow_Distance * Point;        
       }
      if (Alert_On) Alert_PlaySound_SendMail();
   return (0);
}
//==================================================================================================================
void Alert_PlaySound_SendMail() {

   string ls_ms = "MS PRO";

   if (g_ibuf_BUY[1] == Low[1] - Arrow_Distance * Point && gi_flag_alert != Time[0]) {
      if (Alert_PopUp_On) Alert(ls_ms + ": BUY | " + Symbol() + " " + TfToStr(Period()) + " | ", TimeToStr(TimeLocal(), TIME_SECONDS), " | " + DoubleToStr(Ask, 4));
      PlaySound(ProcessBuySound(Buy_Sound));
       gi_flag_alert = Time[0];
      if (Send_Email) {
         SendMail(ls_ms + " Alert! ", Symbol() + " " + TfToStr(Period()) + " - BUY  signal issued at " + TimeToStr(TimeLocal(), TIME_SECONDS) + " on " + TimeToStr(TimeCurrent(),
            TIME_DATE) + " (Last price: " + DoubleToStr(Ask, 4) + ")" + "\r\n \r\n Delivered via MarketScalper PRO");
      }
   }
   if (g_ibuf_SELL[1] == High[1] + Arrow_Distance * Point && gi_flag_alert != Time[0]) {
      if (Alert_PopUp_On) Alert(ls_ms + ": SELL | " + Symbol() + " " + TfToStr(Period()) + " | ", TimeToStr(TimeLocal(), TIME_SECONDS), " | " + DoubleToStr(Ask, 4));
      PlaySound(ProcessSellSound(Sell_Sound));
      gi_flag_alert = Time[0];
      if (Send_Email) {
         SendMail(ls_ms + " Alert! ", Symbol() + " " + TfToStr(Period()) + " - SELL signal issued at " + TimeToStr(TimeLocal(), TIME_SECONDS) + " on " + TimeToStr(TimeCurrent(),
            TIME_DATE) + " (Last price: " + DoubleToStr(Ask, 4) + ")" + "\r\n \r\n Delivered via MarketScalper PRO");
      }
   }
}
//==================================================================================================
string TfToStr(int tf) {
  switch (tf)  {
    case     1 :  return("M1");
    case     5 :  return("M5");
    case    15 :  return("M15");
    case    30 :  return("M30");
    case    60 :  return("H1");
    case   240 :  return("H4");
    case  1440 :  return("D1");
    case 10080 :  return("W1");
    case 43200 :  return("MN");
  }
  return(StringConcatenate("TF", Period()));
} 
//==================================================================================================
void deinit() {
   for (int j=ObjectsTotal(); j>= 0; j--) {
    string name = ObjectName(j);
     if (StringSubstr(name,0,3) == "MSP" || StringSubstr(name,StringLen(name)-3,3)=="MSP")
         ObjectDelete(name);  
   }
}
//==================================================================================================
int MarketBias(double stochBias1)
{
  if ( stochBias1 > 99.0  && stochBias1 <= 100.0) return (3);
  if ( stochBias1 < 1.0   && stochBias1 >= 0.0  ) return (6);
  if ( stochBias1 <=68.0  && stochBias1 >= 32.0 ) return (0);
  if ( stochBias1 > 68.0  && stochBias1 <= 75.0 ) return (1);
  if ( stochBias1 > 75.0  && stochBias1 <= 83.0 ) return (2);
  if ( stochBias1 > 83.0 ) return (3);
  if ( stochBias1 < 32.0  && stochBias1 >= 25.0 ) return (4);
  if ( stochBias1 < 25.0  && stochBias1 >= 17.0 ) return (5);
  if ( stochBias1 < 17.0 ) return (6);
   else return (10);
}
//==================================================================================================
int PeriodK(int Trading_Style, bool ManualMode, int Range, int Sensitivity)
{
  if ( Trading_Style == 1 && !ManualMode) return (8);
  if ( Trading_Style == 2 && !ManualMode) return (12);
  if ( Trading_Style == 3 && !ManualMode) return (10);
  if ( !ManualMode ) return (8);
  if ( ManualMode  ) return (Range);
}
//==================================================================================================
int PeriodD(int Trading_Style, bool ManualMode, int Range, int Sensitivity)
{
  if ( Trading_Style == 1 && !ManualMode) return (8);
  if ( Trading_Style == 2 && !ManualMode) return (6);
  if ( Trading_Style == 3 && !ManualMode) return (1);
  if ( !ManualMode ) return (8);
  if ( ManualMode  ) return (Range/3);
}
//==================================================================================================
int PeriodS(int Trading_Style, bool ManualMode, int Range, int Sensitivity)
{
 int result;
  result = Trading_Style; if(result<0 || result>3) result=1;
  if ( Trading_Style == 1 && !ManualMode) return (result);
  if ( Trading_Style == 2 && !ManualMode) return (result);
  if ( Trading_Style == 3 && !ManualMode) return (result);
  if ( !ManualMode ) return (result);
  if ( ManualMode  ) return (1);
}
//==================================================================================================
int DownOscLevel(int Trading_Style, bool ManualMode, int Range, int Sensitivity)
{
  if ( Trading_Style == 1 && !ManualMode) return (28);
  if ( Trading_Style == 2 && !ManualMode) return (30);
  if ( Trading_Style == 3 && !ManualMode) return (40);
  if ( !ManualMode ) return (28);
  if ( ManualMode  ) return (Sensitivity);
}
//==================================================================================================
int UpOscLevel(int Trading_Style, bool ManualMode, int Range, int Sensitivity)
{
  if ( Trading_Style == 1 && !ManualMode) return (72);
  if ( Trading_Style == 2 && !ManualMode) return (70);
  if ( Trading_Style == 3 && !ManualMode) return (60);
  if ( !ManualMode ) return (72);
  if ( ManualMode  ) return (100-Sensitivity);
}
//==================================================================================================
int PfStoch(int Trading_Style, bool ManualMode)
{
  int result=Trading_Style;
  if(result<0 || result>3) result=1;
  if ( Trading_Style == 1 || Trading_Style != 2 || ManualMode ) result = 0;
  return (result);
}
//==================================================================================================
int MaStoch(int Trading_Style, bool ManualMode)
{
  if ( Trading_Style == 1 && !ManualMode) return (0);
  if ( Trading_Style == 2 && !ManualMode) return (3);
  if ( Trading_Style == 3 && !ManualMode) return (0);
  if ( !ManualMode ) return (0);
  if ( ManualMode  ) return (2);
}
//==================================================================================================
int MdStoch(int Trading_Style, bool ManualMode)
{
  if ( Trading_Style == 1 && !ManualMode) return (0);
  if ( Trading_Style == 2 && !ManualMode) return (1);
  if ( Trading_Style == 3 && !ManualMode) return (1);
  if ( !ManualMode ) return (0);
  if ( ManualMode  ) return (1);
}
//==================================================================================================
string ProcessBuySound(int Buy_Sound)
{
  string result;
  switch ( Buy_Sound )
  {
    case 0: result = "buy.wav";break;
    case 1: result = "alert.wav";break;
    case 2: result = "alert2.wav";break;
    case 3: result = "connect.wav";break;
    case 4: result = "disconnect.wav";break;
    case 5: result = "email.wav";break;
    case 6: result = "expert.wav";break;
    case 7: result = "news.wav";break;
    case 8: result = "ok.wav";break;
    case 9: result = "stops.wav";break;
    case 10:result = "tick.wav";break;
    case 11:result = "timeout.wav";break;
    case 12:result = "wait.wav";break;
    default:result = "alert.wav";break;
  }
  return (result);
}
//==================================================================================================
string ProcessSellSound(int Sell_Sound)
{
  string result;
  switch ( Sell_Sound )
  {
    case 0: result = "sell.wav";break;
    case 1: result = "alert.wav";break;
    case 2: result = "alert2.wav";break;
    case 3: result = "connect.wav";break;
    case 4: result = "disconnect.wav";break;
    case 5: result = "email.wav";break;
    case 6: result = "expert.wav";break;
    case 7: result = "news.wav";break;
    case 8: result = "ok.wav";break;
    case 9: result = "stops.wav";break;
    case 10:result = "tick.wav";break;
    case 11:result = "timeout.wav";break;
    case 12:result = "wait.wav";break;
    default:result = "alert.wav";break;
  }
  return (result);
}
//==================================================================================================
int ProcessSignal(double lda_Array[],int li_Filter_Signals)
{
  double v1,v2;
   if(li_Filter_Signals != 1) v1 = 100; else  v1 = LevelStochDownBias2;
   if(li_Filter_Signals != 1) v2 = 0;   else  v2 = LevelStochUpBias2;

    if ( 1.0 == lda_Array[31])//ld_Manual
    {
      if ( lda_Array[0]  <= lda_Array[1]//ld_iRSI,RSILevelDown
        && lda_Array[3]  <= lda_Array[33]//ld_iCCI,CCILevelDown;
        && lda_Array[4]  >  lda_Array[5]//istochastic_MODE_MAIN,istochastic_MODE_SIGNAL,
        && lda_Array[6]  >= lda_Array[22]//istochastic_ModeManual,ld_DownOscLevel,
        && lda_Array[7]  <  lda_Array[22]//Osc_Shift0,ld_DownOscLevel,
        && lda_Array[8]  >  lda_Array[9]//Osc_Shift1,Osc_Shift2,
        && lda_Array[8]  <  lda_Array[22]//Osc_Shift1,ld_DownOscLevel,
        && lda_Array[9]  <  lda_Array[22]//Osc_Shift2,ld_DownOscLevel,
        && lda_Array[10] <  lda_Array[22]//Osc_Shift3,ld_DownOscLevel,
        && lda_Array[24] <= lda_Array[25]//ld_iWPR,WPRLevelDown
        && lda_Array[27] <= lda_Array[28]//ld_iDeMarker,DeMarkerLevelDown
        && lda_Array[34] <= lda_Array[35]//ld_iMAFast,ld_iMASlow
        && lda_Array[30] <= v1 )//istochastic_Bias2,LevelStochDownBias2
        return (1);//buy

      if ( lda_Array[0]  >= lda_Array[2]//ld_iRSI,RSILevelUp
        && lda_Array[3]  >= lda_Array[32]//ld_iCCI,CCILevelUp
        && lda_Array[4]  <  lda_Array[5]//istochastic_MODE_MAIN,istochastic_MODE_SIGNAL,
        && lda_Array[6]  <= lda_Array[23]//istochastic_ModeManual,ld_UpOscLevel,
        && lda_Array[7]  >  lda_Array[23]//Osc_Shift0,ld_UpOscLevel,
        && lda_Array[8]  <  lda_Array[9]//Osc_Shift1,Osc_Shift2,
        && lda_Array[8]  >  lda_Array[23]//Osc_Shift1,ld_UpOscLevel,
        && lda_Array[9]  >  lda_Array[23]//Osc_Shift2,ld_UpOscLevel,
        && lda_Array[10] >  lda_Array[23]//Osc_Shift3,ld_UpOscLevel,
        && lda_Array[24] >= lda_Array[26]//ld_iWPR,WPRLevelUp
        && lda_Array[27] >= lda_Array[29]//ld_iDeMarker,DeMarkerLevelUp
        && lda_Array[34] <= lda_Array[35]//ld_iMAFast,ld_iMASlow
        && lda_Array[30] >= v2 )//istochastic_Bias2,LevelStochUpBias2
        return (0);//sell
    }
    else
    {
      if ( lda_Array[7]  >= lda_Array[22]//Osc_Shift0,ld_DownOscLevel,
        && lda_Array[8]  <  lda_Array[22]//Osc_Shift1,ld_DownOscLevel,
        && lda_Array[9]  <  lda_Array[22]//Osc_Shift2,ld_DownOscLevel,
        && lda_Array[10] <  lda_Array[22]//Osc_Shift3,ld_DownOscLevel,
        && lda_Array[11] <  lda_Array[22]//idemarker_4,ld_DownOscLevel,
        && lda_Array[12] <  lda_Array[22]//idemarker_5,ld_DownOscLevel,
        && lda_Array[13] <  lda_Array[22]//idemarker_6,ld_DownOscLevel,
        && lda_Array[14] <  lda_Array[22]//idemarker_7,ld_DownOscLevel,
        && lda_Array[15] <  lda_Array[22]//idemarker_8,ld_DownOscLevel,
        && lda_Array[16] <  lda_Array[22]//idemarker_9,ld_DownOscLevel,
        && lda_Array[17] <  lda_Array[22]//idemarker_10,ld_DownOscLevel,
        && lda_Array[18] <  lda_Array[22]//idemarker_11,ld_DownOscLevel,
        && lda_Array[19] <  lda_Array[22]//idemarker_12,ld_DownOscLevel,
        && lda_Array[30] <= v1 )//istochastic_Bias2,LevelStochDownBias2
        return (1);//buy
        
      if ( lda_Array[7]  <= lda_Array[23]//Osc_Shift0,ld_UpOscLevel,
        && lda_Array[8]  >  lda_Array[23]//Osc_Shift1,ld_UpOscLevel,
        && lda_Array[9]  >  lda_Array[23]//Osc_Shift2,ld_UpOscLevel,
        && lda_Array[10] >  lda_Array[23]//Osc_Shift3,ld_UpOscLevel,
        && lda_Array[11] >  lda_Array[23]//idemarker_4,ld_UpOscLevel,
        && lda_Array[12] >  lda_Array[23]//idemarker_5,ld_UpOscLevel,
        && lda_Array[13] >  lda_Array[23]//idemarker_6,ld_UpOscLevel,
        && lda_Array[14] >  lda_Array[23]//idemarker_7,ld_UpOscLevel,
        && lda_Array[15] >  lda_Array[23]//idemarker_8,ld_UpOscLevel,
        && lda_Array[16] >  lda_Array[23]//idemarker_9,ld_UpOscLevel,
        && lda_Array[17] >  lda_Array[23]//idemarker_10,ld_UpOscLevel,
        && lda_Array[18] >  lda_Array[23]//idemarker_11,ld_UpOscLevel,
        && lda_Array[19] >  lda_Array[23]//idemarker_12ld_UpOscLevel,
        && lda_Array[30] >= v2 )//istochastic_Bias2,LevelStochUpBias2
        return (0);//sell
    }
    return (10);
}
//==================================================================================================
int ScalperTrend(double iosma_Bias1, double iosma_Bias2,double iosma_Bias3, double iosma_Bias4)
{
  if (iosma_Bias4 >= 0.0) {
   
    if(iosma_Bias3 > 0.0
    && iosma_Bias2 > 0.0
    && iosma_Bias1 > 0.0 ) return (0);
     
    if(iosma_Bias3 > 0.0
    && iosma_Bias2 > 0.0
    && iosma_Bias1 < 0.0 ) return (1); 
     
    if(iosma_Bias3 > 0.0
    && iosma_Bias2 < 0.0
    && iosma_Bias1 < 0.0 ) return (2);
    
    if(iosma_Bias3 < 0.0
    && iosma_Bias2 < 0.0
    && iosma_Bias1 < 0.0 ) return (3);
    return (3);
   }
      
  if (iosma_Bias4 < 0.0) {
   
    if(iosma_Bias3 < 0.0
    && iosma_Bias2 < 0.0
    && iosma_Bias1 < 0.0 ) return (4);
      
    if(iosma_Bias3 < 0.0
    && iosma_Bias2 < 0.0
    && iosma_Bias1 > 0.0 ) return (5);
     
    if(iosma_Bias3 < 0.0
    && iosma_Bias2 > 0.0
    && iosma_Bias1 > 0.0 ) return (6); 
        
    if(iosma_Bias3 > 0.0
    && iosma_Bias2 > 0.0
    && iosma_Bias1 > 0.0 ) return (7);
    return (7);
   } 
}
//==================================================================================================
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 18.01.2012                                                     |
//|  Описание : Установка текстовой метки, объект OBJ_LABEL.                   |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    nm - наименование объекта                                               |
//|    tx - текст                                                              |
//|    cl - цвет метки                                                         |
//|    xd - координата X в пикселах                                            |
//|    yd - координата Y в пикселах                                            |
//|    cr - номер угла привязки        (0 - левый верхний,                     |
//|                                     1 - правый верхний,                    |
//|                                     2 - левый нижний,                      |
//|                                     3 - правый нижний )                    |
//|    fs - размер шрифта              (9 - по умолчанию  )                    |
//|    fn - наименование шрифта    (Arial - по умолчанию  )                    |
//+----------------------------------------------------------------------------+
void SetLabel(string nm, string tx, color cl, int xd, int yd, int cr=0, int fs=9, string fn="Arial") {
  if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_LABEL, 0, 0,0);
  ObjectSetText(nm, tx, fs, fn);
  ObjectSet(nm, OBJPROP_COLOR    , cl);
  ObjectSet(nm, OBJPROP_XDISTANCE, xd);
  ObjectSet(nm, OBJPROP_YDISTANCE, yd);
  ObjectSet(nm, OBJPROP_CORNER   , cr);
  ObjectSet(nm, OBJPROP_FONTSIZE , fs);
}
//==================================================================================================
/*int ScalperTrendLT(double iosma_Bias1, double iosma_Bias2)
{
  if ( iosma_Bias1 >= 0.0 ) 
  {
    if ( iosma_Bias2 > 0.0 ) return (0);
    if ( iosma_Bias2 < 0.0 ) return (1);
  }
  if ( iosma_Bias1 <= 0.0 )
  {
    if ( iosma_Bias2 < 0.0 ) return (2);
    if ( iosma_Bias2 > 0.0 ) return (3);
  }
   else return (10);
}*/
//==================================================================================================
/*int ScalperTrendST(double iosma_Bias3, double iosma_Bias4)
{

  if ( iosma_Bias3 >= 0.0 )
  {
    if ( iosma_Bias4 < 0.0 ) return (0);
    if ( iosma_Bias4 > 0.0 ) return (1);
  }
  if ( iosma_Bias3 <= 0.0 )
  {
    if ( iosma_Bias4 > 0.0 ) return (2);
    if ( iosma_Bias4 < 0.0 ) return (3);
  }
  else return (10);
}*/
//==================================================================================================

Recommend