The line needs to be plotted first before the histogram because the histogram is based on the values of the line.
Thanks @phade for quick reply.
Actually histogram is based on double BufferVolume[] by copying data from long tick_volume[] buffer, as I was not allowed to use long type tick_volume buffer in SimpleMAOnBuffer or other variants.
Line is based on double BufferNVOL[].
Anyway I have tried to shift buffers as per your suggestion as below:
#define _bNVolume 0 #define _bVolume 1 #define _bClrIndex 2
Now it just draws the Line and not the 'Histogram'
Looking forward to resolve the issue.
Thanks @phade for quick reply.
Actually histogram is based on double BufferVolume[] by copying data from long tick_volume[] buffer, as I was not allowed to use long type tick_volume buffer in SimpleMAOnBuffer or other variants.
Line is based on double BufferNVOL[].
Anyway I have tried to shift buffers as per your suggestion as below:
Now it just draws the Line and not the 'Histogram'
Looking forward to resolve the issue.
Now it just draws the Line and not the 'Histogram'
Looking forward to resolve the issue.
When making a custom indicator, you need to define properties for all of the plots, also taking in mind what Alain said.
So set the properties like this this:
#property description "Normalized Volume Indicator [Volume%]" #property description "With selection of MA Method / Volume Type defaulted to TickVolume" #property indicator_separate_window #property indicator_buffers 3 #property indicator_plots 2 #property indicator_type1 DRAW_LINE #property indicator_style1 STYLE_SOLID #property indicator_color1 clrDodgerBlue #property indicator_width1 1 #property indicator_type2 DRAW_HISTOGRAM #property indicator_color2 clrGreen, clrRed #property indicator_width2 3
This is correct:
#define _bNVolume 0 #define _bVolume 1 #define _bClrIndex 2
When making a custom indicator, you need to define properties for all of the plots, also taking in mind what Alain said.
So set the properties like this this:
This is correct:
Thanks a lot @phade and @Alain Verleyen.
the below code finally resolved the issue :)
#property indicator_separate_window #property indicator_buffers 3 #property indicator_plots 2 #property indicator_type1 DRAW_LINE #property indicator_style1 STYLE_SOLID #property indicator_color1 clrDodgerBlue #property indicator_width1 1 #property indicator_type2 DRAW_COLOR_HISTOGRAM #property indicator_color2 clrGreen, clrRed #property indicator_width2 3 //+-----------------------------------------------------------------------------------------------------------------------------+ //| Define Indicator Buffers for Data & Arrays for Indicator Calculation //+-----------------------------------------------------------------------------------------------------------------------------+ #define _bNVolume 0 #define _bVolume 1 #define _bClrIndex 2 double BufferNVOL[]; // Normalized Volume double BufferVolume[]; double BufferColorIndex[]; //+-----------------------------------------------------------------------------------------------------------------------------+ //| Plot Indicator Lables in SubWindow (used instead of #property) //+-----------------------------------------------------------------------------------------------------------------------------+ PlotIndexSetString(_bNVolume,PLOT_LABEL,"NVOL ("+string(ExtAvgPeriod)+") "); //PlotIndexSetInteger(_bNVolume,PLOT_DRAW_TYPE,DRAW_LINE); ...NEEDED TO REMOVE THESE, not understood why //PlotIndexSetInteger(_bNVolume,PLOT_LINE_STYLE,STYLE_SOLID); //PlotIndexSetInteger(_bNVolume,PLOT_LINE_COLOR,clrDodgerBlue); //PlotIndexSetInteger(_bNVolume,PLOT_LINE_WIDTH,1); PlotIndexSetDouble(_bNVolume,PLOT_EMPTY_VALUE,0.00); PlotIndexSetInteger(_bNVolume,PLOT_DRAW_BEGIN,ExtAvgPeriod-1); PlotIndexSetString(_bVolume,PLOT_LABEL,"TickVOL"); //PlotIndexSetInteger(_bVolume,PLOT_DRAW_TYPE,DRAW_COLOR_HISTOGRAM); //PlotIndexSetInteger(_bVolume,PLOT_LINE_STYLE,STYLE_SOLID); //PlotIndexSetInteger(_bVolume,PLOT_LINE_WIDTH,3); PlotIndexSetDouble(_bVolume,PLOT_EMPTY_VALUE,0.00); PlotIndexSetInteger(_bVolume,PLOT_DRAW_BEGIN,ExtAvgPeriod-1);
You also don't necessarily need to comment out those PlotIndexSetInteger lines, it's just important to include the properties for the plots. I also had the same issue before
@phade Thanks for reply :)
Well there is no point in keeping double properties for same result.
Hence decided to remove the commented out once (for which #property method used), and
keep the once where #property not used.
Anyway THANKS A LOT again, for helping me out.
Regards
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Greetings Fellows
I have created a custom indicator to display tick volume as histogram and average volume as line. The indicator is drawing the histogram but not the line.
Data Window though shows both values are calculated. Screenshot and Code attached.
Any clues what I am doing wrong will highly appreciated.
Regards