Author: Copyright � 2007-2008 Tom Balfe
ToR_1.12

This tool is designed to help traders quickly identify the current state of the market—specifically whether a currency pair is moving in a clear direction (trending) or staying within a narrow price range (ranging). By providing this information across multiple timeframes simultaneously, it allows you to see the "big picture" at a glance.

Core Logic and Functionality

1. Multi-Timeframe Analysis The script monitors several different time intervals at once: 1 Minute, 5 Minutes, 15 Minutes, 30 Minutes, 1 Hour, and 4 Hours. This is helpful because a market might be "ranging" on a small timeframe but showing a strong trend on a larger one.

2. Trend Strength Detection (ADX) The tool uses an indicator called ADX to measure the speed and strength of price movements:

  • Ranging: If the value is below a certain threshold, the tool identifies the market as "Ranging." This suggests that price action is sideways and trend-following strategies might not be effective.
  • Stronger/Weaker: If the value is above the threshold, it compares the current reading to the previous one. If it's rising, it labels the trend as "Stronger"; if it’s falling, it labels it as "Weaker."

3. Directional Cues To tell you which way the trend is leaning, the script looks at the relationship between two other signals (DI+ and DI-):

  • If one signal is higher than the other, the tool assigns a specific color (Lime for upward pressure or Red for downward pressure).
  • It also displays visual icons (arrows) to represent these directions clearly on your screen.

4. Real-Time Spread Monitoring The script includes a "Spread" tracker. This shows you the cost of entering a trade in real-time.

  • Green Text: Indicates the spread is within your preferred limit (low cost).
  • Red Text: Alerts you that the spread has become too high, which could eat into your potential profits.

Summary for the Trader

Instead of looking at six different charts to figure out what the market is doing, this script consolidates that data into one view. It tells you:

  • Where the market is moving (Directional colors and arrows).
  • How fast it is moving (Stronger vs. Weaker vs. Ranging).
  • How much it costs to trade right now (Live Spread monitor).
Indicators Used
Movement directional index
10 Views
0 Downloads
0 Favorites
ToR_1.12
//+------------------------------------------------------------------+
//|                                             Trending or Ranging? |
//|                                                     ToR_1.12.mq4 |
//|                                        Copyright © 2008Tom Balfe |
//|                                                                  |
//| This indicator shows you whether a pair is trending or ranging.  | 
//| For trending markets use moving averages and for ranging         |
//| market use oscillators.                                          |
//|                                                                  |
//| Best of luck in all your trades...                               |
//|                                                                  |
//| Special thanks to whereswaldo!                                   |
//|                                                                  |
//| Version: 1.12                                                    |
//|                                                                  |
//| Changelog:                                                       |
//|     1.12 - made color assignment more efficient, made arrow      |
//|            assignment more efficient                             |
//|     1.11 - adjusted fonts, spacing, added ranging, text broken   |
//|     1.10 - added ADX increasing and decreasing notice            |
//|     1.03 - adjusted spacing, fonts, unreleased                   |
//|     1.02 - added arrows, ranging icon, no zero space state       |
//|            for icons/arrows, spacing got messed up, now          | 
//|            fixed                                                 |
//|     1.01 - unreleased, Reduced number of colors, functional      |
//|     1.0  - unreleased, too many colors for ADX values            |
//|                                                                  |
//|                   http://www.forex-tsd.com/members/nittany1.html |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007-2008 Tom Balfe"
#property link      "http://www.forex-tsd.com/members/nittany1.html"
#property link      "redcarsarasota@yahoo.com"
#property indicator_separate_window



int spread;
//---- user selectable stuff
extern int  SpreadThreshold   = 6;
extern bool Show_h1_ADX       = true;
extern bool Show_h4_ADX       = true;
extern int  ADX_trend_level   = 23;
extern int  ADX_trend_strong  = 28;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- indicator short name
   IndicatorShortName("ToR 1.12 ");

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   //---- need to delete objects should user remove indicator
   ObjectsDeleteAll(0,OBJ_LABEL);
     ObjectDelete("ToR112-1");ObjectDelete("ToR112-2");ObjectDelete("ToR112-3");
     ObjectDelete("ToR112-3a");ObjectDelete("ToR112-4");ObjectDelete("ToR112-4a");
     ObjectDelete("ToR112-4d");ObjectDelete("ToR112-5");ObjectDelete("ToR112-6");
     ObjectDelete("ToR112-6a");ObjectDelete("ToR112-6d");ObjectDelete("ToR112-7");
     ObjectDelete("ToR112-8");ObjectDelete("ToR112-8a");ObjectDelete("ToR112-8d");
     ObjectDelete("ToR112-9");ObjectDelete("ToR112-10");ObjectDelete("ToR112-10a");
     ObjectDelete("ToR112-10d");ObjectDelete("ToR112-11");ObjectDelete("ToR112-12");
     ObjectDelete("ToR112-12a");ObjectDelete("ToR112-13");ObjectDelete("ToR112-12d");
     ObjectDelete("ToR112-14");ObjectDelete("ToR112-15");ObjectDelete("ToR112-18d");
     
          
   return(0);
  }

int start()
  {
   //---- let's define some stuff 
   // M1 ADX data
   double adx_m1 = iADX(NULL,1,14,PRICE_CLOSE,0,0); // ADX 1 min
   double adx_1ago_m1 = iADX(NULL,1,14,PRICE_CLOSE,0,1); // ADX 1 min 1 bar ago
   double di_p_m1 = iADX(NULL,1,14,PRICE_CLOSE,1,0); // DI+ 1 min
   double di_m_m1 = iADX(NULL,1,14,PRICE_CLOSE,2,0); // DI- 1 min
   // M5 ADX data
   double adx_m5 = iADX(NULL,5,14,PRICE_CLOSE,0,0); // ADX 5 min
   double adx_1ago_m5 = iADX(NULL,5,14,PRICE_CLOSE,0,1); // ADX 5 min 1 bar ago
   double di_p_m5 = iADX(NULL,5,14,PRICE_CLOSE,1,0); // DI+ 5 min
   double di_m_m5 = iADX(NULL,5,14,PRICE_CLOSE,2,0); // DI- 5 min
   // M15 ADX data
   double adx_m15 = iADX(NULL,15,14,PRICE_CLOSE,0,0); // ADX 15 min
   double adx_1ago_m15 = iADX(NULL,15,14,PRICE_CLOSE,0,1); // ADX 15 min 1 bar ago
   double di_p_m15 = iADX(NULL,15,14,PRICE_CLOSE,1,0); // DI+ 15 min
   double di_m_m15 = iADX(NULL,15,14,PRICE_CLOSE,2,0); // DI- 15 min
   // M30 ADX data
   double adx_m30 = iADX(NULL,30,14,PRICE_CLOSE,0,0); // ADX 30 min
   double adx_1ago_m30 = iADX(NULL,30,14,PRICE_CLOSE,0,1); // ADX 30 min 1 bar ago
   double di_p_m30 = iADX(NULL,30,14,PRICE_CLOSE,1,0); // DI+ 30 min
   double di_m_m30 = iADX(NULL,30,14,PRICE_CLOSE,2,0); // DI- 30 min
   // h1 ADX data
   double adx_h1 = iADX(NULL,60,14,PRICE_CLOSE,0,0); // ADX 1 hour
   double adx_1ago_h1 = iADX(NULL,60,14,PRICE_CLOSE,0,1); // ADX 1 hr 1 bar ago
   double di_p_h1 = iADX(NULL,60,14,PRICE_CLOSE,1,0); // DI+ 1 hour
   double di_m_h1 = iADX(NULL,60,14,PRICE_CLOSE,2,0); // DI- 1 hour
   // h4 ADX data
   double adx_h4 = iADX(NULL,240,14,PRICE_CLOSE,0,0); // ADX 4 hour
   double adx_1ago_h4 = iADX(NULL,240,14,PRICE_CLOSE,0,1); // ADX 4 hr 1 bar ago
   double di_p_h4 = iADX(NULL,240,14,PRICE_CLOSE,1,0); // DI+ 4 hour
   double di_m_h4 = iADX(NULL,240,14,PRICE_CLOSE,2,0); // DI- 4 hour
   
   //---- define colors and arrows 
   color adx_color_m1,adx_color_m5,adx_color_m15,adx_color_m30,adx_color_h1,adx_color_h4;
   string  adx_arrow_m1,adx_arrow_m5,adx_arrow_m15,adx_arrow_m30,adx_arrow_h1,adx_arrow_h4;
         
   //----- Assign colors
   
   adx_color_m1 = assigncolor(adx_m1,ADX_trend_level,di_p_m1, di_m_m1);
   adx_color_m5 = assigncolor(adx_m5,ADX_trend_level,di_p_m5, di_m_m5);
   adx_color_m15 = assigncolor(adx_m15,ADX_trend_level,di_p_m15, di_m_m15);
   adx_color_m30 = assigncolor(adx_m30,ADX_trend_level,di_p_m30, di_m_m30);
   adx_color_h1 = assigncolor(adx_h1,ADX_trend_level,di_p_h1, di_m_h1);
   adx_color_h4 = assigncolor(adx_h4,ADX_trend_level,di_p_h4, di_m_h4);
   
   //---- feed all the ADX values into strings      
   string adx_value_m1 = adx_m1;
   string adx_value_m5 = adx_m5;
   string adx_value_m15 = adx_m15;
   string adx_value_m30 = adx_m30;
   string adx_value_h1 = adx_h1;
   string adx_value_h4 = adx_h4;
   
   //----- Assign Arrows
   adx_arrow_m1 = AssignArrow(adx_m1,di_p_m1,di_m_m1);
   adx_arrow_m5 = AssignArrow(adx_m5,di_p_m5,di_m_m5);
   adx_arrow_m15= AssignArrow(adx_m15,di_p_m15,di_m_m15);
   adx_arrow_m30= AssignArrow(adx_m30,di_p_m30,di_m_m30);
   adx_arrow_h1 = AssignArrow(adx_h1,di_p_h1,di_m_h1);
   adx_arrow_h4 = AssignArrow(adx_h4,di_p_h4,di_m_h4);
     
   //---- defines what spread is 
   spread=MarketInfo(Symbol(),MODE_SPREAD);
    
   //+------------------------------------------------------------------+
   //|  Spread                                                          |
   //+------------------------------------------------------------------+
   ObjectCreate("ToR112-1", OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-1","SPREAD:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-1", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-1", OBJPROP_XDISTANCE, 65);
     ObjectSet("ToR112-1", OBJPROP_YDISTANCE, 2);
   //---- creates spread number, Lime if less than threshold, Red if above it
   ObjectCreate("ToR112-2", OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     if (spread<=SpreadThreshold)
     {
     ObjectSetText("ToR112-2",DoubleToStr(spread ,0),10, "Arial Bold", Lime);
     }
     else
     ObjectSetText("ToR112-2",DoubleToStr(spread ,0),10, "Arial Bold", Red);
     ObjectSet("ToR112-2", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-2", OBJPROP_XDISTANCE, 115);
     ObjectSet("ToR112-2", OBJPROP_YDISTANCE, 2);
   
   //+------------------------------------------------------------------+
   //|  1 MIN                                                           |
   //+------------------------------------------------------------------+ 
   ObjectCreate("ToR112-3",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-3","1 MIN:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-3", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-3", OBJPROP_XDISTANCE, 150);
     ObjectSet("ToR112-3", OBJPROP_YDISTANCE, 2);
   //---- create text "Getting: "
   ObjectCreate("ToR112-3a",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-3a","CHANGE:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-3a", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-3a", OBJPROP_XDISTANCE, 135);
     ObjectSet("ToR112-3a", OBJPROP_YDISTANCE, 17);
   
   //---- create 1 min value
   ObjectCreate("ToR112-4",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-4", " ADX "+StringSubstr(adx_value_m1,0,5)+" ",9, "Arial Bold",adx_color_m1);
     ObjectSet("ToR112-4", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-4", OBJPROP_XDISTANCE, 185);
     ObjectSet("ToR112-4", OBJPROP_YDISTANCE, 2);
   //---- create 1 min arrow, squiggle if ranging
   ObjectCreate("ToR112-4a",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-4a",adx_arrow_m1,9, "Wingdings",adx_color_m1);
     ObjectSet("ToR112-4a", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-4a", OBJPROP_XDISTANCE, 250);
     ObjectSet("ToR112-4a", OBJPROP_YDISTANCE, 2); 
   
   
   //----create 1 min Strong/Weaker/Ranging
   ObjectCreate("ToR112-4d",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
   ObjectSet("ToR112-4d", OBJPROP_CORNER, 0);
   ObjectSet("ToR112-4d", OBJPROP_XDISTANCE, 190);
   ObjectSet("ToR112-4d", OBJPROP_YDISTANCE, 17);
   if (adx_m1 < ADX_trend_level)
   {
     ObjectSetText("ToR112-4d", " RANGING ",8, "Arial Bold",Silver);
   } else if (adx_m1 > adx_1ago_m1)
            {
            ObjectSetText("ToR112-4d", " STRONGER ",8, "Arial Bold",Silver);
            } else 
                 {
                  ObjectSetText("ToR112-4d", " WEAKER ",8, "Arial Bold",Silver);
                 }
   
   //+------------------------------------------------------------------+
   //|  5 MIN                                                           |
   //+------------------------------------------------------------------+
   ObjectCreate("ToR112-5",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-5","5 MIN:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-5", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-5", OBJPROP_XDISTANCE, 270);
     ObjectSet("ToR112-5", OBJPROP_YDISTANCE, 2);
   //---- create 5 min value
   ObjectCreate("ToR112-6",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-6", " ADX "+StringSubstr(adx_value_m5,0,5)+" ",9, "Arial Bold",adx_color_m5);
     ObjectSet("ToR112-6", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-6", OBJPROP_XDISTANCE, 305);
     ObjectSet("ToR112-6", OBJPROP_YDISTANCE, 2);
   //---- create 5 min arrow, squiggle if ranging
   ObjectCreate("ToR112-6a",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-6a",adx_arrow_m5,9, "Wingdings",adx_color_m5);
     ObjectSet("ToR112-6a", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-6a", OBJPROP_XDISTANCE, 370);
     ObjectSet("ToR112-6a", OBJPROP_YDISTANCE, 2); 
   
   
   
   //----create 5 min Strong/Weaker/Ranging
   ObjectCreate("ToR112-6d",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
   ObjectSet("ToR112-6d", OBJPROP_CORNER, 0);
   ObjectSet("ToR112-6d", OBJPROP_XDISTANCE, 310);
   ObjectSet("ToR112-6d", OBJPROP_YDISTANCE, 17);
   if (adx_m5 < ADX_trend_level)
   {
     ObjectSetText("ToR112-6d", " RANGING ",8, "Arial Bold",Silver);
   } else if (adx_m5 > adx_1ago_m5)
            {
            ObjectSetText("ToR112-6d", " STRONGER ",8, "Arial Bold",Silver);
            } else 
                 {
                  ObjectSetText("ToR112-6d", " WEAKER ",8, "Arial Bold",Silver);
                 }
   
      
   //+------------------------------------------------------------------+
   //|  15 MIN                                                          |
   //+------------------------------------------------------------------+
   ObjectCreate("ToR112-7",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-7","15 MIN:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-7", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-7", OBJPROP_XDISTANCE, 390);
     ObjectSet("ToR112-7", OBJPROP_YDISTANCE, 2);
   //---- create 15 min value
   ObjectCreate("ToR112-8",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-8", " ADX "+StringSubstr(adx_value_m15,0,5)+" ",9, "Arial Bold",adx_color_m15);
     ObjectSet("ToR112-8", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-8", OBJPROP_XDISTANCE, 430);
     ObjectSet("ToR112-8", OBJPROP_YDISTANCE, 2);
   //---- create 15 min arrow, squiggle if ranging
   ObjectCreate("ToR112-8a",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-8a",adx_arrow_m15,9, "Wingdings",adx_color_m15);
     ObjectSet("ToR112-8a", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-8a", OBJPROP_XDISTANCE, 495);
     ObjectSet("ToR112-8a", OBJPROP_YDISTANCE, 2); 
   
   
   
   
     //----create 15 min Strong/Weaker/Ranging
   ObjectCreate("ToR112-8d",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
   ObjectSet("ToR112-8d", OBJPROP_CORNER, 0);
   ObjectSet("ToR112-8d", OBJPROP_XDISTANCE, 435);
   ObjectSet("ToR112-8d", OBJPROP_YDISTANCE, 17);
   if (adx_m15 < ADX_trend_level)
   {
     ObjectSetText("ToR112-8d", " RANGING ",8, "Arial Bold",Silver);
   } else if (adx_m15 > adx_1ago_m15)
            {
            ObjectSetText("ToR112-8d", " STRONGER ",8, "Arial Bold",Silver);
            } else 
                 {
                  ObjectSetText("ToR112-8d", " WEAKER ",8, "Arial Bold",Silver);
                 }
   
      
   //+------------------------------------------------------------------+
   //|  30 MIN                                                          |
   //+------------------------------------------------------------------+
   ObjectCreate("ToR112-9",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-9","30 MIN:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-9", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-9", OBJPROP_XDISTANCE, 515);
     ObjectSet("ToR112-9", OBJPROP_YDISTANCE, 2);
   //---- create 30 min value
   ObjectCreate("ToR112-10",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-10", " ADX "+StringSubstr(adx_value_m30,0,5)+" ",9, "Arial Bold",adx_color_m30);
     ObjectSet("ToR112-10", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-10", OBJPROP_XDISTANCE, 555);
     ObjectSet("ToR112-10", OBJPROP_YDISTANCE, 2);
   //---- create 30 min arrow, squiggle if ranging
   ObjectCreate("ToR112-10a",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-10a",adx_arrow_m30,9, "Wingdings",adx_color_m30);
     ObjectSet("ToR112-10a", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-10a", OBJPROP_XDISTANCE, 620);
     ObjectSet("ToR112-10a", OBJPROP_YDISTANCE, 2); 
   
   
   
        //----create 30 min Strong/Weaker/Ranging
   ObjectCreate("ToR112-10d",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
   ObjectSet("ToR112-10d", OBJPROP_CORNER, 0);
   ObjectSet("ToR112-10d", OBJPROP_XDISTANCE, 560);
   ObjectSet("ToR112-10d", OBJPROP_YDISTANCE, 17);
   if (adx_m30 < ADX_trend_level)
   {
     ObjectSetText("ToR112-10d", " RANGING ",8, "Arial Bold",Silver);
   } else if (adx_m30 > adx_1ago_m30)
            {
            ObjectSetText("ToR112-10d", " STRONGER ",8, "Arial Bold",Silver);
            } else 
                 {
                  ObjectSetText("ToR112-10d", " WEAKER ",8, "Arial Bold",Silver);
                 }
   
  
   
         
   if (Show_h1_ADX==true)
   {
   //+------------------------------------------------------------------+
   //|  1 HOUR                                                          |
   //+------------------------------------------------------------------+
   ObjectCreate("ToR112-11",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-11","1 HR:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-11", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-11", OBJPROP_XDISTANCE, 640);
     ObjectSet("ToR112-11", OBJPROP_YDISTANCE, 2);
   //---- create 15 min value
   ObjectCreate("ToR112-12",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-12", " ADX "+StringSubstr(adx_value_h1,0,5)+" ",9, "Arial Bold",adx_color_h1);
     ObjectSet("ToR112-12", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-12", OBJPROP_XDISTANCE, 670);
     ObjectSet("ToR112-12", OBJPROP_YDISTANCE, 2);
   ObjectCreate("ToR112-12a",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-12a",adx_arrow_h1,9, "Wingdings",adx_color_h1);
     ObjectSet("ToR112-12a", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-12a", OBJPROP_XDISTANCE, 735);
     ObjectSet("ToR112-12a", OBJPROP_YDISTANCE, 2);
        
        
        //----create hour min Strong/Weaker/Ranging
   ObjectCreate("ToR112-12d",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
   ObjectSet("ToR112-12d", OBJPROP_CORNER, 0);
   ObjectSet("ToR112-12d", OBJPROP_XDISTANCE, 675);
   ObjectSet("ToR112-12d", OBJPROP_YDISTANCE, 17);
   if (adx_h1 < ADX_trend_level)
   {
     ObjectSetText("ToR112-12d", " RANGING ",8, "Arial Bold",Silver);
   } else if (adx_h1 > adx_1ago_h1)
            {
            ObjectSetText("ToR112-12d", " STRONGER ",8, "Arial Bold",Silver);
            } else 
                 {
                  ObjectSetText("ToR112-12d", " WEAKER ",8, "Arial Bold",Silver);
                 }
   
   
   } 
   if (Show_h4_ADX==true)
   {
   //+------------------------------------------------------------------+
   //|  4 HOUR                                                          |
   //+------------------------------------------------------------------+
   ObjectCreate("ToR112-13",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-13","4 HR:", 8, "Arial Bold", LightSteelBlue);
     ObjectSet("ToR112-13", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-13", OBJPROP_XDISTANCE, 760);
     ObjectSet("ToR112-13", OBJPROP_YDISTANCE, 2);
   //---- create 15 min value
   ObjectCreate("ToR112-14",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-14", " ADX "+StringSubstr(adx_value_h4,0,5)+" ",9, "Arial Bold",adx_color_h4);
     ObjectSet("ToR112-14", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-14", OBJPROP_XDISTANCE, 790);
     ObjectSet("ToR112-14", OBJPROP_YDISTANCE, 2);
   ObjectCreate("ToR112-15",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
     ObjectSetText("ToR112-15",adx_arrow_h4,9, "Wingdings",adx_color_h4);
     ObjectSet("ToR112-15", OBJPROP_CORNER, 0);
     ObjectSet("ToR112-15", OBJPROP_XDISTANCE, 855);
     ObjectSet("ToR112-15", OBJPROP_YDISTANCE, 2);
   
   
   
       //----create 4hour min Strong/Weaker/Ranging
   ObjectCreate("ToR112-18d",OBJ_LABEL, WindowFind("ToR 1.12 "), 0, 0);
   ObjectSet("ToR112-18d", OBJPROP_CORNER, 0);
   ObjectSet("ToR112-18d", OBJPROP_XDISTANCE, 795);
   ObjectSet("ToR112-18d", OBJPROP_YDISTANCE, 17);
   if (adx_h4 < ADX_trend_level)
   {
     ObjectSetText("ToR112-18d", " RANGING ",8, "Arial Bold",Silver);
   } else if (adx_h4 > adx_1ago_h4)
            {
            ObjectSetText("ToR112-18d", " STRONGER ",8, "Arial Bold",Silver);
            } else 
                 {
                  ObjectSetText("ToR112-18d", " WEAKER ",8, "Arial Bold",Silver);
                 }
   
   }
   return(0);
  }
   
  //+------------------------------------------------------------------+
  //|  Common Functions                                                |
  //+------------------------------------------------------------------+
   color assigncolor(double adx_time,double ADX_trend_level,double di_p_time,double di_m_time)
   {
   if (adx_time < ADX_trend_level) { return (LightSkyBlue); }
   else if (di_p_time > di_m_time) { return (Lime); }
   else {return (Red); }
   
   }
  string AssignArrow (double adx_time, double di_p_time, double di_m_time)
    {                                
            if ((adx_time < ADX_trend_level) && (adx_time != 0)) 
            {
                 return ("h");
            }
            else if (adx_time < ADX_trend_strong )
                   {
                         if (di_p_time > di_m_time)
                         {
                          return ("ì");
                         }  
                         else
                          {
                            return ("î");
                          }
              
                    } else 
                         {
                             if (di_p_time > di_m_time)
                             {
                                  return ("é");
                             } else
                                {
                                   return ("ê");
                                 }
       
                         }
     } //End Function
     

Comments