_TRO_Open

This tool is designed as a visual overlay for the MetaTrader platform, specifically created to help traders identify and visualize key historical price data directly on their trading charts.

Core Functionality

The primary purpose of this script is to track and display "Opening Prices." In market analysis, knowing where a price started at a specific point in time is often crucial for determining trend direction or identifying support and resistance levels. This indicator automates the process of locating those specific values so they can be seen clearly on the screen without manual calculation.

How It Works

The logic operates by scanning the historical data of the financial instrument you are currently viewing. For every candle (bar) on your chart, the script looks back at the previous period to retrieve its opening price.

Instead of just providing a raw number in a list, the script translates this data into visual markers:

  • Visual Identification: It places specific symbols (arrows) onto the chart.
  • Data Mapping: Each arrow represents a significant price point captured from the preceding bar.
  • Real-Time Tracking: As new price action occurs, the indicator updates to reflect the most recent opening prices, ensuring that your visual workspace remains current with the moving market.

User Experience

For the end user, this means you don't have to manually toggle between different timeframes or historical records to see where a previous session started. The script handles the "heavy lifting" of data retrieval, providing a clean, automated way to keep track of price origins. It serves as a visual reference point, helping traders maintain a clearer perspective on price history while they analyze current market movements.

10 Views
0 Downloads
0 Favorites
_TRO_Open
//+------------------------------------------------------------------+
//|       _TRO_Open                                                  |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_chart_window 

#property indicator_buffers 4

#property indicator_color1 LightGray 
#property indicator_color2 Gray
#property indicator_color3 DarkGray
#property indicator_color4 Silver  

// indicators parameters

//---- buffers
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
double P4Buffer[]; 

double xPrice ;
int myStyle  = 2 ;

int myWingDing  = 250 ;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer(0, P1Buffer);
   SetIndexBuffer(1, P2Buffer);
   SetIndexBuffer(2, P3Buffer);
   SetIndexBuffer(3, P4Buffer); 

SetIndexArrow(0, myWingDing); 
SetIndexArrow(1, myWingDing);
SetIndexArrow(2, myWingDing);
SetIndexArrow(3, myWingDing); 

SetIndexStyle(0, DRAW_ARROW, myStyle, 1);
SetIndexStyle(1, DRAW_ARROW, myStyle, 1);
SetIndexStyle(2, DRAW_ARROW, myStyle, 1);
SetIndexStyle(3, DRAW_ARROW, myStyle, 1);  
   
SetIndexEmptyValue(0,0); 
SetIndexEmptyValue(1,0);
SetIndexEmptyValue(2,0);
SetIndexEmptyValue(3,0);
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   int i, dayi, counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--;  
   int limit = Bars - counted_bars;
//----   





   for(i = limit - 1; i >= 0; i--)
     {
      
        P1Buffer[i] =  iOpen(Symbol(), 0, i + 1) ;   
//        P1Buffer[i] =  iOpen(Symbol(), PERIOD_H1, i + 1) ;
//        P2Buffer[i] =  iOpen(Symbol(), PERIOD_D1, i + 1); 
//        P3Buffer[i] =  iOpen(Symbol(), PERIOD_W1, i + 1); 
//        P4Buffer[i] =  iOpen(Symbol(), PERIOD_MN1, i + 1); 
                    
     } // for 
 
   return(0);

  } // start

Comments