Menu
Brokers
MT4 Forex Brokers
MT5 Forex brokers
PayPal Brokers
Skrill Brokers
Oil Trading Brokers
Gold Trading Brokers
Web Browser Platform
Brokers with CFD Trading
ECN Brokers
Bitcoin FX Brokers
PAMM Forex Brokers
With Cent Accounts
With High Leverage
Cryptocurrency Brokers
Forums
All threads
New threads
New posts
Trending
Search forums
What's new
New threads
New posts
Latest activity
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Reply to thread
Forums
Trading Platforms
MetaTrader Indicators
Volume indicator with division in buy and sell
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
[QUOTE="robertomargot, post: 192448, member: 62386"] Hey guys, Could anyone help to modify this indicator? I would like it to display the buy and sell volume side by side on each candle, similar to the attached figure. As it stands, it overlaps buy and sell. I would be happy if someone could help me with this, but if someone also adds the real volume, it would be great. Thank you very much! [CODE=mql4] //+------------------------------------------------------------------+ //| TicksSeparateVolume.mq4 | //| //| http://www.metaquotes.net | //+------------------------------------------------------------------+ //----- #property indicator_separate_window #property indicator_buffers 2 #property indicator_minimum 0 #property indicator_color1 SteelBlue #property indicator_color2 Red double UpTicks[]; double DownTicks[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorShortName("TicksVolume("+Symbol()+")"); SetIndexBuffer(0,UpTicks); SetIndexBuffer(1,DownTicks); SetIndexStyle(0,DRAW_HISTOGRAM,0,2); SetIndexStyle(1,DRAW_HISTOGRAM,0,2); SetIndexLabel(0,"UpTicks"); SetIndexLabel(1,"DownTicks"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { ObjectDelete("UpTicks1"); ObjectDelete("DownTicks1"); ObjectDelete("UpTicks2"); ObjectDelete("DownTicks2"); Comment(""); return(0); } //+------------------------------------------------------------------+ //| Ticks Volume Indicator | //+------------------------------------------------------------------+ int start() { ObjectDelete("UpTicks1"); ObjectDelete("DownTicks1"); ObjectDelete("UpTicks2"); ObjectDelete("DownTicks2"); int i,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=0; i<limit; i++) { UpTicks[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2; DownTicks[i]=Volume[i]-UpTicks[i]; } string BV="BUY VOLUME : "+DoubleToStr(UpTicks[0],0)+""; string SV="SELL VOLUME: "+DoubleToStr(DownTicks[0],0)+""; ObjectCreate("UpTicks2", OBJ_LABEL, WindowFind("TicksVolume("+Symbol()+")"), 0, 0); ObjectSetText("UpTicks2",StringSubstr((BV),0), 15, "Tahoma Bold" ,White); ObjectSet("UpTicks2", OBJPROP_CORNER, 0); ObjectSet("UpTicks2", OBJPROP_XDISTANCE, 5); ObjectSet("UpTicks2", OBJPROP_YDISTANCE, 15); ObjectCreate("DownTicks2", OBJ_LABEL, WindowFind("TicksVolume("+Symbol()+")"), 0, 0); ObjectSetText("DownTicks2",StringSubstr((SV),0), 15, "Tahoma Bold" ,White); ObjectSet("DownTicks2", OBJPROP_CORNER, 0); ObjectSet("DownTicks2", OBJPROP_XDISTANCE, 5); ObjectSet("DownTicks2", OBJPROP_YDISTANCE, 35); //---- return(0); } //+------------------------------------------------------------------+ [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Top
Bottom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…