Skyscraper_Fix_x10

Download script
Author: Copyright © 2018, Nikolay Kositsin

The Skyscraper Fix x100 is a multi-timeframe monitoring dashboard designed to provide traders with a high-level overview of market sentiment and trend direction across various periods simultaneously. Instead of requiring you to switch between different charts to see what is happening on hourly, daily, or weekly scales, this tool aggregates that information into a single, organized visual display.

Core Functionality

The script works by "polling" multiple timeframes at once. It connects to the underlying data for several specific periods—ranging from H1 (1 hour) up to MN1 (Monthly)—and extracts specific trend signals from them.

Key Logic Components:

  • Multi-Timeframe Aggregation: The tool creates 10 unique "channels" of information. Each channel represents a different timeframe defined in the settings. This allows you to see the "big picture" (monthly trends) and the "immediate picture" (hourly movements) side-by-side.
  • Signal Processing: For every timeframe being tracked, the script looks for specific trading signals. It distinguishes between different types of market actions, such as:
    • Buy/Sell Signals: Identifying primary trend directions.
    • Up/Down Movements: Nuanced indicators showing the strength or direction of the current price action.
    • Trend Transitions: The logic identifies when a signal changes (e.g., switching from a bullish to a bearish state) and assigns specific colors to these states to make them instantly recognizable.
  • Dynamic Visual Dashboard: Rather than drawing lines on a chart, this script generates a "Label Dashboard." It automatically calculates the correct spacing and positioning for text and icons based on your screen's corner preference (e.g., bottom-left).
    • It uses specialized symbols (Wingdings) to represent market trends visually.
    • It dynamically updates the text and colors of these labels in real-time as new data arrives from the various timeframes.
  • Smart Formatting: The script includes logic to handle "missing" data. If a timeframe hasn't loaded enough history to be valid, the tool intelligently skips it or holds the previous value to ensure the dashboard remains stable and doesn't crash or show "zeroed" errors.

User Experience Summary

From a user perspective, this script transforms a complex task—manually checking 10 different charts for trend alignment—into a single glance at a corner of your screen. It provides a color-coded summary where you can see if the H1, H4, D1, and Weekly trends are all aligned, helping you identify high-probability trading environments where all timeframes agree on a single direction.

Price Data Components
9 Views
0 Downloads
0 Favorites
Skyscraper_Fix_x10
ÿþ//+------------------------------------------------------------------+

//|                                           Skyscraper_Fix_x10.mq5 |

//|                               Copyright © 2018, Nikolay Kositsin |

//|                              Khabarovsk,   farria@mail.redcom.ru | 

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

#property copyright "Copyright © 2018, Nikolay Kositsin"

#property link      "farria@mail.redcom.ru"

#property description "=48:0B>@ >B>1@0605B ?>;>65=85 =0?@02;5=85 B@5=40 8=48:0B>@0 Skyscraper_Fix A 45AOB8 @07=KE B09<D@59<>2"

//---- =><5@ 25@A88 8=48:0B>@0

#property version   "1.00"

//---- >B@8A>2:0 8=48:0B>@0 2 3;02=>< >:=5

#property indicator_chart_window

//---- :>;8G5AB2> 8=48:0B>@=KE 1CD5@>2 0

#property indicator_buffers 0 

//---- =5 8A?>;L7>20=> =8 >4=>3> 3@0D8G5A:>3> ?>AB@>5=8O

#property indicator_plots   0

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

//|  >1JO2;5=85 :>=AB0=B                         |

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

#define RESET 0          // >=AB0=B0 4;O 2>72@0B0 B5@<8=0;C :><0=4K =0 ?5@5AGQB 8=48:0B>@0

#define INDTOTAL 10      // >=AB0=B0 4;O :>;8G5AB20 >B>1@0605<KE 8=48:0B>@>2

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

// ?8A0=85 ?5@5G8A;5=8O type_font               |

// ?8A0=85 :;0AA0 CFontName                     | 

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

#include <GetFontName.mqh>

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

//| 1JO2;5=85 ?5@5G8A;5=89                      |

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

enum Method

  {

   MODE_HighLow,  //High/Low

   MODE_Close     //Close

  };

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

//| E>4=K5 ?0@0<5B@K 8=48:0B>@0                 |

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

input ENUM_TIMEFRAMES TimeFrame0=PERIOD_H1;           //?5@8>4 3@0D8:0 1

input ENUM_TIMEFRAMES TimeFrame1=PERIOD_H2;           //?5@8>4 3@0D8:0 2

input ENUM_TIMEFRAMES TimeFrame2=PERIOD_H3;           //?5@8>4 3@0D8:0 3

input ENUM_TIMEFRAMES TimeFrame3=PERIOD_H4;           //?5@8>4 3@0D8:0 4

input ENUM_TIMEFRAMES TimeFrame4=PERIOD_H6;           //?5@8>4 3@0D8:0 5

input ENUM_TIMEFRAMES TimeFrame5=PERIOD_H8;           //?5@8>4 3@0D8:0 6

input ENUM_TIMEFRAMES TimeFrame6=PERIOD_H12;          //?5@8>4 3@0D8:0 7

input ENUM_TIMEFRAMES TimeFrame7=PERIOD_D1;           //?5@8>4 3@0D8:0 8

input ENUM_TIMEFRAMES TimeFrame8=PERIOD_W1;           //?5@8>4 3@0D8:0 9

input ENUM_TIMEFRAMES TimeFrame9=PERIOD_MN1;          //?5@8>4 3@0D8:0 10 

input uint SignalBar=1;                               //><5@ 10@0 4;O ?>;CG5=8O A83=0;0 (0 - B5:CI89 10@)

//---- 0@0<5B@K Skyscraper_Fix

input uint    Length=10;                              //5@8>4 ATR

input double  Kv=0.9;                                 //$0:B>@ GC2AB28B5;L=>AB8 8=48:0B>@0

input double  Percentage=0;                           //@81;865=85 A@54=59 ;8=88 : ;8=8O< M:AB@5<C<>2

input Method  HighLow=MODE_HighLow;                   // 0AGQB 8=48:0B>@0 ?> High/Low 8;8 Close

//---- 0@0<5B@K >B>1@065=8O 8=48:0B>@0

input color  CpColor=clrBlueViolet;                   //F25B =0720=8O 8=48:0B>@0

input color  BuyColor=clrLimeGreen;                   //F25B Buy A83=0;0

input color  UpColor=clrTeal;                         //F25B ?@>4>;65=8O @0ABCI53> B@5=40

input color  DnColor=clrPurple;                       //F25B ?@>4>;65=8O ?040NI53> B@5=40

input color  SellColor=clrRed;                        //F25B Sell A83=0;0

input int    FontSize=15;                             //@07<5@ H@8DB0

input type_font FontType=Font14;                      //B8? H@8DB0

input ENUM_BASE_CORNER  WhatCorner=CORNER_LEFT_LOWER; //C3>; @0A?>;>65=8O

input uint Y_=20;                                     //@0A?>;>65=85 ?> 25@B8:0;8

input uint X_=5;                                      //@0A?>;>65=85 ?> 3>@87>=B0;8

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

string sFontType;

int min_rates_total;

uint xshift,shift[11];

string sPer[10],sPerA[10],sPerB[10],Cap;

ENUM_TIMEFRAMES ePer[10];

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

//| >;CG5=85 B09<D@59<0 2 2845 AB@>:8                               |

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

string GetStringTimeframe(ENUM_TIMEFRAMES timeframe)

  {return(StringSubstr(EnumToString(timeframe),7,-1));}

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

//|  ;0AA <0AA82>2                                                  |

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

class CIndArrow

  {

   //----

public:

   double            m_Ind[2];

   int               m_Handle;

   ENUM_TIMEFRAMES   m_TimeFrame;

   //---- 

  };

//---- >1JO2;5=85 <0AA82>2, :>B>@K5 1C4CB 2 

// 40;L=59H5< 8A?>;L7>20=K 4;O ?>;CG5=8O 8=48:0B>@=KE 7=0G5=89

CIndArrow Ind[INDTOTAL];

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

//| Custom indicator initialization function                         | 

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

int OnInit()

  {

//----  

   ePer[0]=TimeFrame0;

   ePer[1]=TimeFrame1;

   ePer[2]=TimeFrame2;

   ePer[3]=TimeFrame3;

   ePer[4]=TimeFrame4;

   ePer[5]=TimeFrame5;

   ePer[6]=TimeFrame6;

   ePer[7]=TimeFrame7;

   ePer[8]=TimeFrame8;

   ePer[9]=TimeFrame9;

   for(int poz=0; poz<INDTOTAL; poz++) Ind[poz].m_TimeFrame=ePer[poz];

//---- >;CG5=85 E5=4;>2 8=48:0B>@>2

   for(int poz=0; poz<INDTOTAL; poz++)

     {

      Ind[poz].m_Handle=iCustom(Symbol(),Ind[poz].m_TimeFrame,"Skyscraper_Fix",Length,Kv,Percentage,HighLow);



      if(Ind[poz].m_Handle==INVALID_HANDLE)

        {

         Print("OnInit()(",poz,"): 5 C40;>AL ?>;CG8BL E5=4; 8=48:0B>@0 Skyscraper_Fix");

         return(false);

        }

     }

//----   

   CFontName FONT;

   sFontType=FONT.GetFontName(FontType);

   Deinit();

   int ATR_Period=15;

   min_rates_total=ATR_Period+int(Length+1);

   min_rates_total++;

//----  

   xshift=int(X_+8.3*FontSize);

   Cap="Skyscraper_Fix_x10";

//----

   switch(WhatCorner)

     {

      case CORNER_RIGHT_LOWER:

        {

         for(int poz=0; poz<=INDTOTAL; poz++) shift[10-poz]=Y_+22*poz;

         break;

        }



      case CORNER_LEFT_LOWER:

        {

         for(int poz=0; poz<=INDTOTAL; poz++) shift[10-poz]=Y_+22*poz;

         break;

        }

      default:

        {

         for(int poz=0; poz<=INDTOTAL; poz++) shift[poz]=Y_+22*poz;

        }

     }



   for(int poz=0; poz<INDTOTAL; poz++)

     {

      sPer[poz]=GetStringTimeframe(ePer[poz]);

      sPerA[poz]=sPer[poz]+"Stat+";

      sPerB[poz]=sPer[poz]+"Stat_";

     }

//--- 7025@H5=85 8=8F80;870F88

   return(INIT_SUCCEEDED);

  }

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

//| Custom indicator deinitialization function                       |

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

void OnDeinit(const int reason)

  {

//----

   Deinit();

//----

   ChartRedraw(0);

  }

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

//| Custom indicator deinitialization function                       |

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

void Deinit()

  {

//----

   for(int poz=0; poz<INDTOTAL; poz++)

     {

      ObjectDelete(0,sPerA[poz]);

      ObjectDelete(0,sPerB[poz]);

     }

   ObjectDelete(0,Cap);

//----

  }

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

//|  !>740=85 B5:AB>2>9 ;591K                                        |

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

void CreateTLabel

(

 long   chart_id,         // 845=B8D8:0B>@ 3@0D8:0

 string name,             // 8<O >1J5:B0

 int    nwin,             // 8=45:A >:=0

 ENUM_BASE_CORNER corner,// ?>;>65=85 C3;0 ?@82O7:8

 ENUM_ANCHOR_POINT point, // ?>;>65=85 B>G:8 ?@82O7:8

 int    X,                // 48AB0=F8O 2 ?8:A5;OE ?> >A8 X >B C3;0 ?@82O7:8

 int    Y,                // 48AB0=F8O 2 ?8:A5;OE ?> >A8 Y >B C3;0 ?@82O7:8

 string text,             // B5:AB

 color  Color,            // F25B B5:AB0

 string Font,             // H@8DB B5:AB0

 int    Size              // @07<5@ H@8DB0

 )

//---- 

  {

//----

   ObjectCreate(chart_id,name,OBJ_LABEL,0,0,0);

   ObjectSetInteger(chart_id,name,OBJPROP_CORNER,corner);

   ObjectSetInteger(chart_id,name,OBJPROP_ANCHOR,point);

   ObjectSetInteger(chart_id,name,OBJPROP_XDISTANCE,X);

   ObjectSetInteger(chart_id,name,OBJPROP_YDISTANCE,Y);

   ObjectSetString(chart_id,name,OBJPROP_TEXT,text);

   ObjectSetInteger(chart_id,name,OBJPROP_COLOR,Color);

   ObjectSetString(chart_id,name,OBJPROP_FONT,Font);

   ObjectSetInteger(chart_id,name,OBJPROP_FONTSIZE,Size);

   ObjectSetInteger(chart_id,name,OBJPROP_BACK,false);

//----

  }

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

//|  5@5CAB0=>2:0 B5:AB>2>9 ;591K                                   |

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

void SetTLabel

(

 long   chart_id,         // 845=B8D8:0B>@ 3@0D8:0

 string name,             // 8<O >1J5:B0

 int    nwin,             // 8=45:A >:=0

 ENUM_BASE_CORNER corner,// ?>;>65=85 C3;0 ?@82O7:8

 ENUM_ANCHOR_POINT point, // ?>;>65=85 B>G:8 ?@82O7:8

 int    X,                // 48AB0=F8O 2 ?8:A5;OE ?> >A8 X >B C3;0 ?@82O7:8

 int    Y,                // 48AB0=F8O 2 ?8:A5;OE ?> >A8 Y >B C3;0 ?@82O7:8

 string text,             // B5:AB

 color  Color,            // F25B B5:AB0

 string Font,             // H@8DB B5:AB0

 int    Size              // @07<5@ H@8DB0

 )

//---- 

  {

//----

   if(ObjectFind(chart_id,name)==-1) CreateTLabel(chart_id,name,nwin,corner,point,X,Y,text,Color,Font,Size);

   else

     {

      ObjectSetString(chart_id,name,OBJPROP_TEXT,text);

      ObjectSetInteger(chart_id,name,OBJPROP_XDISTANCE,X);

      ObjectSetInteger(chart_id,name,OBJPROP_YDISTANCE,Y);

      ObjectSetInteger(chart_id,name,OBJPROP_COLOR,Color);

     }

//----

  }

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

//| Custom indicator iteration function                              | 

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

int OnCalculate(

                const int rates_total,    // :>;8G5AB2> 8AB>@88 2 10@0E =0 B5:CI5< B8:5

                const int prev_calculated,// :>;8G5AB2> 8AB>@88 2 10@0E =0 ?@54K4CI5< B8:5

                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[]

                )

  {

//--- ?@>25@:0 :>;8G5AB20 10@>2 =0 4>AB0B>G=>ABL 4;O @0AG5B0

   for(int poz=0; poz<INDTOTAL; poz++) if(Bars(Symbol(),ePer[poz])<min_rates_total) return(prev_calculated);



//---- :>?8@C5< 2=>2L ?>O282H85AO 40==K5 2 <0AA82K 

   for(int poz=0; poz<INDTOTAL; poz++) if(CopyBuffer(Ind[poz].m_Handle,5,SignalBar,2,Ind[poz].m_Ind)<=0) return(prev_calculated);

//----

   color ColorGain[INDTOTAL];

   string SignalSymbol[INDTOTAL];

   ArrayInitialize(ColorGain,clrNONE);

//---- :>?8@C5< 2=>2L ?>O282H85AO 40==K5 2 <0AA82K 

   for(int poz=0; poz<INDTOTAL; poz++)

     {

      switch(int(Ind[poz].m_Ind[1]))

        {

         case  0: ColorGain[poz]=BuyColor;

         switch(int(Ind[poz].m_Ind[0]))

           {

            case  0: SignalSymbol[poz]="2"; ColorGain[poz]=UpColor; break;

            case  1: SignalSymbol[poz]="6"; ColorGain[poz]=BuyColor; break;

           }

         break;

         case  1: ColorGain[poz]=SellColor;

         switch(int(Ind[poz].m_Ind[0]))

           {           

            case  0: SignalSymbol[poz]="8"; ColorGain[poz]=SellColor; break;

            case  1: SignalSymbol[poz]="2"; ColorGain[poz]=DnColor; break;

           }

         break;

        }

     }

//----

   for(int poz=0; poz<INDTOTAL; poz++)

     {

      SetTLabel(0,sPerA[poz],0,WhatCorner,ENUM_ANCHOR_POINT(2*WhatCorner),X_,shift[poz+1],sPer[poz]+": ",ColorGain[poz],sFontType,FontSize);

      SetTLabel(0,sPerB[poz],0,WhatCorner,ENUM_ANCHOR_POINT(2*WhatCorner),xshift,shift[poz+1],SignalSymbol[poz],ColorGain[poz],"Wingdings 3",FontSize);

     }

   SetTLabel(0,Cap,0,WhatCorner,ENUM_ANCHOR_POINT(2*WhatCorner),X_,shift[0],Cap,CpColor,sFontType,FontSize);

//----

   ChartRedraw(0);

   return(rates_total);

  }

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

Comments