_BZ_TL_skylineM

Download script
Author: Skyline,2008
_BZ_TL_skylineM

This script is designed as a visual trading tool that helps identify key price levels based on hourly data. It simplifies the complexity of the market by projecting specific "action zones" onto your chart, allowing you to see where potential trades might begin and where they should end.

Core Functionality

The logic follows a structured approach to help traders visualize their potential risk and reward for every new hour:

1. Hourly Reference Points The script looks at the previous hour's price action to establish a baseline. Every time a new hour begins, it automatically identifies the opening price of that hour. It uses this starting point to project several different levels across your screen.

2. Dynamic Trade Levels Instead of just showing you one price, the tool calculates four distinct zones based on your personalized settings:

  • Entry Triggers: It projects two lines representing the "Buy" and "Sell" entry points. These are calculated as a specific distance above and below the hourly opening price.
  • Profit Targets: It identifies two potential exit points for your gains. These represent where you might want to close a trade successfully, based on a target distance from the opening price.
  • Stop-Loss Protection: The script also calculates safety nets. It takes the current closing price and projects "Stop Loss" lines in both directions to help you visualize where a trade might become too risky to maintain.

3. Visual Organization & Time Tracking To keep your chart clean and organized, the script includes several visual aids:

  • Time Markers: It draws vertical indicators on the chart to clearly mark the transition between different hours.
  • Labels: If enabled, the tool can place text directly on the chart, explicitly labeling the "Open Price," "Buy Entry," "Sell Entry," and the various "Profit Targets." This removes the guesswork of interpreting colors alone.
  • Automatic Cleanup: The script is designed to be efficient; it automatically manages the objects it creates on your chart, ensuring that old data is cleared and new markers are drawn accurately as the market moves forward.

Summary for the User

In simple terms, this tool acts as a pre- gesetzt (pre-set) roadmap for each hour of trading. By looking at the chart, you can immediately see exactly how far the price needs to move to hit your profit goals or trigger your entry signals, providing a clear, visual boundary for your trading plan.

Price Data Components
Series array that contains open prices of each barSeries array that contains open prices of each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
_BZ_TL_skylineM
//+------------------------------------------------------------------+ 
//|                                                  _BZ_Skyline.mq4 | 
//|                                                    Skyline, 2008 | 
//|                                      http://www.forexpertutti.it | 
//+------------------------------------------------------------------+ 
#property copyright "Skyline,2008" 
#property link      "www.forexpertutti.it" 

#property indicator_chart_window 
#property  indicator_buffers 7 
#property  indicator_color1  White 
#property  indicator_color2  RoyalBlue 
#property  indicator_color3  Red 
#property  indicator_color4  LimeGreen 
#property  indicator_color5  LimeGreen 
#property  indicator_color6  SlateBlue 
#property  indicator_color7  SlateBlue 

#property  indicator_style1 2  
#property  indicator_style2 2  
#property  indicator_style3 2  
#property  indicator_style4 2  
#property  indicator_style5 2  
#property  indicator_style6 2  
#property  indicator_style7 2  


extern double myEntryTrigger   = 4 ; 
extern double myProfitTarget   = 10; 
extern double myStopLoss       = 7 ; 
extern int    Shift            = 0 ; 

extern color  myHourColor   = DarkGray ; 
extern int    myStyle       = STYLE_DOT; 
extern bool   ShowLables    = false ;

double OpenLine[]; 
double BuyLine1[]; 
double BuyLine2[]; 
double SellLine1[]; 
double SellLine2[]; 
double TargetLine1[]; 
double TargetLine2[]; 
double StopLossLine1[]; 
double StopLossLine2[]; 

//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
//---- indicators 
   SetIndexStyle(0,DRAW_LINE); 
   SetIndexBuffer(0,OpenLine);    
   SetIndexStyle(1,DRAW_LINE); 
   SetIndexBuffer(1,BuyLine1);  
   SetIndexStyle(2,DRAW_LINE); 
   SetIndexBuffer(2,SellLine1);  
   SetIndexStyle(3,DRAW_LINE); 
   SetIndexBuffer(3,TargetLine1);  
   SetIndexStyle(4,DRAW_LINE); 
   SetIndexBuffer(4,TargetLine2);      
   SetIndexStyle(5,DRAW_LINE); 
   SetIndexBuffer(5,StopLossLine1);  
   SetIndexStyle(6,DRAW_LINE); 
   SetIndexBuffer(6,StopLossLine2);      
  
   SetIndexShift(0,Shift); 
   SetIndexShift(1,Shift); 
   SetIndexShift(2,Shift); 
   SetIndexShift(3,Shift); 
   SetIndexShift(4,Shift); 
   SetIndexShift(5,Shift); 
   SetIndexShift(6,Shift); 


//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit()
  {
//----

      for ( int i = ObjectsTotal() - 1; i >= 0; i-- ) 
    {
      string name = ObjectName( i );
      if ( StringFind( name, "HourStart" ) >= 0 ) 
         ObjectDelete( name );
       if ( StringFind( name, "Hour" ) >= 0 ) 
          ObjectDelete( name );
        if ( StringFind( name,"OpenText" ) >= 0 ) 
          ObjectDelete( name );
       if ( StringFind( name, "SellEntry" ) >= 0 ) 
          ObjectDelete( name );
       if ( StringFind( name, "BuyEntry"  ) >= 0 ) 
          ObjectDelete( name );
       if ( StringFind( name, "ProfitTarget1" ) >= 0 ) 
          ObjectDelete( name );
       if ( StringFind( name, "ProfitTarget2" ) >= 0 ) 
          ObjectDelete( name );
 
    }

//----
   return(0);
  }

//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int start() 
  { 
   int    counted_bars=IndicatorCounted(); 
   int limit; 
//---- 

   if( TimeHour(Time[0] ) != TimeHour(Time[1]) ) 
     { 
                
     double level= (High[1] + Low[1] + Close[1]) / 3; 
     SetTimeLine("HourStart", "Hour", 0, White, level+10*Point); // draw the vertical bars that marks the time span 
     } 


   //---- last counted bar will be recounted 
   if(counted_bars>0) counted_bars--; 
    
   limit=Bars-counted_bars; 
    
   for (int i=0; i<limit; i++) 
   { 
    int BarShift   = iBarShift(NULL,PERIOD_H1,Time[i],true); 
    double OpenH1  = iOpen(NULL,PERIOD_H1,BarShift); 
    OpenLine[i]    = OpenH1; 
    BuyLine1[i]    = OpenH1+myEntryTrigger*Point; 
    SellLine1[i]   = OpenH1-myEntryTrigger*Point; 
    TargetLine1[i] = OpenH1+myProfitTarget*Point; 
    TargetLine2[i] = OpenH1-myProfitTarget*Point;    
    StopLossLine1[i] = iClose(NULL,0,i)+ myStopLoss*Point; 
    StopLossLine2[i] = iClose(NULL,0,i)- myStopLoss*Point; 

   } 
//---- 
 if (ShowLables)  DisplayText(); 
    
   return(0); 
  } 
  
void DisplayText() 
{ 
  
 double OpenH1 = iOpen(NULL,PERIOD_H1,0); 
 ObjectDelete("OpenText"); 
 ObjectDelete("SellEntry"); 
 ObjectDelete("BuyEntry"); 
 ObjectDelete("ProfitTarget1"); 
 ObjectDelete("ProfitTarget2"); 
 // Text for Open Price 
 ObjectCreate("OpenText",OBJ_TEXT,0,Time[0],OpenH1); 
 ObjectSetText("OpenText","Open price",8,"Verdana",White); 
 // Text for Sell Entry 
 ObjectCreate("SellEntry",OBJ_TEXT,0,Time[0],OpenH1-myEntryTrigger*Point); 
 ObjectSetText("SellEntry","Sell entry",8,"Verdana",Red); 
 // Text for Buy Entry 
 ObjectCreate("BuyEntry",OBJ_TEXT,0,Time[0],OpenH1+myEntryTrigger*Point); 
 ObjectSetText("BuyEntry","Buy entry",8,"Verdana",Blue); 
 // Text for ProfitTarget1 
 ObjectCreate("ProfitTarget1",OBJ_TEXT,0,Time[0],OpenH1+myProfitTarget*Point); 
 ObjectSetText("ProfitTarget1","Profit Target (BUY)",8,"Verdana",Green);  
 // Text for ProfitTarget2 
 ObjectCreate("ProfitTarget2",OBJ_TEXT,0,Time[0],OpenH1-myProfitTarget*Point); 
 ObjectSetText("ProfitTarget2","Profit Target (SELL)",8,"Verdana",Green); 

} 

//+------------------------------------------------------------------+ 
void SetTimeLine(string objname, string text, int idx, color col1, double vleveltext) 
{ 
   string name= "[PIVOT] " + objname; 
   int x= Time[idx]; 
 ObjectDelete(" Label"); 

   if (ObjectFind(name) != 0) 
      ObjectCreate(name, OBJ_TREND, 0, x, 0, x, 100); 
   else { 
      ObjectMove(name, 0, x, 0); 
      ObjectMove(name, 1, x, 100); 
   } 
    
   ObjectSet(name, OBJPROP_STYLE, myStyle); 
   ObjectSet(name, OBJPROP_COLOR, myHourColor); 
    
   if (ObjectFind(name + " Label") != 0) 
      ObjectCreate(name + " Label", OBJ_TEXT, 0, x, vleveltext); 
   else 
      ObjectMove(name + " Label", 0, x, vleveltext); 
            
   ObjectSetText(name + " Label", text, 8, "Arial", col1); 
}  
 


//----


Comments