Draw Short Line IN Candle

To add comments, please log in or register
Alexandre Nakamura
19
Alexandre Nakamura  

Hello,

i´m new in MQL5 and i have a problem with draw short horizontal lines in candles.

I had tested and i can draw line between candles using Trend Lines, without Ray. But i want draw a short horizontal line in candle not between. Is possible in MT5?

Short Horizontal Line

 

Thanks for help.

Alain Verleyen
36103
Alain Verleyen  

Yes it's possible but you have to use "Precise time scale"

  • Precise time scale — if this option is disabled, objects are bound to bars along the horizontal scale of a chart. If you enable it, then it is possible to position an object at any point between bars.
Platform Settings - Getting Started - MetaTrader 5
Platform Settings - Getting Started - MetaTrader 5
  • www.metatrader5.com
The trading platform provides multiple settings to help you conveniently customize it. Click " Options" in the Tools menu or press "Ctrl+O". Charts — common settings of price charts and parameters of objects management: object selection straight after creation, immediate object configuration, and docking parameters; Trade — default parameters...
Alexandre Nakamura
19
Alexandre Nakamura  
Thanks Alain for your reply. 
But I think that is possible without Precise time scale. 

I saw a indicator that make  shorts horizontal lines and shorts vertical lines (like a stair) above or below the candles. 

It's a Hilo Indicator in forms of stair. 
Alain Verleyen
36103
Alain Verleyen  
Alexandre Nakamura:
Thanks Alain for your reply. 

But I think that is possible without Precise time scale. 


No it's not possible with timed objects (Trend lines).
I saw a indicator that make  shorts horizontal lines and shorts vertical lines (like a stair) above or below the candles. 

It's a Hilo Indicator in forms of stair. 
Can be using canvas, but your question was about trend lines.
Anthony Garot
1849
Anthony Garot  
Alain Verleyen:

Yes it's possible but you have to use "Precise time scale"

Thanks for pointing this out, @Alain. I had been using a horizontal line from the time before the bar to the time after the bar.

Alexandre Nakamura
19
Alexandre Nakamura  
Sorry. My English is not good. I want say that I tried do it with Trend Lines.
But I am trying do it in an indicator using something that work. 
Is it possible with Canvas? 
I will see it. 

Very thanks for your help. 
Ernst Van Der Merwe
5753
Ernst Van Der Merwe  
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_plots   1
//--- plot Median
#property indicator_label1  "Median"
#property indicator_type1   DRAW_COLOR_HISTOGRAM2
#property indicator_color1  clrRoyalBlue,clrFireBrick
#property indicator_style1  STYLE_SOLID
#property indicator_width1  5
//--- indicator buffers
double Buffer1[];
double Buffer2[];
double Colors[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Buffer1,INDICATOR_DATA);
   SetIndexBuffer(1,Buffer2,INDICATOR_DATA);
   SetIndexBuffer(2,Colors,INDICATOR_COLOR_INDEX);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                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[])
  {
//---
   int begin=rates_total!=prev_calculated?prev_calculated:rates_total-1;
   
   for(int i=begin;i<rates_total;i++)
     {
      Buffer1[i]=(open[i]+close[i])/2;
      Buffer2[i]=Buffer1[i]-1*_Point*10;
      Colors[i]=close[i]>=open[i]?0:1;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Alain Verleyen
36103
Alain Verleyen  
Ernst Van Der Merwe:
Doesn't really met the requirement.
Alexandre Nakamura
19
Alexandre Nakamura  

Very Thanks for help.

I will try do it with Canvas.

To add comments, please log in or register