//+------------------------------------------------------------------+ //| Hamadaramadan23@gmail.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2022"; #property link "Hamadaramadan23@gmail.com"; #property version "5.0"; #property indicator_chart_window //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// bool Use_Auto_Generated_Password = false; string My_Password ="Hamadaramadan23"; string expiry = "2024.12.30"; bool CheckLicense_Account_Number = false; int liveAccountNumber1 = 8374757; int liveAccountNumber2 = 737213; int liveAccountNumber3 = 737213; int liveAccountNumber4 = 737213; int liveAccountNumber5 = 737213; int liveAccountNumber6 = 737213; int liveAccountNumber7 = 737213; int liveAccountNumber8 = 737213; int liveAccountNumber9 = 737213; //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// #property indicator_buffers 9 #property indicator_color1 clrRed #property indicator_label1 "Sell" #property indicator_style1 STYLE_SOLID #property indicator_type1 DRAW_ARROW #property indicator_width1 2 #property indicator_color2 clrDodgerBlue #property indicator_label2 "Buy" #property indicator_style2 STYLE_SOLID #property indicator_type2 DRAW_ARROW #property indicator_width2 2 #property indicator_label3 "Signal" #property indicator_label4 "Last Signal" #property indicator_color5 clrGreen #property indicator_label5 "TP" #property indicator_width5 1 #property indicator_color6 clrRed #property indicator_label6 "SL" #property indicator_width6 1 #property indicator_color7 clrGreen #property indicator_label7 "TP" #property indicator_width7 1 #property indicator_color8 clrRed #property indicator_label8 "SL" #property indicator_width8 1 #property indicator_color9 clrGreen #property indicator_label9 "TP" #property indicator_width9 1 #property indicator_color10 clrRed #property indicator_label10 "SL" #property indicator_width10 1 enum Strategy_Check { Strategy_1=1, //Strategy 1 Strategy_2=2, //Strategy 2 }; string Base_Indi1="MKFX2_HTF1"; string Base_Indi2="MKFX2_HTF2"; string Base_Indi3="MKFX2_HTF3"; extern string Password="Hamadaramadan23"; extern ENUM_TIMEFRAMES Fix_Main_TimeFrame=PERIOD_H1; extern bool Allow_Chart_Refresh=false; extern Strategy_Check Strategy=Strategy_2; extern Strategy_Check Strategy2=Strategy_2; extern bool Show_One_Signal_Per_Confirmation=true; extern bool Confirmation_For_Both_Set_TimeFrames=true; extern int MaxBars = 500; extern int Candles_Signal_Detect = 5; extern bool Send_Email = true; extern bool Audible_Alerts = false; extern bool Push_Notifications = true; extern ENUM_TIMEFRAMES Fix_TimeFrame=PERIOD_H1; extern ENUM_TIMEFRAMES TimeFrame1 = PERIOD_H1; extern ENUM_TIMEFRAMES TimeFrame2 = PERIOD_H4; extern ENUM_TIMEFRAMES TimeFrame3 = PERIOD_D1; extern ENUM_TIMEFRAMES Fix_HTF_TimeFrame=PERIOD_H4; extern ENUM_TIMEFRAMES HTF_TimeFrame1 = PERIOD_H1; extern ENUM_TIMEFRAMES HTF_TimeFrame2 = PERIOD_H4; extern ENUM_TIMEFRAMES HTF_TimeFrame3 = PERIOD_D1; extern ENUM_TIMEFRAMES Fix_Second_TimeFrame=PERIOD_H1; extern ENUM_TIMEFRAMES Second_TimeFrame1 = PERIOD_H1; extern ENUM_TIMEFRAMES Second_TimeFrame2 = PERIOD_H4; extern ENUM_TIMEFRAMES Second_TimeFrame3 = PERIOD_D1; extern ENUM_TIMEFRAMES Fix_HTF_Second_TimeFrame=PERIOD_H4; extern ENUM_TIMEFRAMES HTF_Second_TimeFrame1 = PERIOD_H1; extern ENUM_TIMEFRAMES HTF_Second_TimeFrame2 = PERIOD_H4; extern ENUM_TIMEFRAMES HTF_Second_TimeFrame3 = PERIOD_D1; extern bool Use_MACD_Filter=false; extern bool Reverse_MACD_Filter=true; extern ENUM_TIMEFRAMES MACD_Time_Frame=PERIOD_CURRENT; extern int Fast_EMA_Period=12; extern int Slow_EMA_Period=26; extern int Signal_Period=9; extern ENUM_APPLIED_PRICE Applied_Price=PRICE_CLOSE; extern bool Use_MA_Filter=false; extern ENUM_TIMEFRAMES MA_TimeFrame=PERIOD_CURRENT; extern int MA_Period=50; extern ENUM_MA_METHOD MA_Method=MODE_SMA; extern ENUM_APPLIED_PRICE Applied_Price_MA=PRICE_CLOSE; extern bool Use_Candle_Filter=false; extern bool Reverse_Candle=false; extern ENUM_TIMEFRAMES Candle_Time_Frame=PERIOD_CURRENT; extern bool Use_Vectors_Filter=false; extern ENUM_TIMEFRAMES Vectors_Time_Frame=PERIOD_CURRENT; extern int Vector_Candles=1; extern int Vectors_Period=14; extern bool Use_TrendDetection_Filter=false; extern ENUM_TIMEFRAMES TrendDetection_Time_Frame=PERIOD_CURRENT; extern double TrendDetection_ATRMultiplier=3.0; //Trend Detection ATR Multiplier extern int TrendDetection_ATRPeriod=14; //Trend Detection Period extern int TrendDetection_ATRMaxBars=1000; //Trend Detection Max Bars (Max 10.000) extern bool Use_RSI_Filter=false; extern ENUM_TIMEFRAMES RSI_Time_Frame=PERIOD_CURRENT; extern int RSI_Period=14; extern double RSI_Buy_Above_Level=60; extern double RSI_Sell_Below_Level=40; extern bool Use_MACD_Divergence_Filter=false; extern int Last_X_Candles=5; extern ENUM_TIMEFRAMES MACD_Divergence_Time_Frame=PERIOD_CURRENT; extern int FastMAPeriod=12; extern int SlowMAPeriod=26; extern int SignalMAPeriod=9; string inp51=""; string inp52=""; bool inp53=false; bool inp54=false; bool inp55=false; enum SLmethod {Candle_Based,ATR_Based,}; input string description_1 = "********* ATR Based SL/TP Settings ***********";//========== ATR Based SL/TP Settings ========== input bool Draw_ATR_values=false; //Draw Profit/Loss lines input ENUM_TIMEFRAMES ATR_Timeframe=PERIOD_CURRENT; input int ATR_Period=14; input double ATR_TP_Multiplier=2; input double ATR_SL_Multiplier=2; input int Arrow_Distance=200; input int Line_Type=160; input SLmethod SL_Method=Candle_Based; input ENUM_TIMEFRAMES SL_Timeframe=PERIOD_CURRENT; input int SL_Candles=5; input double SL_Difference=50; input double TP_Difference=50; int Width_x=5; long Current_Bar; int Bars_count; double Moving_Average_1; double Moving_Average_2; double Moving_Average_3; double Moving_Average_1_222; double Moving_Average_2_222; double Moving_Average_3_222; int TF1_shifted; int TF2_Bar_shifted; int TF1_222_shifted; int TF2_Bar_222_shifted; double Buy_Buffer[]; double Sell_Buffer[]; double last_Buffer[]; double Candles_Buffer[]; double TP_Buffer[]; double SL_Buffer[]; double TP_Buffer2[]; double SL_Buffer2[]; double TP_Buffer3[]; double SL_Buffer3[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ string client = NULL; // Make sure the client is online in order to get his client name and account number string mon=""; if(Month()<10) mon="0"+string(Month()); else mon=string(Month()); client = "$"+mon+string(Year()); // Check client's password if(!Password_Check(client) && Use_Auto_Generated_Password) { MessageBox("Wrong Password or your Password is expired." + "\nPlease Contact hamadaramadan23@gmail.com to get updated password","Password Expired", MB_OK | MB_ICONSTOP); // Invalid password or user is offline. Remove expert and exit with error ExpertRemove(); return(INIT_FAILED); } if(!Use_Auto_Generated_Password && Password!=My_Password) { MessageBox("Wrong Password or your Password is expired." + "\nPlease Contact hamadaramadan23@gmail.com to get updated password","Wrong Password", MB_OK | MB_ICONSTOP); // Invalid password or user is offline. Remove expert and exit with error ExpertRemove(); return(INIT_FAILED); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ Current_Bar = 0; if(Allow_Chart_Refresh) RefreshChart_Current(); IndicatorBuffers(9); SetIndexBuffer(0, Sell_Buffer); SetIndexBuffer(1, Buy_Buffer); SetIndexBuffer(2, last_Buffer); SetIndexBuffer(3, Candles_Buffer); //SetIndexStyle (4,DRAW_LINE,STYLE_SOLID,10); //SetIndexStyle (5,DRAW_LINE,STYLE_SOLID,10); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,Line_Type); SetIndexBuffer(4,TP_Buffer); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,Line_Type); SetIndexBuffer(5,SL_Buffer); SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,Line_Type); SetIndexBuffer(6,TP_Buffer2); SetIndexStyle(7,DRAW_ARROW); SetIndexArrow(7,Line_Type); SetIndexBuffer(7,SL_Buffer2); SetIndexStyle(8,DRAW_ARROW); SetIndexArrow(8,Line_Type); SetIndexBuffer(8,TP_Buffer3); SetIndexStyle(9,DRAW_ARROW); SetIndexArrow(9,Line_Type); SetIndexBuffer(9,SL_Buffer3); SetIndexArrow(0,234); SetIndexArrow(1,233); SetIndexStyle(2,DRAW_NONE); SetIndexStyle(3,DRAW_NONE); if(!Draw_ATR_values) { SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_NONE); SetIndexStyle(6,DRAW_NONE); SetIndexStyle(7,DRAW_NONE); SetIndexStyle(8,DRAW_NONE); SetIndexStyle(9,DRAW_NONE); } SetIndexEmptyValue(0, 2147483647); SetIndexEmptyValue(1, 2147483647); SetIndexEmptyValue(4, 0); SetIndexEmptyValue(5, 0); SetIndexEmptyValue(6, 0); SetIndexEmptyValue(7, 0); SetIndexEmptyValue(8, 0); SetIndexEmptyValue(9, 0); ArrayInitialize(Buy_Buffer, 2147483647); ArrayInitialize(Sell_Buffer, 2147483647); ArrayInitialize(last_Buffer, 0); ArrayInitialize(Candles_Buffer, 0); ArrayInitialize(TP_Buffer, 0); ArrayInitialize(SL_Buffer, 0); ArrayInitialize(TP_Buffer2, 0); ArrayInitialize(SL_Buffer2, 0); ArrayInitialize(TP_Buffer3, 0); ArrayInitialize(SL_Buffer3, 0); return 0; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deinit() { } int last=0; int Second_last=0; int Second_confirmation=0; int Prev_confirmation=0; bool NewSignal=false; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// if(TimeCurrent()>StringToTime(expiry)) { ShowAlert("EX","LICENSE EXPIRED !! Please Contact the developer",(int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0)/2,8); return; } else ObjectDelete(0,"EX"); bool AccountCheck=false; if((AccountNumber() == liveAccountNumber1) || (AccountNumber() == liveAccountNumber2) || (AccountNumber() == liveAccountNumber3) || (AccountNumber() == liveAccountNumber4) || (AccountNumber() == liveAccountNumber5) || (AccountNumber() == liveAccountNumber6) || (AccountNumber() == liveAccountNumber7) || (AccountNumber() == liveAccountNumber8) || (AccountNumber() == liveAccountNumber9)) AccountCheck=true; if(!AccountCheck && CheckLicense_Account_Number) { ShowAlert("EX2","Please purchase license for this account.",(int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0)/2,8); return; } else ObjectDelete(0,"EX2"); //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// static datetime dtBarCurrent=WRONG_VALUE; datetime dtBarPrevious=dtBarCurrent; dtBarCurrent=(datetime) SeriesInfoInteger(Symbol(),PERIOD_M1,SERIES_LASTBAR_DATE); bool NewBarFlag=(dtBarCurrent!=dtBarPrevious); if(NewBarFlag && Allow_Chart_Refresh) RefreshChart_Current(); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ 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(TimeCurrent()>StringToTime(expiry)) { ShowAlert("EX","LICENSE EXPIRED !! Please Contact the developer",(int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0)/2,8); return 0; } else ObjectDelete(0,"EX"); bool AccountCheck=false; if((AccountNumber() == liveAccountNumber1) || (AccountNumber() == liveAccountNumber2) || (AccountNumber() == liveAccountNumber3) || (AccountNumber() == liveAccountNumber4) || (AccountNumber() == liveAccountNumber5) || (AccountNumber() == liveAccountNumber6) || (AccountNumber() == liveAccountNumber7) || (AccountNumber() == liveAccountNumber8) || (AccountNumber() == liveAccountNumber9)) AccountCheck=true; if(!AccountCheck && CheckLicense_Account_Number) { ShowAlert("EX2","Please purchase license for this account.",(int)ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0)/2,8); return 0; } else ObjectDelete(0,"EX2"); //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////// string Notif_Msg_1; string Notif_Msg_2; int Remaining_Bars; int i; int TF1,HTF1,TF2,HTF2; int TF1_Signal,TF2_Signal; Remaining_Bars = rates_total - prev_calculated; ArraySetAsSeries(Buy_Buffer, true); ArraySetAsSeries(Sell_Buffer, true); ArraySetAsSeries(TP_Buffer, true); ArraySetAsSeries(SL_Buffer, true); ArraySetAsSeries(TP_Buffer2, true); ArraySetAsSeries(SL_Buffer2, true); ArraySetAsSeries(TP_Buffer3, true); ArraySetAsSeries(SL_Buffer3, true); if(prev_calculated < 1) { ArrayInitialize(Buy_Buffer, 2147483647); ArrayInitialize(Sell_Buffer, 2147483647); ArrayInitialize(last_Buffer, 0); ArrayInitialize(Candles_Buffer, 0); ArrayInitialize(SL_Buffer, 0); ArrayInitialize(TP_Buffer, 0); ArrayInitialize(SL_Buffer2, 0); ArrayInitialize(TP_Buffer2, 0); ArrayInitialize(SL_Buffer3, 0); ArrayInitialize(TP_Buffer3, 0); } else { Remaining_Bars = Remaining_Bars + 1; } i = Remaining_Bars - 1; if(i < 0) return rates_total; if(i > 0) i = MathMax(i, MaxBars); do { Bars_count = rates_total - 1; Bars_count = Bars_count - 50; if(Bars_count >= MaxBars) Bars_count = MaxBars; if(i < Bars_count) { TF1 = iBarShift(_Symbol, Fix_TimeFrame, iTime(NULL,Fix_Main_TimeFrame,i), false); HTF1 = iBarShift(_Symbol, Fix_HTF_TimeFrame, iTime(NULL,Fix_Main_TimeFrame,i), false); TF2 = iBarShift(_Symbol, Fix_Second_TimeFrame, iTime(NULL,Fix_Main_TimeFrame,i), false); HTF2 = iBarShift(_Symbol, Fix_HTF_Second_TimeFrame, iTime(NULL,Fix_Main_TimeFrame,i), false); if(TF1 >= 0 && HTF1 >= 0 && TF2 >= 0 && HTF2>= 0) { //======================================================================================================= double ATRb_value=0; double ATRs_value=0; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(Strategy==Strategy_1 && Strategy2==Strategy_1) { TF1_Signal=iCustom(Symbol(),Fix_TimeFrame,Base_Indi1, Fix_TimeFrame, TimeFrame1,TimeFrame2,TimeFrame3, Fix_HTF_TimeFrame, HTF_TimeFrame1,HTF_TimeFrame2,HTF_TimeFrame3,3,TF1); TF2_Signal=iCustom(Symbol(),Fix_Second_TimeFrame,Base_Indi1, Fix_Second_TimeFrame, Second_TimeFrame1,Second_TimeFrame2,Second_TimeFrame3, Fix_HTF_Second_TimeFrame, HTF_Second_TimeFrame1,HTF_Second_TimeFrame2,HTF_Second_TimeFrame3,3,TF2); if(TF1_Signal==-1 && TF2_Signal==-1 && CheckSellMACD(i) && CheckSellCE(i) && CheckSellRSI(i) && CheckSellDivergence(i) && CheckSellMA(i) && CheckSellCandle(i) && CheckSellVectors(i)) { Sell_Buffer[i] = iHigh(NULL, Period(), i)+Arrow_Distance*Point(); DrawTPSL(i,i,2); last_Buffer[i] =2; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Sell"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Sell_Buffer[i] = 2147483647; TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; //Delete_Price("SELL_TP_"+i); //Delete_Price("SELL_SL_"+i); } if(TF1_Signal==1 && TF2_Signal==1 && CheckBuyMACD(i) && CheckBuyCE(i) && CheckBuyRSI(i) && CheckBuyDivergence(i) && CheckBuyMA(i) && CheckBuyCandle(i) && CheckBuyVectors(i)) { Buy_Buffer[i] = iLow(NULL, Period(), i)-Arrow_Distance*Point(); DrawTPSL(i,i,1); last_Buffer[i]=1; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Buy"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Buy_Buffer[i] = 2147483647; if(Sell_Buffer[i]==2147483647) { TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; } //Delete_Price("BUY_TP_"+i); //Delete_Price("BUY_SL_"+i); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(Strategy==Strategy_1 && Strategy2==Strategy_2) { TF1_Signal=iCustom(Symbol(),Fix_TimeFrame,Base_Indi1, Fix_TimeFrame, TimeFrame1,TimeFrame2,TimeFrame3, Fix_HTF_TimeFrame, HTF_TimeFrame1,HTF_TimeFrame2,HTF_TimeFrame3,3,TF1); TF2_Signal=iCustom(Symbol(),Fix_Second_TimeFrame,Base_Indi1, Fix_Second_TimeFrame, Second_TimeFrame1,Second_TimeFrame2,Second_TimeFrame3, Fix_HTF_Second_TimeFrame, HTF_Second_TimeFrame1,HTF_Second_TimeFrame2,HTF_Second_TimeFrame3,2,TF2); if(TF1_Signal==-1 && TF2_Signal==-1 && CheckSellMACD(i) && CheckSellCE(i) && CheckSellRSI(i) && CheckSellDivergence(i) && CheckSellMA(i) && CheckSellCandle(i) && CheckSellVectors(i)) { Sell_Buffer[i] = iHigh(NULL, Period(), i)+Arrow_Distance*Point(); DrawTPSL(i,i,2); last_Buffer[i] =2; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Sell"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Sell_Buffer[i] = 2147483647; TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; //Delete_Price("SELL_TP_"+i); //Delete_Price("SELL_SL_"+i); } if(TF1_Signal==1 && TF2_Signal==1 && CheckBuyMACD(i) && CheckBuyCE(i) && CheckBuyRSI(i) && CheckBuyDivergence(i) && CheckBuyMA(i) && CheckBuyCandle(i) && CheckBuyVectors(i)) { Buy_Buffer[i] = iLow(NULL, Period(), i)-Arrow_Distance*Point(); DrawTPSL(i,i,1); last_Buffer[i]=1; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Buy"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Buy_Buffer[i] = 2147483647; if(Sell_Buffer[i]==2147483647) { TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; } //Delete_Price("BUY_TP_"+i); //Delete_Price("BUY_SL_"+i); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(Strategy==Strategy_2 && Strategy2==Strategy_1) { TF1_Signal=iCustom(Symbol(),Fix_TimeFrame,Base_Indi2, Fix_TimeFrame, TimeFrame1,TimeFrame2,TimeFrame3, Fix_HTF_TimeFrame, HTF_TimeFrame1,HTF_TimeFrame2,HTF_TimeFrame3,3,TF1); TF2_Signal=iCustom(Symbol(),Fix_Second_TimeFrame,Base_Indi2, Fix_Second_TimeFrame, Second_TimeFrame1,Second_TimeFrame2,Second_TimeFrame3, Fix_HTF_Second_TimeFrame, HTF_Second_TimeFrame1,HTF_Second_TimeFrame2,HTF_Second_TimeFrame3,3,TF2); if(TF1_Signal==-1 && TF2_Signal==-1 && CheckSellMACD(i) && CheckSellCE(i) && CheckSellRSI(i) && CheckSellDivergence(i) && CheckSellMA(i) && CheckSellCandle(i) && CheckSellVectors(i)) { Sell_Buffer[i] = iHigh(NULL, Period(), i)+Arrow_Distance*Point(); DrawTPSL(i,i,2); last_Buffer[i] =2; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Sell"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Sell_Buffer[i] = 2147483647; TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; //Delete_Price("SELL_TP_"+i); //Delete_Price("SELL_SL_"+i); } if(TF1_Signal==1 && TF2_Signal==1 && CheckBuyMACD(i) && CheckBuyCE(i) && CheckBuyRSI(i) && CheckBuyDivergence(i) && CheckBuyMA(i) && CheckBuyCandle(i) && CheckBuyVectors(i)) { Buy_Buffer[i] = iLow(NULL, Period(), i)-Arrow_Distance*Point(); DrawTPSL(i,i,1); last_Buffer[i]=1; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Buy"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Buy_Buffer[i] = 2147483647; if(Sell_Buffer[i]==2147483647) { TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; } //Delete_Price("BUY_TP_"+i); //Delete_Price("BUY_SL_"+i); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(Strategy==Strategy_2 && Strategy2==Strategy_2 && !Show_One_Signal_Per_Confirmation) { TF1_Signal=iCustom(Symbol(),Fix_TimeFrame,Base_Indi2, Fix_TimeFrame, TimeFrame1,TimeFrame2,TimeFrame3, Fix_HTF_TimeFrame, HTF_TimeFrame1,HTF_TimeFrame2,HTF_TimeFrame3,3,TF1); TF2_Signal=iCustom(Symbol(),Fix_Second_TimeFrame,Base_Indi2, Fix_Second_TimeFrame, Second_TimeFrame1,Second_TimeFrame2,Second_TimeFrame3, Fix_HTF_Second_TimeFrame, HTF_Second_TimeFrame1,HTF_Second_TimeFrame2,HTF_Second_TimeFrame3,2,TF2); if(TF1_Signal==-1 && TF2_Signal==-1 && CheckSellMACD(i) && CheckSellCE(i) && CheckSellRSI(i) && CheckSellDivergence(i) && CheckSellMA(i) && CheckSellCandle(i) && CheckSellVectors(i)) { Sell_Buffer[i] = iHigh(NULL, Period(), i)+Arrow_Distance*Point(); DrawTPSL(i,i,2); last_Buffer[i] =2; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Sell"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Sell_Buffer[i] = 2147483647; TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; //Delete_Price("SELL_TP_"+i); //Delete_Price("SELL_SL_"+i); } if(TF1_Signal==1 && TF2_Signal==1 && CheckBuyMACD(i) && CheckBuyCE(i) && CheckBuyRSI(i) && CheckBuyDivergence(i) && CheckBuyMA(i) && CheckBuyCandle(i) && CheckBuyVectors(i)) { Buy_Buffer[i] = iLow(NULL, Period(), i)-Arrow_Distance*Point(); DrawTPSL(i,i,1); last_Buffer[i]=1; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Buy"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Buy_Buffer[i] = 2147483647; if(Sell_Buffer[i]==2147483647) { TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; } //Delete_Price("BUY_TP_"+i); //Delete_Price("BUY_SL_"+i); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(Strategy==Strategy_2 && Strategy2==Strategy_2 && Show_One_Signal_Per_Confirmation && !Confirmation_For_Both_Set_TimeFrames) { TF1_Signal=iCustom(Symbol(),Fix_TimeFrame,Base_Indi2, Fix_TimeFrame, TimeFrame1,TimeFrame2,TimeFrame3, Fix_HTF_TimeFrame, HTF_TimeFrame1,HTF_TimeFrame2,HTF_TimeFrame3,3,TF1); TF2_Signal=iCustom(Symbol(),Fix_Second_TimeFrame,Base_Indi3, Fix_Second_TimeFrame, Second_TimeFrame1,Second_TimeFrame2,Second_TimeFrame3, Fix_HTF_Second_TimeFrame, HTF_Second_TimeFrame1,HTF_Second_TimeFrame2,HTF_Second_TimeFrame3,3,TF2); if(TF1_Signal==-1 && TF2_Signal==-1 && CheckSellMACD(i) && CheckSellCE(i) && CheckSellRSI(i) && CheckSellDivergence(i) && CheckSellMA(i) && CheckSellCandle(i) && CheckSellVectors(i)) { Sell_Buffer[i] = iHigh(NULL, Period(), i)+Arrow_Distance*Point(); DrawTPSL(i,i,2); last_Buffer[i] =2; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Sell"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Sell_Buffer[i] = 2147483647; TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; //Delete_Price("SELL_TP_"+i); //Delete_Price("SELL_SL_"+i); } if(TF1_Signal==1 && TF2_Signal==1 && CheckBuyMACD(i) && CheckBuyCE(i) && CheckBuyRSI(i) && CheckBuyDivergence(i) && CheckBuyMA(i) && CheckBuyCandle(i) && CheckBuyVectors(i)) { Buy_Buffer[i] = iLow(NULL, Period(), i)-Arrow_Distance*Point(); DrawTPSL(i,i,1); last_Buffer[i]=1; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Buy"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Buy_Buffer[i] = 2147483647; if(Sell_Buffer[i]==2147483647) { TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; } //Delete_Price("BUY_TP_"+i); //Delete_Price("BUY_SL_"+i); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if(Strategy==Strategy_2 && Strategy2==Strategy_2 && Show_One_Signal_Per_Confirmation && Confirmation_For_Both_Set_TimeFrames) { TF1_Signal=iCustom(Symbol(),Fix_TimeFrame,Base_Indi3, Fix_TimeFrame, TimeFrame1,TimeFrame2,TimeFrame3, Fix_HTF_TimeFrame, HTF_TimeFrame1,HTF_TimeFrame2,HTF_TimeFrame3,3,TF1); TF2_Signal=iCustom(Symbol(),Fix_Second_TimeFrame,Base_Indi3, Fix_Second_TimeFrame, Second_TimeFrame1,Second_TimeFrame2,Second_TimeFrame3, Fix_HTF_Second_TimeFrame, HTF_Second_TimeFrame1,HTF_Second_TimeFrame2,HTF_Second_TimeFrame3,3,TF2); if(TF1_Signal==-1 && TF2_Signal==-1 && CheckSellMACD(i) && CheckSellCE(i) && CheckSellRSI(i) && CheckSellDivergence(i) && CheckSellMA(i) && CheckSellCandle(i) && CheckSellVectors(i)) { Sell_Buffer[i] = iHigh(NULL, Period(), i)+Arrow_Distance*Point(); DrawTPSL(i,i,2); last_Buffer[i] =2; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Sell"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Sell_Buffer[i] = 2147483647; TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; //Delete_Price("SELL_TP_"+i); //Delete_Price("SELL_SL_"+i); } if(TF1_Signal==1 && TF2_Signal==1 && CheckBuyMACD(i) && CheckBuyCE(i) && CheckBuyRSI(i) && CheckBuyDivergence(i) && CheckBuyMA(i) && CheckBuyCandle(i) && CheckBuyVectors(i)) { Buy_Buffer[i] = iLow(NULL, Period(), i)-Arrow_Distance*Point(); DrawTPSL(i,i,1); last_Buffer[i]=1; if(i == 0 && Time[0] != Current_Bar) { Notif_Msg_1 = "Buy"; Notif_Msg_2 = "indicator"; Send_Notification_Alert(Notif_Msg_2, Notif_Msg_1); Current_Bar = Time[0]; } } else { Buy_Buffer[i] = 2147483647; if(Sell_Buffer[i]==2147483647) { TP_Buffer[i] = 0; SL_Buffer[i] = 0; TP_Buffer2[i-1] = 0; TP_Buffer3[i+1] = 0; SL_Buffer2[i-1] = 0; SL_Buffer3[i+1] = 0; } //Delete_Price("BUY_TP_"+i); //Delete_Price("BUY_SL_"+i); } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for(int x=Candles_Signal_Detect; x>=0; x--) { if(last_Buffer[x]==1) Candles_Buffer[i]=1; if(last_Buffer[x]==2) Candles_Buffer[i]=2; } if(Buy_Buffer[i]==2147483647 && Sell_Buffer[i] == 2147483647) last_Buffer[i] = last_Buffer[i+1]; } } i = i - 1; } while(i >= 0); return rates_total; } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Send_Notification_Alert(string Fa_s_00, string Fa_s_01) { string Notif_Msg_1; string Notif_Msg_2; string tmp_str002; string tmp_str003; string tmp_str004; if(Fa_s_00 == "print") { Print(Fa_s_01); return ; } if(Fa_s_00 == "error") { Notif_Msg_1 = Fa_s_00 + " | OAAO @ "; Notif_Msg_1 = Notif_Msg_1 + _Symbol; Notif_Msg_1 = Notif_Msg_1 + ","; Notif_Msg_1 = Notif_Msg_1 + GTF(_Period); Notif_Msg_1 = Notif_Msg_1 + " | "; Notif_Msg_1 = Notif_Msg_1 + Fa_s_01; Print(Notif_Msg_1); return ; } if(Fa_s_00 == "order") return; if(Fa_s_00 == "modify") return; if(Fa_s_00 != "indicator") return; Notif_Msg_2 = Fa_s_00 + " | OAAO @ "; Notif_Msg_2 = Notif_Msg_2 + _Symbol; Notif_Msg_2 = Notif_Msg_2 + ","; Notif_Msg_2 = Notif_Msg_2 + GTF(_Period); Notif_Msg_2 = Notif_Msg_2 + " | "; Notif_Msg_2 = Notif_Msg_2 + Fa_s_01; Print(Notif_Msg_2); if(Audible_Alerts) { tmp_str002 = Fa_s_00 + " | OAAO @ "; tmp_str002 = tmp_str002 + _Symbol; tmp_str002 = tmp_str002 + ","; tmp_str002 = tmp_str002 + GTF(_Period); tmp_str002 = tmp_str002 + " | "; tmp_str002 = tmp_str002 + Fa_s_01; Alert(tmp_str002); } if(Send_Email) { tmp_str003 = Fa_s_00 + " | OAAO @ "; tmp_str003 = tmp_str003 + _Symbol; tmp_str003 = tmp_str003 + ","; tmp_str003 = tmp_str003 + GTF(_Period); tmp_str003 = tmp_str003 + " | "; tmp_str003 = tmp_str003 + Fa_s_01; SendMail("OAAO", tmp_str003); } if(Push_Notifications == false) return; tmp_str004 = Fa_s_00 + " | OAAO @ "; tmp_str004 = tmp_str004 + _Symbol; tmp_str004 = tmp_str004 + ","; tmp_str004 = tmp_str004 + GTF(_Period); tmp_str004 = tmp_str004 + " | "; tmp_str004 = tmp_str004 + Fa_s_01; SendNotification(tmp_str004); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ string GTF(int lPeriod) { switch(lPeriod) { 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("MN1"); } return("Error"); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckBuyCE(int x) { if(!Use_TrendDetection_Filter) return(true); if(iCustom(Symbol(),TrendDetection_Time_Frame,"Trend_Confirmation_Mt4",TrendDetection_ATRMultiplier,TrendDetection_ATRPeriod,TrendDetection_ATRMaxBars,2,x)>0) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckBuyRSI(int x) { if(!Use_RSI_Filter) return(true); if(iRSI(Symbol(),RSI_Time_Frame,RSI_Period,PRICE_CLOSE,x)>RSI_Buy_Above_Level) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckSellRSI(int x) { if(!Use_RSI_Filter) return(true); if(iRSI(Symbol(),RSI_Time_Frame,RSI_Period,PRICE_CLOSE,x)0) return(true); if(Reverse_MACD_Filter && iMACD(Symbol(),MACD_Time_Frame,Fast_EMA_Period,Slow_EMA_Period,Signal_Period,Applied_Price,0,x)<0) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckSellMACD(int x) { if(!Use_MACD_Filter) return(true); if(!Reverse_MACD_Filter && iMACD(Symbol(),MACD_Time_Frame,Fast_EMA_Period,Slow_EMA_Period,Signal_Period,Applied_Price,0,x)<0) return(true); if(Reverse_MACD_Filter && iMACD(Symbol(),MACD_Time_Frame,Fast_EMA_Period,Slow_EMA_Period,Signal_Period,Applied_Price,0,x)>0) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckBuyMA(int x) { if(!Use_MA_Filter) return(true); if(iMA(Symbol(),MA_TimeFrame,MA_Period,0,MA_Method,Applied_Price_MA,x)iClose(Symbol(),MA_TimeFrame,x)) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckBuyCandle(int x) { if(!Use_Candle_Filter) return(true); if(!Reverse_Candle && iClose(Symbol(),Candle_Time_Frame,x)>iOpen(Symbol(),Candle_Time_Frame,x)) return(true); if(Reverse_Candle && iClose(Symbol(),Candle_Time_Frame,x)iOpen(Symbol(),Candle_Time_Frame,x)) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckBuyVectors(int x) { if(!Use_Vectors_Filter) return(true); double val1=0; int counter=0; for(int i=x; i<(x+Vector_Candles); i++) { val1=iCustom(Symbol(),Period(),"MTF_VectorLevels_Fix",Vectors_Time_Frame,Vectors_Period,1,i); if(val1<2147483647) counter++; } if(counter==Vector_Candles) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckSellVectors(int x) { if(!Use_Vectors_Filter) return(true); double val1=0; int counter=0; for(int i=x; i<(x+Vector_Candles); i++) { val1=iCustom(Symbol(),Period(),"MTF_VectorLevels_Fix",Vectors_Time_Frame,Vectors_Period,2,i); if(val1<2147483647) counter++; } if(counter==Vector_Candles) return(true); return(false); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void SetPrice(string direction,string name, int Tm, double Prc, color clr,int arrow_type) { string name2=name+"_level"; if(true) { if(true) { if(ObjectFind(0,name)<0) ObjectDelete(0,name); if(arrow_type==SYMBOL_RIGHTPRICE) ObjectCreate(name, OBJ_ARROW, 0, Time[Tm] + (2*Period() * 60), Prc); else ObjectCreate(name, OBJ_ARROW, 0, Time[Tm+2], Prc); ObjectSet(name, OBJPROP_COLOR, clr); ObjectSet(name, OBJPROP_WIDTH, 1); ObjectSet(name, OBJPROP_ARROWCODE, arrow_type); } } if(true) { if(ObjectFind(0,name)<0) ObjectDelete(0,name); ObjectCreate(name2, OBJ_RECTANGLE, 0, Time[Tm] + (2*Period() * 60), Prc+Width_x*Point(),Time[Tm+2],Prc-Width_x*Point()); ObjectSet(name2, OBJPROP_COLOR, clr); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Delete_Price(string name) { string name2=name+"_level"; ObjectDelete(0,name); ObjectDelete(0,name2); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void RefreshChart_Current() { int Period_start=Period(); { ChartSetSymbolPeriod(0,Symbol(),PERIOD_M1); ChartSetSymbolPeriod(0,Symbol(),Period_start); ChartRedraw(); } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void ShowAlert(string objname, string text, int xcod, int ycod) { ObjectDelete(objname); ObjectCreate(objname, OBJ_LABEL, 0, 0, 0); ObjectSet(objname, OBJPROP_ANCHOR, ANCHOR_CENTER); ObjectSet(objname, OBJPROP_XDISTANCE, xcod); ObjectSet(objname, OBJPROP_YDISTANCE, ycod); ObjectSetText(objname, text, 14, "Calibri", clrAqua); } //+------------------------------------------------------------------+ //| Validate client's password //+------------------------------------------------------------------+ bool Password_Check(string client) { string MasterKey; uchar dst[], src[], key[]; // Define your encryption key here. Must be 7 characters for DES/ECB encryption // Make your password difficult to figure out. You last name is not a good idea! // Something like "wLdU&$z" would be good. For now, we'll use a simple one... string mon=""; if(Month()<10) mon="0"+string(Month()); else mon=string(Month()); string key4="$"+mon+string(Year()); MasterKey = "8u$:(:P"; // Convert MasterKey to character array StringToCharArray(MasterKey, key); // Make sure client string is not null if(StringLen(client) == 0) return(false); // Encrypt the client using DES key StringToCharArray(client, src); CryptEncode(CRYPT_DES, src, key, dst); // Clear key and encode to BASE64 ArrayInitialize(key, 0x00); CryptEncode(CRYPT_BASE64, dst, key, src); // Compare password and return result return(CharArrayToString(src) == Password); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void DrawTPSL(int a, int b,int trade) { double ATRb_value=0; if(SL_Method==ATR_Based) { ATRb_value=iATR(Symbol(),ATR_Timeframe,ATR_Period,a); TP_Buffer[a] = iLow(NULL, Period(), b)-ATRb_value*ATR_TP_Multiplier; SL_Buffer[a] = iHigh(NULL, Period(), b)+ATRb_value*ATR_SL_Multiplier; TP_Buffer2[a-1] = TP_Buffer[a]; TP_Buffer3[a+1] = TP_Buffer[a]; SL_Buffer2[a-1] = SL_Buffer[a]; SL_Buffer3[a+1] = SL_Buffer[a]; } else { string Symbol_Trade=Symbol(); int ihighest=iHighest(Symbol_Trade,SL_Timeframe,MODE_HIGH,SL_Candles,b); int ilowest = iLowest(Symbol_Trade,SL_Timeframe,MODE_LOW,SL_Candles,b); double highestPrice=iHigh(Symbol_Trade,SL_Timeframe,ihighest); double lowestPrice = iLow(Symbol_Trade,SL_Timeframe,ilowest); double SLB =lowestPrice-(SL_Difference*MarketInfo(Symbol_Trade,MODE_POINT)); double TPB =highestPrice+(TP_Difference*MarketInfo(Symbol_Trade,MODE_POINT)); double SLS =highestPrice+(SL_Difference*MarketInfo(Symbol_Trade,MODE_POINT)); double TPS =lowestPrice-(TP_Difference*MarketInfo(Symbol_Trade,MODE_POINT)); if(trade==1) { TP_Buffer[a] = TPB; SL_Buffer[a] = SLB; } else { TP_Buffer[a] = TPS; SL_Buffer[a] = SLS; } TP_Buffer2[a-1] = TP_Buffer[a]; TP_Buffer3[a+1] = TP_Buffer[a]; SL_Buffer2[a-1] = SL_Buffer[a]; SL_Buffer3[a+1] = SL_Buffer[a]; } } //+------------------------------------------------------------------+