__TRO_XY_Axis_Plot

Author:
__TRO_XY_Axis_Plot

This script is designed to enhance the visual interface of your trading platform by creating a custom coordinate system or "axis plot" directly on your chart window. Instead of performing complex mathematical calculations or automated trading, its primary purpose is aesthetic and organizational: it builds a structured grid of labels and lines to help you better visualize price levels or data points.

How the Script Works

1. Visual Framework Construction When you first load the script onto your chart, it automatically generates a series of decorative text labels. It creates two distinct sets of horizontal "axes." These are arranged at specific vertical positions on your screen to act as a reference guide.

2. Labeling and Formatting The script handles the heavy lifting of design by:

  • Setting the specific font style (Arial).
  • Defining the color of the lines (DimGray) so they remain visible but do not clutter the main price action.
  • Positioning each line at a precise distance from the corner of your screen, ensuring the layout remains consistent.

3. Dynamic Rendering and Management To ensure the chart remains clean and responsive, the script includes specific "cleanup" logic:

  • Initialization: It builds the entire grid as soon as it is activated.
  • Dynamic Painting: It ensures that all lines are colored correctly and visible during active trading sessions.
  • Auto-Cleanup: If you remove the script from your chart, it includes a dedicated "delete" function. This is important because it automatically wipes away all the drawn labels and axes, preventing "ghost" markings from staying on your chart after the tool is turned off.

Summary for the User

Think of this tool as a custom dashboard ruler. It doesn't change how the market moves; rather, it draws a professional, permanent set of reference lines and numerical markers on your screen to help you keep your visual perspective organized while analyzing price trends.

11 Views
0 Downloads
0 Favorites
__TRO_XY_Axis_Plot

//+------------------------------------------------------------------+ 
//| __TRO_XY_Axis_Plot                                               | 
//|                                                                  | 
//|------------------------------------------------------------------+ 
#property copyright "" 

#property link      "" 

#property indicator_chart_window 

//---- input parameters 

 
extern double v0 =  500.00 ;
extern double v1 =  200.00 ;
extern double v2 =  100.00 ;
extern double v3 =  50.00 ;
extern double v4 =  20.00 ;
extern double v5 =  10.00 ;

//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
  
     initGraph();
  
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- 
    deleteObject();   
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
 
 


int start() 
  {  
 
   objectBlank();   
  
   paintLine();
   
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 


void initGraph()
  {
   deleteObject();
   
//   objectCreate("line57a",10,1050,"-1050---------------------------------",10,"Arial",DimGray);
//   objectCreate("line57b",10,950,"-950----------------------------------",10,"Arial",DimGray);
   objectCreate("line57c",10,850,"-050----------------------------------",10,"Arial",DimGray);
   objectCreate("line57d",10,750,"-150----------------------------------",10,"Arial",DimGray);
   objectCreate("line57e",10,650,"-250----------------------------------",10,"Arial",DimGray);  
   objectCreate("line57f",10,550,"-350----------------------------------",10,"Arial",DimGray);
   objectCreate("line57g",10,450,"-450----------------------------------",10,"Arial",DimGray);
   objectCreate("line57h",10,350,"-550----------------------------------",10,"Arial",DimGray);
   objectCreate("line57i",10,250,"-650----------------------------------",10,"Arial",DimGray);
   objectCreate("line57" ,10,150,"-750----------------------------------",10,"Arial",DimGray);

   objectCreate("line97a",10,1000,"-1000------»»» xy axis plot © «««-----",10,"Arial",DimGray);
   objectCreate("line97b",10,900,"-900----------------------------------",10,"Arial",DimGray);
   objectCreate("line97c",10,800,"-100----------------------------------",10,"Arial",DimGray);
   objectCreate("line97d",10,700,"-200----------------------------------",10,"Arial",DimGray);
   objectCreate("line97e",10,600,"-300----------------------------------",10,"Arial",DimGray);  
   objectCreate("line97f",10,500,"-400----------------------------------",10,"Arial",DimGray);
   objectCreate("line97g",10,400,"-500----------------------------------",10,"Arial",DimGray);
   objectCreate("line97h",10,300,"-600----------------------------------",10,"Arial",DimGray);
   objectCreate("line97i",10,200,"-700----------------------------------",10,"Arial",DimGray);
   objectCreate("line97" ,10,100,"-800------- xy axis plot © -----",10,"Arial",DimGray);
//   objectCreate("sign",11,1,"»»» xy axis plot © «««",8,"Arial Narrow",DimGray);
  }   
  
//+------------------------------------------------------------------+
void objectCreate(string name,int x,int y,string text="-",int size=42,
                  string font="Arial",color colour=CLR_NONE)
  {
   ObjectCreate(name,OBJ_LABEL,0,0,0);
   ObjectSet(name,OBJPROP_CORNER,3);
   ObjectSet(name,OBJPROP_COLOR,colour);
   ObjectSet(name,OBJPROP_XDISTANCE,x);
   ObjectSet(name,OBJPROP_YDISTANCE,y);
   ObjectSetText(name,text,size,font,colour);
  }
  
void deleteObject()
  {  
  
  ObjectDelete("line57"); 
  ObjectDelete("line57a"); 
  ObjectDelete("line57b"); 
  ObjectDelete("line57c"); 
  ObjectDelete("line57d"); 
  ObjectDelete("line57e"); 
  ObjectDelete("line57f"); 
  ObjectDelete("line57g"); 
  ObjectDelete("line57h"); 
  ObjectDelete("line57i"); 
  
  ObjectDelete("line97"); 
  ObjectDelete("line97a"); 
  ObjectDelete("line97b"); 
  ObjectDelete("line97c"); 
  ObjectDelete("line97d"); 
  ObjectDelete("line97e"); 
  ObjectDelete("line97f"); 
  ObjectDelete("line97g"); 
  ObjectDelete("line97h"); 
  ObjectDelete("line97i"); 
//  ObjectDelete("sign"); 
  }
  
void objectBlank()
  {
        
   
   ObjectSet("line98",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("line97",OBJPROP_COLOR,CLR_NONE); 
  }
 
  

  
void paintLine()
  {
   ObjectSet("line98",OBJPROP_COLOR,DimGray);
   ObjectSet("line97",OBJPROP_COLOR,DimGray);
   ObjectSet("line97a",OBJPROP_COLOR,DimGray);
   ObjectSet("line97b",OBJPROP_COLOR,DimGray);
   ObjectSet("line97c",OBJPROP_COLOR,DimGray);
   ObjectSet("line97d",OBJPROP_COLOR,DimGray);
   ObjectSet("line97e",OBJPROP_COLOR,DimGray);
   ObjectSet("line97f",OBJPROP_COLOR,DimGray);
   ObjectSet("line97g",OBJPROP_COLOR,DimGray);
   ObjectSet("line97h",OBJPROP_COLOR,DimGray);
   ObjectSet("line97i",OBJPROP_COLOR,DimGray);
   ObjectSet("line97",OBJPROP_COLOR,DimGray);   
   ObjectSet("line98",OBJPROP_COLOR,DimGray);
   
   ObjectSet("line57",OBJPROP_COLOR,DimGray);
   ObjectSet("line57a",OBJPROP_COLOR,DimGray);
   ObjectSet("line57b",OBJPROP_COLOR,DimGray);
   ObjectSet("line57c",OBJPROP_COLOR,DimGray);
   ObjectSet("line57d",OBJPROP_COLOR,DimGray);
   ObjectSet("line57e",OBJPROP_COLOR,DimGray);
   ObjectSet("line57f",OBJPROP_COLOR,DimGray);
   ObjectSet("line57g",OBJPROP_COLOR,DimGray);
   ObjectSet("line57h",OBJPROP_COLOR,DimGray);
   ObjectSet("line57i",OBJPROP_COLOR,DimGray);
   ObjectSet("line57",OBJPROP_COLOR,DimGray);  
  
  }

Comments