TRUE Forex

Просмотр кода форекс индикатора !BySu-Fx info 3.0.mq4

//+------------------------------------------------------------------+
//|                                            !BySu-Fx Info 3.0.mq4 |
//|                                               by : BySu@11082011 |
//|                                                 Lumajang - Jatim |
//|                                       jhonz_bysu_nww@yahoo.co.id |
//+------------------------------------------------------------------+
#property link      "http://ammeu-lord.blogspot.com/"

#property indicator_chart_window
#define Pr "TimeLines " //Time Line
double  s1[];           //Time Bar

extern string  _                 = "== Setting Posisi Tampilan ==";
extern bool    Tampil_Pojok_Kiri = True;
extern int     X                 = 0;
extern int     Y                 = 0;
extern string  __                = "== Setting Tampilan Warna ==";
extern color   Teks_Clr          = White;
extern color   Spread_Clr        = Gold;
extern color   HitoLow_Clr       = Gold;
extern color   PriceNtr_Clr      = White;
extern color   PriceUp_Clr       = Lime;
extern color   PriceDn_Clr       = Red;
extern color   DailyAVUp_Clr     = Lime;
extern color   DailyAVDn_Clr     = Red;
extern string  ___               = "== MM Compound ==";
extern bool    Show_MM_Comp      = False;
extern double  Target            = 5;
extern color   Target_Clr        = Lime;
extern color   Compound_Clr      = White;
extern color   Resistent_Clr     = Red;
extern string  ____               = "== Setting Profit Loss Info ==";
extern bool    Show_PLinfo       = False;
extern bool    Tampil_Pojok_kiri = True;
extern int     PL_Corner         = 2;
extern int     Win_PL            = 0;
extern int     X_PL              = 0;
extern int     Y_PL              = 0;
extern color   Sum_Clr           = White;
extern color   Sell_Clr          = Red;
extern color   Buy_Clr           = Lime;
extern bool    allSymbols        = false;
extern string  _____              = "== Setting Time Bar ==";
extern bool    Tampil_TimeBar    = true;
extern string  Fonts             = "Times New Roman";
extern int     MyFonts           = 10;
extern int     Space             = 10;
extern color   TimeBar_Clr       = White;
extern string  ______             = "== Setting Time Line ==";
       int     period            = 1440;
extern color   LineColor         = C'26,26,26';
       int     LineWidth         = 1;
extern int     LineStyle         = 2;
extern int     History           = 100;
       bool    TimeAlert         = false;
       bool    Back              = true;
extern bool    Show_TS           = false;

int per; //Profit Loss Info
double BrokDigit,CostPips,Resistent; //MM Compuond
bool sign=false; //Logo's
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//MM Compound
if (Digits == 3 || Digits == 5) BrokDigit = 10;
   else BrokDigit = 1;
//Profit Loss Info
   if(Show_PLinfo){
      if(Tampil_Pojok_kiri){
         ObjectCreate("lpm_pips1",OBJ_LABEL,Win_PL,0,0);
         ObjectSet("lpm_pips1",OBJPROP_CORNER,2);
         ObjectSetText("lpm_pips1","pips",24);
         ObjectSet("lpm_pips1",OBJPROP_COLOR,Sum_Clr);
         ObjectSet("lpm_pips1",OBJPROP_XDISTANCE, X_PL + 2);
         ObjectSet("lpm_pips1",OBJPROP_YDISTANCE, Y_PL + 1);
   
         ObjectCreate("lpm_long1",OBJ_LABEL,Win_PL,0,0);
         ObjectSet("lpm_long1",OBJPROP_CORNER,2);
         ObjectSetText("lpm_long1","L",11);
         ObjectSet("lpm_long1",OBJPROP_COLOR,Sell_Clr);
         ObjectSet("lpm_long1",OBJPROP_XDISTANCE, X_PL + 6);
         ObjectSet("lpm_long1",OBJPROP_YDISTANCE, Y_PL + 50);

         ObjectCreate("lpm_short1",OBJ_LABEL,Win_PL,0,0);
         ObjectSet("lpm_short1",OBJPROP_CORNER,2);
         ObjectSetText("lpm_short1","S",11);
         ObjectSet("lpm_short1",OBJPROP_COLOR,Buy_Clr);
         ObjectSet("lpm_short1",OBJPROP_XDISTANCE, X_PL + 6);
         ObjectSet("lpm_short1",OBJPROP_YDISTANCE, Y_PL + 35);}
         
         else{
            ObjectCreate("lpm_pips1",OBJ_LABEL,Win_PL,0,0);
            ObjectSet("lpm_pips1",OBJPROP_CORNER,3);
            ObjectSetText("lpm_pips1","pips",24);
            ObjectSet("lpm_pips1",OBJPROP_COLOR,Sum_Clr);
            ObjectSet("lpm_pips1",OBJPROP_XDISTANCE, X_PL + 2);
            ObjectSet("lpm_pips1",OBJPROP_YDISTANCE, Y_PL + 1);
   
            ObjectCreate("lpm_long1",OBJ_LABEL,Win_PL,0,0);
            ObjectSet("lpm_long1",OBJPROP_CORNER,3);
            ObjectSetText("lpm_long1","L",11);
            ObjectSet("lpm_long1",OBJPROP_COLOR,Sell_Clr);
            ObjectSet("lpm_long1",OBJPROP_XDISTANCE, X_PL + 6);
            ObjectSet("lpm_long1",OBJPROP_YDISTANCE, Y_PL + 50);

            ObjectCreate("lpm_short1",OBJ_LABEL,Win_PL,0,0);
            ObjectSet("lpm_short1",OBJPROP_CORNER,3);
            ObjectSetText("lpm_short1","S",11);
            ObjectSet("lpm_short1",OBJPROP_COLOR,Buy_Clr);
            ObjectSet("lpm_short1",OBJPROP_XDISTANCE, X_PL + 6);
            ObjectSet("lpm_short1",OBJPROP_YDISTANCE, Y_PL + 35);}
   }
   start();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete ("BySu_PairTF");
   ObjectDelete ("BySu1");
   ObjectDelete ("BySu2");
   ObjectDelete ("BySu2a");
   ObjectDelete ("BySu3");
   ObjectDelete ("BySu3a");
   ObjectDelete ("BySu4");
   ObjectDelete ("BySu4a");
   ObjectDelete ("BySu5");
   ObjectDelete ("BySu5a");
   ObjectDelete ("Bysu6a");
   ObjectDelete ("BySu7");
   ObjectDelete ("time");
//MM Compound
   ObjectDelete("BySu_Compund1");
   ObjectDelete("BySu_Compund2");
   ObjectDelete("BySu_Compund3");
   ObjectDelete("BySu_Compund4");
// Profit Loss Info
   ObjectDelete("lpm_pips1");
   ObjectDelete("lpm_long1");
   ObjectDelete("lpm_short1"); 
// Time Line
   Delete_My_Obj(Pr+PeriodToStr(period));
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//Profit Loss Info
   double profit;
   double sl;
   calcProfit(profit,sl,allSymbols);
   ObjectSetText("lpm_short1",sign(profit)+DoubleToStr(MathAbs(profit),2));
   ObjectSetText("lpm_long1",sign(sl)+DoubleToStr(MathAbs(sl),2));
   
   calcProfit1(profit,sl,allSymbols);
   
   ObjectSetText("lpm_pips1",sign(profit)+DoubleToStr(MathAbs(profit),2));
//-------------

   int    counted_bars=IndicatorCounted();
   color li_956;
   color li_960;
//Time on Price (Time to bar expiry) 
    double i;
   int m,s,k;
   m=Time[0]+Period()*60-CurTime();
   i=m/60.0;
   s=m%60;
   m=(m-m%60)/60;
   if(Period()<PERIOD_H4){
   ObjectDelete("time");
   if(ObjectFind("time") != 0){
      ObjectCreate("time", OBJ_TEXT, 0, Time[0]+(Period()*60*Space), Close[0]+ 0.0005);
      ObjectSetText("time", m+":"+s, MyFonts, Fonts, TimeBar_Clr); }   //Rockwell
      else{
         ObjectMove("time", 0, Time[0], Close[0]+0.0005); }
         }
//---------         
   ObjectCreate("BySu_PairTF", OBJ_LABEL, 0, 0, 0);
      if (Period()== 1){
               ObjectSetText("BySu_PairTF",Symbol()+ " M1 " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }  
               else {if (Period()== 5) {    
                  ObjectSetText("BySu_PairTF",Symbol() + " M5 " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }  
                  else {if (Period()== 15){    
                       ObjectSetText("BySu_PairTF",Symbol()+ " M15 " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }
                       else {if (Period()== 30){    
                            ObjectSetText("BySu_PairTF",Symbol()+ " M30 " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }
                            else {if (Period()== 60){    
                                 ObjectSetText("BySu_PairTF",Symbol()+ " H1 " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }
                                 else {if (Period()== 240){   
                                      ObjectSetText("BySu_PairTF",Symbol()+ " H4 " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }
                                      else {if (Period()== 1440){  
                                           ObjectSetText("BySu_PairTF",Symbol()+ " 1D " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }
                                           else {if (Period()== 10080){ 
                                                ObjectSetText("BySu_PairTF",Symbol()+ " WK " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }
                                                else {if (Period()== 43200){ 
                                                     ObjectSetText("BySu_PairTF",Symbol()+ " MH " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0), 8, "Arial Bold", Teks_Clr); }}}}}}}}}
      if(Tampil_Pojok_Kiri){                                                                                       
         ObjectSet("BySu_PairTF", OBJPROP_CORNER, 4);
         ObjectSet("BySu_PairTF", OBJPROP_XDISTANCE, X + 4);
         ObjectSet("BySu_PairTF", OBJPROP_YDISTANCE, Y + 0);}
         else{ObjectSet("BySu_PairTF", OBJPROP_CORNER, 1);
            ObjectSet("BySu_PairTF", OBJPROP_XDISTANCE, X + 4);
            ObjectSet("BySu_PairTF", OBJPROP_YDISTANCE, Y + 12);}
//----
   ObjectCreate("BySu1", OBJ_LABEL, 0, 0, 0);
   if (iMA(Symbol(), PERIOD_M1, 1, 0, MODE_EMA, PRICE_CLOSE, 1) > NormalizeDouble(MarketInfo(Symbol(), MODE_BID), Digits)){
      ObjectSetText("BySu1",DoubleToStr(iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0),Digits), 20, "Times New Roman Bold", PriceDn_Clr); }
      else {if (iMA(Symbol(), PERIOD_M1, 1, 0, MODE_EMA, PRICE_CLOSE, 1) == NormalizeDouble(MarketInfo(Symbol(), MODE_BID), Digits)){
         ObjectSetText("BySu1",DoubleToStr(iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0),Digits), 20, "Times New Roman Bold", PriceNtr_Clr); }
         else {if (iMA(Symbol(), PERIOD_M1, 1, 0, MODE_EMA, PRICE_CLOSE, 1) < NormalizeDouble(MarketInfo(Symbol(), MODE_BID), Digits)){
            ObjectSetText("BySu1",DoubleToStr(iMA(Symbol(),0,1,0,MODE_EMA,PRICE_CLOSE,0),Digits), 20, "Times New Roman Bold", PriceUp_Clr); }}}
   if (Tampil_Pojok_Kiri){
      ObjectSet("BySu1", OBJPROP_CORNER, 4);
      ObjectSet("BySu1", OBJPROP_XDISTANCE, X + 3);
      ObjectSet("BySu1", OBJPROP_YDISTANCE, Y + 10);
      }
      
      else {
         ObjectSet("BySu1", OBJPROP_CORNER, 1);
         ObjectSet("BySu1", OBJPROP_XDISTANCE, X + 3);
         ObjectSet("BySu1", OBJPROP_YDISTANCE, Y + 20);
         }

//==================================================
   int li_852 = 0;
   int li_856 = 0;
   int li_860 = 0;
   int li_864 = 0;
   int li_868 = 0;
   int li_872 = 0;
   li_852 = (iHigh(NULL, PERIOD_D1, 1) - iLow(NULL, PERIOD_D1, 1)) / Point;
   for (li_872 = 1; li_872 <= 5; li_872++) li_856 = li_856 + (iHigh(NULL, PERIOD_D1, li_872) - iLow(NULL, PERIOD_D1, li_872)) / Point;
   for (li_872 = 1; li_872 <= 10; li_872++) li_860 = li_860 + (iHigh(NULL, PERIOD_D1, li_872) - iLow(NULL, PERIOD_D1, li_872)) / Point;
   for (li_872 = 1; li_872 <= 20; li_872++) li_864 = li_864 + (iHigh(NULL, PERIOD_D1, li_872) - iLow(NULL, PERIOD_D1, li_872)) / Point;
   li_856 /= 5;
   li_860 /= 10;
   li_864 /= 20;
   li_868 = (li_852 + li_856 + li_860 + li_864) / 4; //(li_852 + li_856 + li_860 + li_864) / 4
   string ls_876 = "";
   string ls_884 = "";
   string ls_892 = "";
   string ls_900 = "";
   string ls_908 = "";
   string ls_916 = "";
   string ls_932 = "";
   string ls_940 = "";
   string ls_948 = "";
   string ls_999 = "[";
   string ls_555 = "J";
   string ls_000 = "N";
   double ld_964 = iOpen(NULL, PERIOD_D1, 0);
   double ld_972 = iClose(NULL, PERIOD_D1, 0);
   double ld_980 = (Ask - Bid) / Point;
   double ld_988 = iHigh(NULL, PERIOD_D1, 0);
   double ld_996 = iLow(NULL, PERIOD_D1, 0);
   ls_900 = DoubleToStr((ld_972 - ld_964) / Point, 0); //
   ls_892 = DoubleToStr(ld_980, Digits - 4);
   ls_908 = DoubleToStr(li_868, Digits - 4);                                        //=> DoubleToStr(li_868, Digits - 4)
   ls_948 = (iHigh(NULL, PERIOD_D1, 1) - iLow(NULL, PERIOD_D1, 1)) / Point;
   ls_916 = DoubleToStr((ld_988 - ld_996) / Point, 0); // DoubleToStr((iHigh(NULL, PERIOD_D1, 0) - iLow(NULL, PERIOD_D1)
   if (ld_972 >= ld_964) {
      ls_932 = "-";
      li_956 = PriceUp_Clr;
   }
   if (ld_972 < ld_964) {
      ls_932 = "-";
      li_956 = PriceDn_Clr;
   }
   if (ls_908 >= ls_948) {
      ls_940 = "-";
      li_960 = DailyAVUp_Clr;
   }
   if (ls_908 < ls_948) {
      ls_940 = "-";
      li_960 = DailyAVDn_Clr;
   }
   
//==================================================   
   if (Tampil_Pojok_Kiri) {
      ObjectCreate ("BySu3", OBJ_LABEL, 0, 0, 0);
      ObjectSetText ("BySu3", "PtO", 8, "Arial", Teks_Clr);
      ObjectSet("BySu3", OBJPROP_CORNER, 4);
      ObjectSet("BySu3", OBJPROP_XDISTANCE, X + 52);
      ObjectSet("BySu3", OBJPROP_YDISTANCE, Y + 37);
   
      ObjectCreate ("BySu3a", OBJ_LABEL, 0, 0, 0);
      ObjectSetText ("BySu3a", ls_900, 8, "Arial Bold", li_956);
      ObjectSet("BySu3a", OBJPROP_CORNER, 4);
      ObjectSet("BySu3a", OBJPROP_XDISTANCE, X + 52);
      ObjectSet("BySu3a", OBJPROP_YDISTANCE, Y + 50);
   
      ObjectCreate ("BySu4", OBJ_LABEL, 0, 0, 0);
      ObjectSetText ("BySu4", "HtL", 8, "Arial", Teks_Clr);
      ObjectSet("BySu4", OBJPROP_CORNER, 4);
      ObjectSet("BySu4", OBJPROP_XDISTANCE, X + 28);
      ObjectSet("BySu4", OBJPROP_YDISTANCE, Y + 37);
   
      ObjectCreate ("BySu4a", OBJ_LABEL, 0, 0, 0);
      ObjectSetText ("BySu4a", ls_916, 8, "Arial Bold", HitoLow_Clr);
      ObjectSet("BySu4a", OBJPROP_CORNER, 4);
      ObjectSet("BySu4a", OBJPROP_XDISTANCE, X + 28);
      ObjectSet("BySu4a", OBJPROP_YDISTANCE, Y + 50);
   
      ObjectCreate ("BySu5", OBJ_LABEL, 0, 0, 0);
      ObjectSetText ("BySu5", "AvG", 8, "Arial", Teks_Clr);
      ObjectSet("BySu5", OBJPROP_CORNER, 4);
      ObjectSet("BySu5", OBJPROP_XDISTANCE, X + 4);
      ObjectSet("BySu5", OBJPROP_YDISTANCE, Y + 37);
   
      ObjectCreate ("BySu5a", OBJ_LABEL, 0, 0, 0);
      ObjectSetText ("BySu5a", ls_908, 8, "Arial Bold", li_960);
      ObjectSet("BySu5a", OBJPROP_CORNER, 4);
      ObjectSet("BySu5a", OBJPROP_XDISTANCE, X + 4);
      ObjectSet("BySu5a", OBJPROP_YDISTANCE, Y + 50); }
      
      else {
         ObjectCreate ("BySu3", OBJ_LABEL, 0, 0, 0);
         ObjectSetText ("BySu3", "PtO", 8, "Arial", Teks_Clr);
         ObjectSet("BySu3", OBJPROP_CORNER, 1);
         ObjectSet("BySu3", OBJPROP_XDISTANCE, X + 52);
         ObjectSet("BySu3", OBJPROP_YDISTANCE, Y + 47);
   
         ObjectCreate ("BySu3a", OBJ_LABEL, 0, 0, 0);
         ObjectSetText ("BySu3a", ls_900, 8, "Arial Bold", li_956);
         ObjectSet("BySu3a", OBJPROP_CORNER, 1);
         ObjectSet("BySu3a", OBJPROP_XDISTANCE, X + 52);
         ObjectSet("BySu3a", OBJPROP_YDISTANCE, Y + 60);
   
         ObjectCreate ("BySu4", OBJ_LABEL, 0, 0, 0);
         ObjectSetText ("BySu4", "HtL", 8, "Arial", Teks_Clr);
         ObjectSet("BySu4", OBJPROP_CORNER, 1);
         ObjectSet("BySu4", OBJPROP_XDISTANCE, X + 28);
         ObjectSet("BySu4", OBJPROP_YDISTANCE, Y + 47);
   
         ObjectCreate ("BySu4a", OBJ_LABEL, 0, 0, 0);
         ObjectSetText ("BySu4a", ls_916, 8, "Arial Bold", HitoLow_Clr);
         ObjectSet("BySu4a", OBJPROP_CORNER, 1);
         ObjectSet("BySu4a", OBJPROP_XDISTANCE, X + 28);
         ObjectSet("BySu4a", OBJPROP_YDISTANCE, Y + 60);
   
         ObjectCreate ("BySu5", OBJ_LABEL, 0, 0, 0);
         ObjectSetText ("BySu5", "AvG", 8, "Arial", Teks_Clr);
         ObjectSet("BySu5", OBJPROP_CORNER, 1);
         ObjectSet("BySu5", OBJPROP_XDISTANCE, X + 4);
         ObjectSet("BySu5", OBJPROP_YDISTANCE, Y + 47);
   
         ObjectCreate ("BySu5a", OBJ_LABEL, 0, 0, 0);
         ObjectSetText ("BySu5a", ls_908, 8, "Arial Bold", li_960);
         ObjectSet("BySu5a", OBJPROP_CORNER, 1);
         ObjectSet("BySu5a", OBJPROP_XDISTANCE, X + 4);
         ObjectSet("BySu5a", OBJPROP_YDISTANCE, Y + 60); }
         
    if(sign){
      if (AccountProfit() < 0 ) {
        ObjectCreate("BySu6", OBJ_LABEL,0, 0, 0);
        ObjectSetText("BySu6",ls_000, 16, "Wingdings", Maroon);}
        else {if (AccountProfit() == 0 ) {
           ObjectCreate("BySu6", OBJ_LABEL,0, 0, 0);
           ObjectSetText("BySu6",ls_999, 12, "Wingdings", DarkSlateGray);}
           else {if (AccountProfit() > 0 ) {
              ObjectCreate("BySu6", OBJ_LABEL,0, 0, 0);
              ObjectSetText("BySu6",ls_555, 12, "Wingdings", DarkGreen);}}}
      ObjectSet("BySu6", OBJPROP_CORNER, 3);
      ObjectSet("BySu6", OBJPROP_XDISTANCE, 3);
      ObjectSet("BySu6", OBJPROP_YDISTANCE, 3);}
      
      else{
         ObjectCreate("BySu6", OBJ_LABEL,0, 0, 0);
         ObjectSetText("BySu6",ls_999, 12, "Wingdings", DarkSlateGray);
         ObjectSet("BySu6", OBJPROP_CORNER, 3);
         ObjectSet("BySu6", OBJPROP_XDISTANCE, 3);
         ObjectSet("BySu6", OBJPROP_YDISTANCE, 3);}
   
   if(Show_TS){
      ObjectCreate("BySu7", OBJ_LABEL,0, 0, 0);
      ObjectSetText("BySu7","QAS-30_LR+TSF", 24, "Broadway", DimGray);
      ObjectSet("BySu7", OBJPROP_CORNER, 2);
      ObjectSet("BySu7", OBJPROP_XDISTANCE, 3);
      ObjectSet("BySu7", OBJPROP_YDISTANCE, 3); }         
         
//MM Compound      
   double Equ=AccountEquity();
   double Bal=AccountBalance();
   int    Lev=AccountLeverage();
   double Profit=Equ*Target/100;
   double NP= MarketInfo(Symbol(), MODE_TICKVALUE);
   double CostPips=NP*BrokDigit;
   double Lot=Profit/CostPips/10;
   if(CostPips > 1)
      Resistent=Equ/Lot/10;
      else
         Resistent=Equ/Lot;
      
   if(Show_MM_Comp){
   if(Tampil_Pojok_Kiri){
      ObjectCreate("BySu_Compund1",OBJ_LABEL,0,0,0);
      ObjectSet("BySu_Compund1",OBJPROP_CORNER,4);
      ObjectSetText("BySu_Compund1","Target " + DoubleToStr(Target,1) + " %", 8, "Arial Bold", Target_Clr);
      ObjectSet("BySu_Compund1",OBJPROP_XDISTANCE, X + 2);
      ObjectSet("BySu_Compund1",OBJPROP_YDISTANCE, Y + 65);
   
      ObjectCreate("BySu_Compund2",OBJ_LABEL,0,0,0);
      ObjectSet("BySu_Compund2",OBJPROP_CORNER,4);
      ObjectSetText("BySu_Compund2","MM : " + DoubleToStr(Lot,2) + " lot", 8, "Arial Bold", Compound_Clr);
      ObjectSet("BySu_Compund2",OBJPROP_XDISTANCE, X + 2);
      ObjectSet("BySu_Compund2",OBJPROP_YDISTANCE, Y + 78);
   
      ObjectCreate("BySu_Compund3",OBJ_LABEL,0,0,0);
      ObjectSet("BySu_Compund3",OBJPROP_CORNER,4);
      ObjectSetText("BySu_Compund3","Res : " + DoubleToStr(Resistent,0) + " pips", 8, "Arial Bold", Resistent_Clr);
      ObjectSet("BySu_Compund3",OBJPROP_XDISTANCE, X + 2);
      ObjectSet("BySu_Compund3",OBJPROP_YDISTANCE, Y + 91); }
   
      else{    
         ObjectCreate("BySu_Compund1",OBJ_LABEL,0,0,0);
         ObjectSet("BySu_Compund1",OBJPROP_CORNER,1);
         ObjectSetText("BySu_Compund1","Target " + DoubleToStr(Target,1) + " %", 8, "Arial Bold", Target_Clr);
         ObjectSet("BySu_Compund1",OBJPROP_XDISTANCE, X + 2);
         ObjectSet("BySu_Compund1",OBJPROP_YDISTANCE, Y + 75);
   
         ObjectCreate("BySu_Compund2",OBJ_LABEL,0,0,0);
         ObjectSet("BySu_Compund2",OBJPROP_CORNER,1);
         ObjectSetText("BySu_Compund2","MM : " + DoubleToStr(Lot,2) + " lot", 8, "Arial Bold", Compound_Clr);
         ObjectSet("BySu_Compund2",OBJPROP_XDISTANCE, X + 2);
         ObjectSet("BySu_Compund2",OBJPROP_YDISTANCE, Y + 88);
   
         ObjectCreate("BySu_Compund3",OBJ_LABEL,0,0,0);
         ObjectSet("BySu_Compund3",OBJPROP_CORNER,1);
         ObjectSetText("BySu_Compund3","Res : " + DoubleToStr(Resistent,0) + " pips", 8, "Arial Bold", Resistent_Clr);
         ObjectSet("BySu_Compund3",OBJPROP_XDISTANCE, X + 2);
         ObjectSet("BySu_Compund3",OBJPROP_YDISTANCE, Y + 101); }
   }

//Time Line
if(period<=Period()|| period<5) return(0);
   
   int   Counted_bars=IndicatorCounted();
   
   if(Counted_bars>0)
      {
         if (per == Time[0]) return;
            per = Time[0];
          CheckAndDraw(Time[0]);
          return;
      }
   
   int      it=Bars-Counted_bars-1;  
     if (History>0&&i>History-1)    
       it=History-1; 
       
      while(it>=0)
      {
      CheckAndDraw(Time[it]);  
       
      it--;
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//Profit Loss Info
   double calcProfit(double& out, double& outsl,bool allSymbols=false) {

   double profit=0;
   double p=0;
   double sl=0;
   double s=0;
      
   for(int i=0;i<OrdersTotal();i++) {
    if(OrderSelect(i,SELECT_BY_POS)) {
     
     if(allSymbols || OrderSymbol()==Symbol()) {
      
      p=0;
      s=0;
      
      if(OrderType()==OP_BUY) {
      if (OrderProfit()>0.00)
       p=OrderProfit();
       if(OrderProfit()<0.00) {
        s=OrderProfit();
       }
      }
      
      if(OrderType()==OP_SELL) {
       if (OrderProfit()>0.00)
       p=OrderProfit();
       if(OrderProfit()<0.00) {
        s=OrderProfit();
       }
      }
      
      sl+=s;
      profit+=p;
     
     }
    }
   }
   
   out=profit;
   outsl=sl;

}

string sign(double value) {
 
   if(value>0) {
    return("+");
   }
 
   if(value<0) {
    return("-");
   }

}
double calcProfit1(double& out, double& outsl,bool allSymbols=false) {

   double profit=0;
   double p=0;
   double sl=0;
   double s=0;
      
   for(int i=0;i<OrdersTotal();i++) {
    if(OrderSelect(i,SELECT_BY_POS)) {
     
     if(allSymbols || OrderSymbol()==Symbol()) {
      
      p=0;
      s=0;
      
      if(OrderType()==OP_BUY) {
       p=OrderProfit();
       if(OrderStopLoss()>0) {
        s=(OrderStopLoss()-OrderOpenPrice())/Point;
       }
      }
      
      if(OrderType()==OP_SELL) {
       p=OrderProfit();
       if(OrderStopLoss()>0) {
        s=(OrderOpenPrice()-OrderStopLoss())/Point;
       }
      }
      
      sl+=s;
      profit+=p;
     
     }
    }
   }
   
   out=profit;
   outsl=sl;

}

//Void Time Line
void CheckAndDraw(datetime t)
{   
    int TM=TimeMinute(t), TH=TimeHour(t) ;
    bool draw=false;
    
      if(period==5)
          {  
            if( TM==0 || TM==5 ||TM==10 ||TM==15 ||TM==20||TM==25 ||TM==30 
            ||TM==35 ||TM==40 ||TM==45||TM==50||TM==55) 
            draw=true;
          }  
      if(period==15)
          {
          if( TM==0 || TM==15 ||TM==30 ||TM==45) 
            draw=true;
          }      
      if(period==30)
          {
          if( TM==0 || TM==30) 
            draw=true;
          }      
      if(period==60)
          {
           if( TM==0) 
            draw=true;
          }      
      if(period==240)
          {
            if(TM==0 && (TH==0 ||TH==4||TH==8||TH==12||TH==16||TH==20||TH==24) ) 
            draw=true;
          }      
      if(period==1440)
          {
            if(TH==0 && TM==0) 
            draw=true;
          }       
      if(period==10080)
          {
            if(TH==0 && TM==0 && TimeDayOfWeek(t)==1 ) 
            draw=true;
          } 
      if(period==43200)
          {
            if(TH==0 && TM==0 && TimeDay(t)==1 ) 
            draw=true;
          }      
              
      string LName=Pr+PeriodToStr(period)+" "+TimeToStr(t,TIME_DATE|TIME_MINUTES);
      if(draw && ObjectFind(LName)<0)
         {   
                  if (Period() <= 60){
                  ObjectCreate( LName,OBJ_VLINE,0,t,0); }
                  ObjectSet( LName, OBJPROP_COLOR , LineColor);
                  ObjectSet( LName, OBJPROP_WIDTH , LineWidth);
                  if(Back==true)ObjectSet( LName, OBJPROP_BACK, Back);
                  if(LineWidth<2)
                  ObjectSet( LName, OBJPROP_STYLE , LineStyle);
                 // ObjectSetText( LName, DoubleToStr(TM,0));
                 
                 
         }
     string AlStr=Symbol()+" "+PeriodToStr(Period())+" : "+LName;
       
     int nt=t+period*60; 
      LName=Pr+PeriodToStr(period)+" "+TimeToStr(nt,TIME_DATE|TIME_MINUTES);
      if(draw && ObjectFind(LName)<0)
         {   
            if(TimeAlert && Time[0]==t) Alert(AlStr);
                  if (Period() <= 60){
                  ObjectCreate( LName,OBJ_VLINE,0,nt,0);}
                  ObjectSet( LName, OBJPROP_COLOR , LineColor);
                  ObjectSet( LName, OBJPROP_WIDTH , LineWidth);
                  if(Back==true)ObjectSet( LName, OBJPROP_BACK, Back);
                  if(LineWidth<2)
                  ObjectSet( LName, OBJPROP_STYLE , LineStyle);
                 // ObjectSetText( LName, DoubleToStr(TM,0));
         }   
}
//----------------------
void Delete_My_Obj(string Prefix)
   {//Alert(ObjectsTotal());
   for(int k=ObjectsTotal()-1; k>=0; k--)
     {
      string Obj_Name=ObjectName(k); 
      string Head=StringSubstr(Obj_Name,0,StringLen(Prefix));

      if (Head==Prefix)
         {
         ObjectDelete(Obj_Name);
         //Alert(Head+";"+Prefix);
         }                
        
     }
   }
//-------------------------------
string PeriodToStr(int Per)
   {
      switch(Per)   
      {       
      case     1: return("M1"); break;     
      case     5: return("M5"); break;     
      case    15: return("M15"); break;     
      case    30: return("M30"); break;      
      case    60: return("H1"); break; 
      case   240: return("H4"); break;   
      case  1440: return("D1"); break;  
      case 10080: return("W1"); break;  
      case 43200: return("МN"); break;
      }
   }
//end void time line

Комментарии к исходному коду форекс индикатора !BySu-Fx info 3.0.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !BDP FIBONACCI DAILY.mq4
индикатор !CCI-Divergence-Master-v13c.mq4 »