How to Set Ask Price Label within the Chart?

 

Hi, Gurus:

Due to the Bid Price horizontal label Coveres the Ask Price label sometimes if the spread of the instant market quotes is too small and it covered by the Ask Price is really annoying!

I know the configuration of the MT4 terminal give our users one option : Select the Ask Price Horizontal Line show or not if open a item at the bottom of the menu(config...) pop out  while mouse right click on a chart.

I want to show the Ask Price(OBJ_LABEL or OBJ_TEXT) within the chart  at the same level of the Bid Price(which the default setting while open a MT4 terminal)

I've referred some suggestion or examples as posted on MQL4 forum before (Can I hide or show the ask -and bid- lines?   &  Simple Custom Indicator - Horizontal Lines ), but I didn't got what I want exactly!


Just in several words:   I want the Ask Price leeches the Bid Price horizontal line within the chart not on the vertical line (quotes ratio) that out of the chart !

Great Thanks!  


My temporary solution as below: (which not attach to the Ask Price horizontal line fruastrated me & the Ask Price Label will disappear at once if  the x_distance of the chart have changed! )

// Global variants
int xLabel;
int yLabel;

int OnInit()
{
  ...
    xLabel = (int)(x_distance*0.999);
    yLabel = (int)(y_distance)-Bid;
    if(Bid != 0)
    {
       if(!LabelCreate(0,"AskPrice",0,xLabel,yLabel,0,0,CORNER_LEFT_UPPER,DoubleToStr(Ask,gigits),InpLbFont,10,
         clrWhite,InpLbAngle,ANCHOR_RIGHT_LOWER,clrRed,clrNONE,InpLbBack,InpLbSelection,InpLbHidden,InpLbZOrder))
       {
         int Err=GetLastError();
         Print("Error creating AverageCost Label. Error code ",Err,". ",ErrorDescription(Err));
       }    
    }
}

void OnTick()
{
   ....

   ObjectSetInteger(0,"AskPrice",OBJPROP_XDISTANCE,xLabel);
   ObjectSetInteger(0,"AskPrice",OBJPROP_YDISTANCE,Bid);

}

 

 The debugging result as below:

 Ask-Bid Price Label Display Issue

 

Just open the "One Click Trading" option in the top-left and you will always see the Ask and Bid prices all the time:


 
FMIC:

Just open the "One Click Trading" option in the top-left and you will always see the Ask and Bid prices all the time:


   Thanks!

   Do you really carefully read & understood what I said?

   If the "One Click Trading" docks  & occupied a such space on the LEFT_UPPER corner of the chart  can resolves my problem so easily, I no need waste of time and post such an NEED FOR HELP article on the MQL4 forum.

   1. I run an EA on the MT4 terminal → The left upper corner of the chart will displays some info while EA running → The space will occupied by “One Click Trading” → The option has been rejected!

   2. The MT4 terminal gives us an option for displays BID & ASK price horizontal line on the chart instantly → These two lines sometimes too close and one label covered by another one due to the spread of these two is very small (esp. on ECN floating spread platform) → The option has been rejected!

   3. I need accept the default display way of the BID price horizontal line & without change any other settings → I need add a small label inside the chart which opposite to the BID price label on vertical column out of the chart!

   Ask-Bid Price Label Issue 2

 
Gatesby:

   1. I run an EA on the MT4 terminal → The left upper corner of the chart will displays some info while EA running → The space will occupied by “One Click Trading” →

The option has been rejected!

  

 

  

How to make sure that no effort will be made to help you by FMIC in future.

If you are dispaying information there already, why not just add the Ask price to that information?

 
GumRai:

How to make sure that no effort will be made to help you by FMIC in future.

If you are dispaying information there already, why not just add the Ask price to that information?

     I want the Ask Price leeches (while follow the instant market latest quotes ) the Bid Price horizontal line within the chart not on the vertical line (quotes ratio) that out of the chart ! Not stick to one place just displays latest quote change of the ASK price. 

     As your said , add Ask Price to that info, Didn't you feel any inconvenient or inhuman? →  The default setting is the BID price horizontal line label on the RIGHT vertical column (out of the chart), but the info you want to see displays at the counter angle place!  How dummy the designer of such visual effect is!

    I suggest you to experience the Bloomberg trading terminal which the trading info of one  future contract displays on the right side. The leftover space of the chart is just for candlestick chart or quotes chart.

    The pobo(also known as in Chinese "博易大师")software is the  most popular future trading terminal in the mainland of China, which is as a homework of a student of a immature financial market imitated the Bloomberg Trading Terminal the rime of a pioneer and signpost of the global financial market —— The Wall St. 

    

    

 

   

 
Gatesby:

     I want the Ask Price leeches (while follow the instant market latest quotes ) the Bid Price horizontal line within the chart not on the vertical line (quotes ratio) that out of the chart ! Not stick to one place just displays latest quote change of the ASK price. 

     As your said , add Ask Price to that info, Didn't you feel any inconvenient or inhuman? →  The default setting is the BID price horizontal line label on the RIGHT vertical column (out of the chart), but the info you want to see displays at the counter angle place!  How dummy the designer of such visual effect is!

    I suggest you to experience the Bloomberg trading terminal which the trading info of one  future contract displays on the right side. The leftover space of the chart is just for candlestick chart or quotes chart.

    The pobo(also known as in Chinese "博易大师")software is the  most popular future trading terminal in the mainland of China, which is as a homework of a student of a immature financial market imitated the Bloomberg Trading Terminal the rime of a pioneer and signpost of the global financial market —— The Wall St.

This is an English language forum. Your words are English, but they are not coherent.

If you are unable to post in coherent English, please find a forum where you can use your native language.

 

       

   You can just leave without any noise if you don't know other languages beyond your mother tongue circle!   Nobody ask you to <deleted> around at others' post if him cannot left any tiny useful advice or examples or hints to the asker!

 
Gatesby:

 Do you really carefully read & understood what I said?

   If the "One Click Trading" docks  & occupied a such space on the LEFT_UPPER corner of the chart  can resolves my problem so easily, I no need waste of time and post such an NEED FOR HELP article on the MQL4 forum.

   1. I run an EA on the MT4 terminal → The left upper corner of the chart will displays some info while EA running → The space will occupied by “One Click Trading” → The option has been rejected!

 ...

As your said , add Ask Price to that info, Didn't you feel any inconvenient or inhuman? →  The default setting is the BID price horizontal line label on the RIGHT vertical column (out of the chart), but the info you want to see displays at the counter angle place!  How dummy the designer of such visual effect is!

I suggest you to experience the Bloomberg trading terminal which the trading info of one  future contract displays on the right side. The leftover space of the chart is just for candlestick chart or quotes chart.

The pobo(also known as in Chinese "博易大师")software is the  most popular future trading terminal in the mainland of China, which is as a homework of a student of a immature financial market imitated the Bloomberg Trading Terminal the rime of a pioneer and signpost of the global financial market —— The Wall St.

There is no need to "bad mouth" our suggestions or arrogantly bash MetaTrade's UI. We are only users, not the developers. If you are unhappy with it complain at the Service Desk or go use something else instead.

Also, there is a perfectly good MQL4 Chinese Forum which you can use. There is no need to hassle us with your queries. Just place your queries there on the MQL4 Chinese Forum.

PS! Had you bothered to try out my suggestion, you would have observed that the "Comment()" text gets pushed down automatically and is NOT obfuscated by the One Click box.

 
   Gatesby: You can just leave without any noise if you don't know other languages beyond your mother tongue circle!   Nobody ask you to <deleted> around at others' post if him cannot left any tiny useful advice or examples or hints to the asker!

GumRai  is the moderator! He has every right to drop in and comment whenever he so wishes and he also has the power to BAN you for disrespecting the rules! KEEP IT UP! I for one will shed no tears if you are banned!

 
Gatesby:

       

   You can just leave without any noise if you don't know other languages beyond your mother tongue circle!   Nobody ask you to <deleted> around at others' post if him cannot left any tiny useful advice or examples or hints to the asker!


Continue to post in this manner and you will be banned
 

 Sorry!

 OK! I do respect each other without hostile or arrogant meaning and I will discussing with folks in polite way in future.

// Global variants


int OnInit()
{
  ...
       int xl = 0;
       int yl = 0;

       if(!ChartTimePriceToXY(0,0,Time[0],Close[0],xl,yl))
       {
          Err=GetLastError();
          Print("Error Fails to get TimePrice2XY. Error code ",Err,". ",ErrorDescription(Err));
       }
       
       if(!LabelCreate(0,"AskPrice",0,xl+100,yl,6,6,CORNER_LEFT_UPPER,DoubleToStr(Ask,Digits),InpLbFont,10,
         clrWhite,InpLbAngle,ANCHOR_RIGHT_LOWER,clrRed,clrNONE,InpLbBack,InpLbSelection,InpLbHidden,InpLbZOrder))
       {
            Err=GetLastError();
            Print("Error Creating Ask Price Label. Error code ",Err,". ",ErrorDescription(Err));
       }  
}

void OnTick()
{
   ....
        ObjectMove("AskPrice",0,Time[0],Bid);
        ObjectSetString(0,"AskPrice",OBJPROP_TEXT,DoubleToStr(Ask,Digits));
}


The visual effect of the source code of above is below:

How to Show Ask Price on Horrizontal Line

 

I've no idea why the Ask Price update instantly but not move with the horizontal Line consequently. The Ask Price Label leeches the Horizontal line pretty well unless you switch the different time frame on the same chart manually! 

 

I've Googled and got many historical posts in the MQL4 forum on similar issue. 

phy 2010.07.24 07:21 #   (ObjectMove usage to update horizontal line with new value)

ObjectMove() changes only the time and price properties of an object.

ObjectSet() changes any single property of an object.

A horizontal line moves when you change its price, so you can use ObjectSet() more conveniently than ObjectMove().

 

GumRai 2015.09.17 06:09 # (How to get the tick price)

MarketInfo(Symbol(), MODE_BID) is the last tick price

Bid is the last tick price received by the indicator or EA. There may be ticks missed by the EA while the EA is executing its code.  


 GumRai 2014.02.26 22:45 # (Please Help! Can someone help me! How to move Text Label)

Use ObjectMove in start() and code so that the object is only moved when a new bar opens.

Use Time[0] + n for the time co-ordinate. n being whatever value places the text nicely

 

 diewzreaswe 2010.12.02 22:07 #  (Classic pivots not updating automatically)

Take a look at this post: https://forum.mql4.com/33784 Try changing this:... else { ObjectMove("PivotLabel", 0, Time[20], Pivot); } to this:... else { ObjectMove("PivotLabel", 1, Time[20], Pivot); } It's the "1" 0 for window,1 for datetime, 2 for price I think.

 

Can anybody points out what's wrong with my source code and it didn't running as I wanted!

 

Great thanks!

Reason: