Sample ChartSymbol

Author: Copyright © 2021, Aleksandr Klapatyuk
Price Data Components
Miscellaneous
It plays sound alerts
0 Views
0 Downloads
0 Favorites
Sample ChartSymbol
ÿþ//+------------------------------------------------------------------+

//|                                           Sample ChartSymbol.mq5 |

//|                           Copyright © 2021, Aleksandr Klapatyuk. |

//|                            https://www.mql5.com/ru/users/sanalex |

//+------------------------------------------------------------------+

#property copyright   "Copyright © 2021, Aleksandr Klapatyuk"

#property link        "https://www.mql5.com/ru/users/sanalex"

#property description "Copyright © 2021, Vladimir Karputov"

#property description "http://wmua.ru/slesar/"

#property version     "1.001"

//---

#define MACD_MAGIC 0

//---

#include <Trade\Trade.mqh>

#include <Trade\SymbolInfo.mqh>

#include <Trade\PositionInfo.mqh>

#include <Trade\AccountInfo.mqh>

//---

double            m_adjusted_point; // point value adjusted for 3 or 5 points

CTrade            m_trade;          // trading object

CSymbolInfo       m_symbol;         // symbol info object

CPositionInfo     m_position;       // trade position object

CAccountInfo      m_account;        // account info wrapper

//---

sinput group "----------------- Balans Parameters ----------------------------------------------"

input string InpTemplate        = "ADX";             // Without '.tpl'

input double InpTargetProfit    = 1000000;           // Balance + Profit(add to balance)

input double InpTargetLoss      = 0;                 // Balance - Loss(subtract from the balance)

sinput group "----------------- Risk in percentage ---------------------------------------------"

input double InpMaxRisk         = 0.02;              // Maximum Risk in percentage

sinput group "----------------- TP:SL: Parameters ----------------------------------------------"

input double InpTProfit         = 40000;             // Take Profit --> (In currency the amount)

input double InpSLoss           = 1000000;           // Stop Loss --> (In currency the amount)

sinput group "----------------- Name Indicators ------------------------------------------------"

input bool   InpIndicator_Start = false;             // Start Indicators

input string InpIndicator_Name  = "Name Indicators"; // Name Indicators

input bool   InpRevers          = false;             // Revers

//--- indicator buffers

double   m_buff_MACD_main[];   // MACD indicator main buffer

double   m_buff_MACD_signal[]; // MACD indicator signal buffer

ENUM_TIMEFRAMES TimeFrame = PERIOD_CURRENT;

datetime ExtPrevBars      = D'1970.01.01 00:00';

string   m_name[]         = {"Buy","Sell","CloseBuy","CloseSell","CLOSE_ALL"};

string   m_symb_name[]    = {"EURUSD","GBPUSD","USDCHF","USDJPY","USDCAD","AUDUSD","AUDNZD",

                             "AUDCAD","AUDCHF","AUDJPY","CHFJPY","EURGBP","EURAUD","EURCHF",

                             "EURJPY","EURNZD","EURCAD","GBPCHF","GBPJPY","CADCHF","GBPAUD"

                            };

int      m_handle_macd[]  = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};

//+------------------------------------------------------------------+

//| Calculate optimal lot size                                       |

//+------------------------------------------------------------------+

double TradeSizeOptimized(string symbol,double risk)

  {

   double price=0.0;

   double margin=0.0;

//--- select lot size

   if(!SymbolInfoDouble(symbol,SYMBOL_ASK,price))

      return(0.0);

   if(!OrderCalcMargin(ORDER_TYPE_BUY,symbol,1.0,price,margin))

      return(0.0);

   if(margin<=0.0)

      return(0.0);

   double lot=NormalizeDouble(AccountInfoDouble(ACCOUNT_MARGIN_FREE)*risk/margin,2);

//--- normalize and check limits

   double stepvol=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP);

   lot=stepvol*NormalizeDouble(lot/stepvol,0);

   double minvol=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);

   if(lot<minvol)

      lot=minvol;

   double maxvol=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MAX);

   if(lot>maxvol)

      lot=maxvol;

//--- return trading volume

   return(lot);

  }

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit(void)

  {

//--- initialize common information

   for(int i=0; i<20; i++)

     {

      if(!m_symbol.Name(m_symb_name[i]))     // symbol

         return(INIT_FAILED);

      RefreshRates(m_symb_name[i]);

      m_trade.SetTypeFillingBySymbol(m_symb_name[i]);

     }

   m_trade.SetExpertMagicNumber(MACD_MAGIC); // magic

   m_trade.SetMarginMode();

//--- tuning for 3 or 5 digits

   int digits_adjust=1;

   if(m_symbol.Digits()==3 || m_symbol.Digits()==5)

      digits_adjust=10;

   m_adjusted_point=m_symbol.Point()*digits_adjust;

//--- set default deviation for trading in adjusted points

   m_trade.SetDeviationInPoints(3*digits_adjust);

//--- create MACD indicator

   if(InpIndicator_Start)

     {

      for(int i=0; i<20; i++)

        {

         m_handle_macd[i]=iCustom(m_symb_name[i],Period(),InpIndicator_Name);

         if(m_handle_macd[i]==INVALID_HANDLE)

           {

            PrintFormat("Failed to create handle of the handle_iCustom indicator for the symbol %s/%s, error code %d",

                        m_symb_name[i],

                        EnumToString(Period()),

                        GetLastError());

            //--- the indicator is stopped early

            return(INIT_FAILED);

           }

        }

     }

//---

   int u=15;

   for(int y=0; y<ArraySize(m_name); y++)

     {

      ButtonCreate(m_name[y],5,u,110,15,8);

      u=u+17;

     }

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   for(int i=0; i<20; i++)

     {

      for(int y=0; y<ArraySize(m_name); y++)

        {

         ObjectDelete(0,m_symb_name[i]+m_name[y]);

        }

      if(m_handle_macd[i]!=INVALID_HANDLE)

         IndicatorRelease(m_handle_macd[i]);

     }

//---

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick(void)

  {

//--- refresh rates

   if(!m_symbol.RefreshRates())

      return;

//---

   for(int i=0; i<20; i++)

     {

      if(!CheckButon(m_symb_name[i]))

         return;

      if(InpIndicator_Start)

        {

         Processing(m_symb_name[i],m_handle_macd[i]);

        }

     }

  }

//+------------------------------------------------------------------+

//| main function returns true if any position processed             |

//+------------------------------------------------------------------+

bool Processing(const string symbol,const int handle_macd)

  {

//---

   int start_pos=1,count=2;

   ArraySetAsSeries(m_buff_MACD_main,true);

   ArraySetAsSeries(m_buff_MACD_signal,true);

//--- refresh indicators

   if(BarsCalculated(handle_macd)<count)

      return(false);

   if(CopyBuffer(handle_macd,MAIN_LINE,start_pos,count,m_buff_MACD_main)  !=count ||

      CopyBuffer(handle_macd,SIGNAL_LINE,start_pos,count,m_buff_MACD_signal)!=count)

     {

      ExtPrevBars=0;

      return(false);

     }

//--- we work only at the time of the birth of new bar

   datetime time_0=iTime(symbol,Period(),0);

   if(time_0==ExtPrevBars)

      return(false);

   ExtPrevBars=time_0;

//--- check for long position (BUY) possibility

   if(m_buff_MACD_main[0]>m_buff_MACD_signal[0])

     {

      if(InpRevers)

         if(!LongOpened(symbol))

            return(true);

      if(!InpRevers)

         if(!ShortOpened(symbol))

            return(true);

     }

//--- check for short position (SELL) possibility

   if(m_buff_MACD_main[0]<m_buff_MACD_signal[0])

     {

      if(InpRevers)

         if(!ShortOpened(symbol))

            return(true);

      if(!InpRevers)

         if(!LongOpened(symbol))

            return(true);

     }

//--- exit without position processing

   return(false);

  }

//+------------------------------------------------------------------+

//| Check for long position closing                                  |

//+------------------------------------------------------------------+

bool LongClosed(const string symbol)

  {

   bool res=false;

//--- should it be closed?

   ClosePositions(symbol,POSITION_TYPE_BUY);

//--- processed and cannot be modified

   res=true;

//--- result

   return(res);

  }

//+------------------------------------------------------------------+

//| Check for short position closing                                 |

//+------------------------------------------------------------------+

bool ShortClosed(const string symbol)

  {

   bool res=false;

//--- should it be closed?

   ClosePositions(symbol,POSITION_TYPE_SELL);

//--- processed and cannot be modified

   res=true;

//--- result

   return(res);

  }

//+------------------------------------------------------------------+

//| Check for long position opening                                  |

//+------------------------------------------------------------------+

bool LongOpened(const string symbol)

  {

   bool res=false;

//--- check for long position (BUY) possibility

   double price=m_symbol.Ask();

//--- check for free money

   if(m_account.FreeMarginCheck(symbol,ORDER_TYPE_BUY,TradeSizeOptimized(symbol,InpMaxRisk),price)<0.0)

      printf("We have no money. Free Margin = %f",m_account.FreeMargin());

   else

     {

      //--- open position

      if(m_trade.PositionOpen(symbol,ORDER_TYPE_BUY,TradeSizeOptimized(symbol,InpMaxRisk),price,0.0,0.0))

         printf("Position by %s to be opened",symbol);

      else

        {

         printf("Error opening BUY position by %s : '%s'",symbol,m_trade.ResultComment());

         printf("Open parameters : price=%f",price);

        }

      PlaySound("ok.wav");

     }

//--- in any case we must exit from expert

   res=true;

//--- result

   return(res);

  }

//+------------------------------------------------------------------+

//| Check for short position opening                                 |

//+------------------------------------------------------------------+

bool ShortOpened(const string symbol)

  {

   bool res=false;

//--- check for short position (SELL) possibility

   double price=m_symbol.Bid();

//--- check for free money

   if(m_account.FreeMarginCheck(symbol,ORDER_TYPE_SELL,TradeSizeOptimized(symbol,InpMaxRisk),price)<0.0)

      printf("We have no money. Free Margin = %f",m_account.FreeMargin());

   else

     {

      //--- open position

      if(m_trade.PositionOpen(symbol,ORDER_TYPE_SELL,TradeSizeOptimized(symbol,InpMaxRisk),price,0.0,0.0))

         printf("Position by %s to be opened",symbol);

      else

        {

         printf("Error opening SELL position by %s : '%s'",symbol,m_trade.ResultComment());

         printf("Open parameters : price=%f",price);

        }

      PlaySound("ok.wav");

     }

//--- in any case we must exit from expert

   res=true;

//--- result

   return(res);

  }

//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void LongChartSymbol(void)

  {

   long currChart,prevChart=ChartFirst();

   int i=0,limit=100;

   Print("ChartFirst = ",ChartSymbol(prevChart)," ID = ",prevChart);

   while(i<limit)

     {

      currChart=ChartNext(prevChart);

      if(LongOpened(ChartSymbol(prevChart)))

         if(currChart<0)

            break;

      Print(i,ChartSymbol(currChart)," ID =",currChart);

      prevChart=currChart;

      i++;

     }

  }

//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void ShortChartSymbol(void)

  {

   long currChart,prevChart=ChartFirst();

   int i=0,limit=100;

   Print("ChartFirst = ",ChartSymbol(prevChart)," ID = ",prevChart);

   while(i<limit)

     {

      currChart=ChartNext(prevChart);

      if(ShortOpened(ChartSymbol(prevChart)))

         if(currChart<0)

            break;

      Print(i,ChartSymbol(currChart)," ID =",currChart);

      prevChart=currChart;

      i++;

     }

  }

//+------------------------------------------------------------------+

//| start function                                                   |

//+------------------------------------------------------------------+

void DeleteChart(void)

  {

   long currChart,prevChart=ChartFirst();

   int i=0,limit=100;

   bool errTemplate;

   while(i<limit)

     {

      currChart=ChartNext(prevChart);

      if(TimeFrame!=PERIOD_CURRENT)

        {

         ChartSetSymbolPeriod(prevChart,ChartSymbol(prevChart),TimeFrame);

        }

      errTemplate=ChartApplyTemplate(prevChart,InpTemplate+".tpl");

      if(!errTemplate)

        {

         Print("Error ",ChartSymbol(prevChart),"-> ",GetLastError());

        }

      if(currChart<0)

         break;

      Print(i,ChartSymbol(currChart)," ID =",currChart);

      prevChart=currChart;

      i++;

     }

  }

//+------------------------------------------------------------------+

//| Refreshes the symbol quotes data                                 |

//+------------------------------------------------------------------+

bool RefreshRates(const string symbol)

  {

//--- refresh rates

   if(!m_symbol.RefreshRates())

     {

      return(false);

     }

//--- protection against the return value of "zero"

   if(m_symbol.Ask()==0 || m_symbol.Bid()==0)

     {

      return(false);

     }

   return(true);

  }

//+------------------------------------------------------------------+

//| Check Freeze and Stops levels                                    |

//+------------------------------------------------------------------+

void FreezeStopsLevels(const string symbol,double &freeze,double &stops)

  {

//--- check Freeze and Stops levels

   double coeff=(double)1;

   if(!RefreshRates(symbol) || !m_symbol.Refresh())

      return;

//--- FreezeLevel -> for pending order and modification

   double freeze_level=m_symbol.FreezeLevel()*m_symbol.Point();

   if(freeze_level==0.0)

      if(1>0)

         freeze_level=(m_symbol.Ask()-m_symbol.Bid())*coeff;

//--- StopsLevel -> for TakeProfit and StopLoss

   double stop_level=m_symbol.StopsLevel()*m_symbol.Point();

   if(stop_level==0.0)

      if(1>0)

         stop_level=(m_symbol.Ask()-m_symbol.Bid())*coeff;

//---

   freeze=freeze_level;

   stops=stop_level;

   return;

  }

//+------------------------------------------------------------------+

//| Close positions                                                  |

//+------------------------------------------------------------------+

void ClosePositions(const string symbol,const ENUM_POSITION_TYPE pos_type)

  {

   double freeze=0.0,stops=0.0;

   FreezeStopsLevels(symbol,freeze,stops);

   int total=PositionsTotal();

   for(int i=total-1; i>=0; i--)

      if(m_position.SelectByIndex(i))

         if(m_position.PositionType()==pos_type)

           {

            if(m_position.PositionType()==POSITION_TYPE_BUY)

              {

               bool take_profit_level=((m_position.TakeProfit()!=0.0 && m_position.TakeProfit()-m_position.PriceCurrent()>=freeze) || m_position.TakeProfit()==0.0);

               bool stop_loss_level=((m_position.StopLoss()!=0.0 && m_position.PriceCurrent()-m_position.StopLoss()>=freeze) || m_position.StopLoss()==0.0);

               if(take_profit_level && stop_loss_level)

                  if(!m_trade.PositionClose(m_position.Ticket()))

                     Print(__FILE__," ",__FUNCTION__,", ERROR: ","BUY PositionClose ",m_position.Ticket(),", ",m_trade.ResultRetcodeDescription());

              }

            if(m_position.PositionType()==POSITION_TYPE_SELL)

              {

               bool take_profit_level=((m_position.TakeProfit()!=0.0 && m_position.PriceCurrent()-m_position.TakeProfit()>=freeze) || m_position.TakeProfit()==0.0);

               bool stop_loss_level=((m_position.StopLoss()!=0.0 && m_position.StopLoss()-m_position.PriceCurrent()>=freeze) || m_position.StopLoss()==0.0);

               if(take_profit_level && stop_loss_level)

                  if(!m_trade.PositionClose(m_position.Ticket()))

                     Print(__FILE__," ",__FUNCTION__,", ERROR: ","SELL PositionClose ",m_position.Ticket(),", ",m_trade.ResultRetcodeDescription());

              }

            PlaySound("ok.wav");

           }

  }

//+------------------------------------------------------------------+

//    buttoncreate                                                   |

//+------------------------------------------------------------------+

bool ButtonCreate(string name,int Xdist,

                  int Ydist,int Xsize,int Ysize,int FONTSIZE=12)

  {

   if(ObjectFind(0,Symbol()+name)<0)

      ObjectCreate(0,Symbol()+name,OBJ_BUTTON,0,100,100);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_COLOR,clrWhite);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_BGCOLOR,clrDimGray);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_XDISTANCE,Xdist);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_YDISTANCE,Ydist);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_XSIZE,Xsize);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_YSIZE,Ysize);

   ObjectSetString(0,Symbol()+name,OBJPROP_FONT,"Sans Serif");

   ObjectSetString(0,Symbol()+name,OBJPROP_TEXT,name);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_FONTSIZE,FONTSIZE);

   ObjectSetInteger(0,Symbol()+name,OBJPROP_SELECTABLE,false);

   return(true);

  }

//+------------------------------------------------------------------+

//| ButtonOnTick                                                     |

//+------------------------------------------------------------------+

bool CheckButon(const string symbol)

  {

   bool res=false;

//---

   double PROFIT_BUY=0.00;

   double PROFIT_SELL=0.00;

   double PROFIT_CLOSE=0.00;

   double PROFIT_EQUITY=0.00;

   double PROFIT_BUY_Lot=0.00;

   double PROFIT_SELL_Lot=0.00;

//---

   int total=PositionsTotal();

   for(int i=total-1; i>=0; i--)

      if(m_position.SelectByIndex(i))

         if(symbol==symbol)

           {

            if(m_position.PositionType()==POSITION_TYPE_BUY)

              {

               PROFIT_BUY=PROFIT_BUY+PositionGetDouble(POSITION_PROFIT);

               PROFIT_BUY_Lot=PROFIT_BUY_Lot+PositionGetDouble(POSITION_VOLUME);

              }

            if(m_position.PositionType()==POSITION_TYPE_SELL)

              {

               PROFIT_SELL=PROFIT_SELL+PositionGetDouble(POSITION_PROFIT);

               PROFIT_SELL_Lot=PROFIT_SELL_Lot+PositionGetDouble(POSITION_VOLUME);

              }

            PROFIT_CLOSE=AccountInfoDouble(ACCOUNT_PROFIT);

           }

   PROFIT_EQUITY=AccountInfoDouble(ACCOUNT_EQUITY);

//---

   if(PROFIT_EQUITY<=InpTargetLoss || PROFIT_EQUITY>=InpTargetProfit)

     {

      if(!LongClosed(symbol))

         return(true);

      if(!ShortClosed(symbol))

         return(true);

      ExpertRemove();

      DeleteChart();

      PlaySound("expert.wav");

     }

//---

   if(PROFIT_BUY<=-InpSLoss || PROFIT_BUY>=InpTProfit)

     {

      if(!LongClosed(symbol))

         return(true);

      PlaySound("request.wav");

     }

//---

   if(PROFIT_SELL<=-InpSLoss || PROFIT_SELL>=InpTProfit)

     {

      if(!ShortClosed(symbol))

         return(true);

      PlaySound("request.wav");

     }

//---

   if(ObjectGetInteger(0,Symbol()+"Buy",OBJPROP_STATE)!=0)

     {

      ObjectSetInteger(0,Symbol()+"Buy",OBJPROP_STATE,0);

      //--- check for long position (BUY) possibility

      LongChartSymbol();

      PlaySound("ok.wav");

     }

   if(ObjectGetInteger(0,Symbol()+"CloseBuy",OBJPROP_STATE)!=0)

     {

      ObjectSetInteger(0,Symbol()+"CloseBuy",OBJPROP_STATE,0);

      if(!LongClosed(symbol))

         return(true);

      PlaySound("request.wav");

     }

   if(ObjectGetInteger(0,Symbol()+"Sell",OBJPROP_STATE)!=0)

     {

      ObjectSetInteger(0,Symbol()+"Sell",OBJPROP_STATE,0);

      //--- check for short position (SELL) possibility

      ShortChartSymbol();

      PlaySound("ok.wav");

     }

   if(ObjectGetInteger(0,Symbol()+"CloseSell",OBJPROP_STATE)!=0)

     {

      ObjectSetInteger(0,Symbol()+"CloseSell",OBJPROP_STATE,0);

      if(!ShortClosed(symbol))

         return(true);

      PlaySound("request.wav");

     }

   if(ObjectGetInteger(0,Symbol()+"CLOSE_ALL",OBJPROP_STATE)!=0)

     {

      ObjectSetInteger(0,Symbol()+"CLOSE_ALL",OBJPROP_STATE,0);

      if(!LongClosed(symbol))

         return(true);

      if(!ShortClosed(symbol))

         return(true);

      PlaySound("expert.wav");

     }

//---

   ObjectSetString(0,Symbol()+"Buy",OBJPROP_TEXT,"BUY = Lot ("+DoubleToString(PROFIT_BUY_Lot,2)+")");

   if(PROFIT_BUY_Lot>0)

     {

      ObjectSetInteger(0,Symbol()+"Buy",OBJPROP_BGCOLOR,clrDarkSlateGray);

     }

   else

      if(PROFIT_BUY_Lot==0)

        {

         ObjectSetInteger(0,Symbol()+"Buy",OBJPROP_BGCOLOR,clrDimGray);

        }

//---

   ObjectSetString(0,Symbol()+"CloseBuy",OBJPROP_TEXT,"Close_Buy =("+DoubleToString(PROFIT_BUY,2)+")");

   if(PROFIT_BUY>0)

     {

      ObjectSetInteger(0,Symbol()+"CloseBuy",OBJPROP_BGCOLOR,clrLimeGreen);

     }

   else

      if(PROFIT_BUY==0)

        {

         ObjectSetInteger(0,Symbol()+"CloseBuy",OBJPROP_BGCOLOR,clrDimGray);

        }

      else

        {

         ObjectSetInteger(0,Symbol()+"CloseBuy",OBJPROP_BGCOLOR,clrCrimson);

        }

//---

   ObjectSetString(0,Symbol()+"Sell",OBJPROP_TEXT,"SELL = Lot ("+DoubleToString(PROFIT_SELL_Lot,2)+")");

   if(PROFIT_SELL_Lot>0)

     {

      ObjectSetInteger(0,Symbol()+"Sell",OBJPROP_BGCOLOR,clrDarkSlateGray);

     }

   else

      if(PROFIT_SELL_Lot==0)

        {

         ObjectSetInteger(0,Symbol()+"Sell",OBJPROP_BGCOLOR,clrDimGray);

        }

//---

   ObjectSetString(0,Symbol()+"CloseSell",OBJPROP_TEXT,"Close_Sell =("+DoubleToString(PROFIT_SELL,2)+")");

   if(PROFIT_SELL>0)

     {

      ObjectSetInteger(0,Symbol()+"CloseSell",OBJPROP_BGCOLOR,clrLimeGreen);

     }

   else

      if(PROFIT_SELL==0)

        {

         ObjectSetInteger(0,Symbol()+"CloseSell",OBJPROP_BGCOLOR,clrDimGray);

        }

      else

        {

         ObjectSetInteger(0,Symbol()+"CloseSell",OBJPROP_BGCOLOR,clrCrimson);

        }

//---

   ObjectSetString(0,Symbol()+"CLOSE_ALL",OBJPROP_TEXT,"CLOSE_ALL =("+DoubleToString(PROFIT_CLOSE,2)+")"

                   +" :all="+DoubleToString(PositionsTotal(),0));

   if(PROFIT_CLOSE>0)

     {

      ObjectSetInteger(0,Symbol()+"CLOSE_ALL",OBJPROP_BGCOLOR,clrLimeGreen);

     }

   else

      if(PROFIT_CLOSE==0)

        {

         ObjectSetInteger(0,Symbol()+"CLOSE_ALL",OBJPROP_BGCOLOR,clrDimGray);

        }

      else

        {

         ObjectSetInteger(0,Symbol()+"CLOSE_ALL",OBJPROP_BGCOLOR,clrCrimson);

        }

   res=true;

//--- result

   return(res);

  }

//+------------------------------------------------------------------+

Comments