you can try my code
High[1]+ (WindowPriceMax()-WindowPriceMin() )/20;
the size is depends of your chart zoom
or you can see it clearly in my indicator
//+------------------------------------------------------------------+ //| Body+nose.mq4 | //| WDholic | //| www.libertyreserve.com U9527577 | //+------------------------------------------------------------------+ #property copyright "WDholic" #property link " " // #property indicator_chart_window //---- input parameters extern int corner=3; extern int topOff=190 ; extern color warna=Aqua; extern color warni=Salmon; extern color warno=Yellow; extern int Candle=15; double UPhilo,lastUPHILO; int BarCount; int x=1,n=0; string c,hl; double BD[200], h[200]; int test=5; //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if(Digits==3||Digits==5) { x=10; n=1; } UPhilo=(WindowPriceMax()-WindowPriceMin()) /20; //---- bodyku.......... ObjectDelete("upnose");ObjectDelete("downnose"); double upnose = (iHigh(Symbol(),0,0)-MathMax (iOpen(Symbol(),0,0), iClose(Symbol(),0,0)))/Point; double downnose = (MathMin(iOpen(Symbol(),0,0),iClose(Symbol(),0,0))-iLow(Symbol(),0,0))/Point; ObjectCreate("upnose", OBJ_TEXT, 0, Time[0], iHigh(Symbol(),0,0)+UPhilo* x); ObjectSetText("upnose", " "+DoubleToStr(upnose/x ,n)+"n", 10, "Tahoma", warni); ObjectCreate("downnose", OBJ_TEXT, 0, Time[0], iLow(Symbol(),0,0)); ObjectSetText("downnose"," "+DoubleToStr(downnose/x ,n)+"n", 10, "Tahoma", warno); h[0] =(iHigh(Symbol(),0,0)-iLow(Symbol(),0,0))/Point; ObjectDelete("h0"); ObjectCreate("h0", OBJ_TEXT, 0, Time[0], iHigh(Symbol(),0,0)+UPhilo* x); ObjectSetText("h0"," "+DoubleToStr(h[0]/x ,n), 10, "Tahoma", warno); double body=( Bid-iOpen(Symbol(),0,0))/Point; ObjectDelete("c0"); if (body>=0) {ObjectCreate("c0", OBJ_TEXT, 0, Time[0], iLow(Symbol(),0,0)); ObjectSetText("c0"," "+DoubleToStr(body/x ,n), 10, "Tahoma", warna); } if (body<0) {ObjectCreate("c0", OBJ_TEXT, 0, Time[0],iLow(Symbol(),0,0)); ObjectSetText("c0"," "+DoubleToStr(-body/x ,n), 10, "Arial Bold", warni); } double range =(iHigh(Symbol(),1440,0)-iLow(Symbol(),1440,0))/Point; ObjectDelete("range"); ObjectCreate("range", OBJ_LABEL, 0, 0, 0); ObjectSet("range", OBJPROP_CORNER, corner); ObjectSet("range", OBJPROP_XDISTANCE, 7); ObjectSet("range", OBJPROP_YDISTANCE,topOff+42); ObjectSetText("range",DoubleToStr(range/x,n)+" - HI - LO " , 9, "Arial Bold", warno); string ODP =DoubleToStr(iOpen(Symbol(),1440,0),Digits); double ODp =(Bid-iOpen(Symbol(),1440,0))/Point; ObjectDelete("ODP"); ObjectCreate("ODP", OBJ_LABEL, 0, 0, 0); ObjectSet("ODP", OBJPROP_CORNER, corner); ObjectSet("ODP", OBJPROP_XDISTANCE, 7); ObjectSet("ODP", OBJPROP_YDISTANCE,topOff+28); string HDP =DoubleToStr(iHigh(Symbol(),1440,0),Digits); double HDp =(iHigh(Symbol(),1440,0)-Bid)/Point; ObjectDelete("HDP"); ObjectCreate("HDP", OBJ_LABEL, 0, 0, 0); ObjectSet("HDP", OBJPROP_CORNER, corner); ObjectSet("HDP", OBJPROP_XDISTANCE, 7); ObjectSet("HDP", OBJPROP_YDISTANCE,topOff+14); ObjectSetText("HDP",DoubleToStr(HDp/x,n)+" -H "+HDP , 9, "Arial Bold", warno); string LDP =DoubleToStr(iLow(Symbol(),1440,0),Digits); double LDp =(Bid-iLow(Symbol(),1440,0))/Point; ObjectDelete("LDP"); ObjectCreate("LDP", OBJ_LABEL, 0, 0, 0); ObjectSet("LDP", OBJPROP_CORNER, corner); ObjectSet("LDP", OBJPROP_XDISTANCE, 7); ObjectSet("LDP", OBJPROP_YDISTANCE,topOff ); ObjectSetText("LDP",DoubleToStr(LDp/x,n)+" -L "+LDP , 9, "Arial Bold", warni); if (ODp>=0) {ObjectSetText("ODP",DoubleToStr(ODp/x,n)+" -O "+ODP , 9, "Arial Bold", warna);} if (ODp<0) {ObjectSetText("ODP",DoubleToStr(ODp/x,n)+" -O "+ODP , 9, "Arial Bold", warni);} if (lastUPHILO!=UPhilo|| BarCount != Bars) { for (int xxx=1;xxx<=Candle;xxx++) { c="c"+xxx; hl="h"+xxx; ObjectDelete(c); BD[xxx] =(iClose(Symbol(),0,xxx)-iOpen(Symbol(),0,xxx))/Point; h[xxx] =(iHigh(Symbol(),0,xxx)-iLow(Symbol(),0,xxx))/Point; ObjectDelete(hl); ObjectCreate(hl, OBJ_TEXT, 0, Time[xxx], iHigh(Symbol(),0,xxx)+UPhilo*x); ObjectSetText(hl,DoubleToStr(h[xxx]/x ,n), 8, "Tahoma", warno); if ( BD[xxx]>=0) {ObjectCreate(c, OBJ_TEXT, 0, Time[xxx], iLow(Symbol(),0,xxx)-UPhilo*x/3); ObjectSetText(c,DoubleToStr( BD[xxx]/x ,n), 8, "Tahoma", warna); } if ( BD[xxx]<0) {ObjectCreate(c, OBJ_TEXT, 0, Time[xxx], iLow(Symbol(),0,xxx)-UPhilo*x/3); ObjectSetText(c,DoubleToStr(- BD[xxx]/x ,n), 8, "Tahoma", warni); } } } lastUPHILO=UPhilo; // bodyku............. BarCount = Bars; return(0); } //+------------------------------------------------------------------+ int init() { UPhilo=(WindowPriceMax()-WindowPriceMin())/20;lastUPHILO=0; start(); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { lastUPHILO=0; UPhilo=(WindowPriceMax()-WindowPriceMin()) /20; ObjectDelete("ODP"); ObjectDelete("body0"); ObjectDelete("body2");ObjectDelete("upnose");ObjectDelete("downnose"); ObjectDelete("body4"); ObjectDelete("body5"); ObjectDelete("LDP"); ObjectDelete("HDP"); for (int xxx=0;xxx<=200;xxx++) {c="c"+xxx; hl="h"+xxx; ObjectDelete(c); ObjectDelete(hl); } return(0); }
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
Hi,
I want to draw an OBJ_ARROW
directly below the low of my bar
and
directly above the high of my bar.
When I want to place it under my bar, I can say Low[1] the arrow is correct placed.
But when I want to place it over my bar I have to say High[1]+ x * pips2dbl.
How can I calculate x, so that it works automatically on all my timeframes?