![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
mtf painting style
hey guys,
can you fix this so it carries on painting like it looks when you first load it on a chart, with flat lev for each htf bar?
instead of going all squiggly after its been loaded
i.e. each level at close of bar or refresh by some time division of htf?
this indicator is from TSD but i dont know the term to search for this way of mtf painting if its been done already
cheers n good trading
Use this one. You will not have any of those problems with it
Have a nice weekend![](https://c.mql5.com/forextsd/smiles/smile.png)
hey guys,
can you fix this so it carries on painting like it looks when you first load it on a chart, with flat lev for each htf bar?
instead of going all squiggly after its been loaded
i.e. each level at close of bar or refresh by some time division of htf?
this indicator is from TSD but i dont know the term to search for this way of mtf painting if its been done already
cheers n good tradingUse this one. You will not have any of those problems with it Have a nice weekend
you're the greatest!![](https://c.mql5.com/forextsd/smiles/party.png)
Thanks. Is that an EA or an indicator?
you're the greatest!
Hi Zigflip - I have two indicators that I'd like programmed into an EA, could you assist? Many thanks in advance.
custom indicator
Hello friends,
I tried to make my own custom indicator, but i can't get it to compile. the indicator is supposed to draw the h8 support and resistance levels in any chart lower than 8 hours. i was planning to use it on the 1m time frame as i'm tired of doing it manually and also i wanted to make an ea out of it. i have been gaining a lot of pips with out loss so i think it will be a good tool. please let me know what i'm doing wrong and fix it if you want.
thanks
/+------------------------------------------------------------------+
//| res1 8 hr.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| Cway |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "Cway"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 MediumBlue //---- indicator color
#property indicator_color2 DarkGreen //---- indicator color
#property indicator_color3 FireBrick //---- indicator color
#property indicator_color4 DarkGreen //---- indicator color
#property indicator_color5 FireBrick //---- indicator color
#property indicator_color6 DarkGreen //---- indicator color
#property indicator_color7 FireBrick //---- indicator color
double Buf_0[],Buf_1[],Buf_2[],Buf_3[],Buf_4[],Buf_5[],Buf_6[]; //---- indicator line declared
//----
int init()
{
SetIndexBuffer (0,Buf_0);//---- indicators line assigning
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);//---- indicators line style
SetIndexBuffer (1,Buf_1);//---- indicators line assigning
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (2,Buf_2);//---- indicators line assigning
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (3,Buf_3);//---- indicators line assigning
SetIndexStyle (3,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (4,Buf_4);//---- indicators line assigning
SetIndexStyle (4,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (5,Buf_5);//---- indicators line assigning
SetIndexStyle (5,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (6,Buf_6);//---- indicators line assigning
SetIndexStyle (6,DRAW_LINE,STYLE_SOLID,1);
return;
//----
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (Period() > 480) return(0); //Chart cannot be higher than H8
int counted_bars=IndicatorCounted();
if (counted_bars >0) counted_bars--;
int limit=Bars-counted_bars;
for (int i = limit-1; i>=0; i--)
int period = MathCeil(480 / Period()); //Time frame to draw from H8
double prevH=0, prevC=0, prevO=0,prevL=0
prevO = Open ;
prevC = Close;
prevH = High;
prevL = Low [Lowest (NULL, 0, MODE_LOW, period, i+1)];
{double X = (prevC < prevO -- prevH + (prevL*2) + prevC);
Buf_3 = X /2 - prevL ;
Buf_2 = X /4 - prevL ;
Buf_1 = X /6 - prevL ;
Buf_0 = X /8 - prevL ;
Buf_4 = X /6 - prevH ;
Buf_5 = X /4 - prevH ;
Buf_6 = X /2 - prevH ;
if X =( prevC > prevO -- ((prevH*2) + prevL + prevC)); {
Buf_3 = X /2 - prevL ;
Buf_2 = X /4 - prevL ;
Buf_1 = X /6 - prevL ;
Buf_0 = X /8 - prevL ;
Buf_4 = X /6 - prevH ;
Buf_5 = X /4 - prevH ;
Buf_6 = X /2 - prevH ;
if else X = (prevC = prevO -- ((prevH) + prevL + (prevC*2));
Buf_3= X /2 - prevL ;
Buf_2 = X /4 - prevL ;
Buf_1 = X /6 - prevL ;
Buf_0 = X /8 - prevL ;
Buf_4 = X /6 - prevH ;
Buf_5 = X /4 - prevH ;
Buf_6 = X /2 - prevH ;
}
}
//+------------------------------------------------------------------+
return(0);
//+------------------------------------------------------------------+
Shift bar for custom indicator in separate windows
I have problem when add shift option for indicator, it's show a number of emty value when I set shit in minus value.
How to code indicator to shift with current bar in which can set both plus and minus number.
cway
What are lines like this : double X = (prevC < prevO -- prevH + (prevL*2) + prevC) intended to do?
For start you will have to rewrite those to conform to mql coding rules
Hello friends,
I tried to make my own custom indicator, but i can't get it to compile. the indicator is supposed to draw the h8 support and resistance levels in any chart lower than 8 hours. i was planning to use it on the 1m time frame as i'm tired of doing it manually and also i wanted to make an ea out of it. i have been gaining a lot of pips with out loss so i think it will be a good tool. please let me know what i'm doing wrong and fix it if you want.
thanks
/+------------------------------------------------------------------+
//| res1 8 hr.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| Cway |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "Cway"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 MediumBlue //---- indicator color
#property indicator_color2 DarkGreen //---- indicator color
#property indicator_color3 FireBrick //---- indicator color
#property indicator_color4 DarkGreen //---- indicator color
#property indicator_color5 FireBrick //---- indicator color
#property indicator_color6 DarkGreen //---- indicator color
#property indicator_color7 FireBrick //---- indicator color
double Buf_0[],Buf_1[],Buf_2[],Buf_3[],Buf_4[],Buf_5[],Buf_6[]; //---- indicator line declared
//----
int init()
{
SetIndexBuffer (0,Buf_0);//---- indicators line assigning
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);//---- indicators line style
SetIndexBuffer (1,Buf_1);//---- indicators line assigning
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (2,Buf_2);//---- indicators line assigning
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (3,Buf_3);//---- indicators line assigning
SetIndexStyle (3,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (4,Buf_4);//---- indicators line assigning
SetIndexStyle (4,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (5,Buf_5);//---- indicators line assigning
SetIndexStyle (5,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer (6,Buf_6);//---- indicators line assigning
SetIndexStyle (6,DRAW_LINE,STYLE_SOLID,1);
return;
//----
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
if (Period() > 480) return(0); //Chart cannot be higher than H8
int counted_bars=IndicatorCounted();
if (counted_bars >0) counted_bars--;
int limit=Bars-counted_bars;
for (int i = limit-1; i>=0; i--)
int period = MathCeil(480 / Period()); //Time frame to draw from H8
double prevH=0, prevC=0, prevO=0,prevL=0
prevO = Open ;
prevC = Close;
prevH = High;
prevL = Low [Lowest (NULL, 0, MODE_LOW, period, i+1)];
{double X = (prevC < prevO -- prevH + (prevL*2) + prevC);
Buf_3 = X /2 - prevL ;
Buf_2 = X /4 - prevL ;
Buf_1 = X /6 - prevL ;
Buf_0 = X /8 - prevL ;
Buf_4 = X /6 - prevH ;
Buf_5 = X /4 - prevH ;
Buf_6 = X /2 - prevH ;
if X =( prevC > prevO -- ((prevH*2) + prevL + prevC)); {
Buf_3 = X /2 - prevL ;
Buf_2 = X /4 - prevL ;
Buf_1 = X /6 - prevL ;
Buf_0 = X /8 - prevL ;
Buf_4 = X /6 - prevH ;
Buf_5 = X /4 - prevH ;
Buf_6 = X /2 - prevH ;
if else X = (prevC = prevO -- ((prevH) + prevL + (prevC*2));
Buf_3= X /2 - prevL ;
Buf_2 = X /4 - prevL ;
Buf_1 = X /6 - prevL ;
Buf_0 = X /8 - prevL ;
Buf_4 = X /6 - prevH ;
Buf_5 = X /4 - prevH ;
Buf_6 = X /2 - prevH ;
}
}
//+------------------------------------------------------------------+
return(0);
//+------------------------------------------------------------------+Premeus
It is normal : applying negative shift, you shift all in the past, and since you do not know future values, there must stay a gap of unfiled values at the rightmost part of your chart
I have problem when add shift option for indicator, it's show a number of emty value when I set shit in minus value. How to code indicator to shift with current bar in which can set both plus and minus number.
My Indicator
Thank you, mladen.
As in the picture, Is there other method to enter at specific shift indicator as I show in picture.
Thank you in advance.