How can I get the „inner“ spread ?

 
Hey guys,

in the screenshot you see two bid prices and two ask prices. The inner spread are the bid/ask lines if they are activated in the chart settings. The real and tradable spread are the dotted lines which I get by SymbolInfoDouble(_Symbol,SYMBOL_ASK) and SymbolInfoDouble(_Symbol,SYMBOL_BID).

Can anyone tell me how I get the bid and ask prices of the inner lines?

I need that to place my trades correctly with an EA.

Files:
 
Marbo:
SymbolInfoDouble(_Symbol,SYMBOL_ASK)

For me they are the same.

Note that the tick that you use to draw the lines on chart are already expired. Depending on your broker this might cause problem. Although I find it very strange.

I think you should share your code. Maybe there is a problem in there.

 
Marbo:
Hey guys,

in the screenshot you see two bid prices and two ask prices. The inner spread are the bid/ask lines if they are activated in the chart settings. The real and tradable spread are the dotted lines which I get by SymbolInfoDouble(_Symbol,SYMBOL_ASK) and SymbolInfoDouble(_Symbol,SYMBOL_BID).

Can anyone tell me how I get the bid and ask prices of the inner lines?

I need that to place my trades correctly with an EA.

Can you show the code that draws these lines please.


 
Dominik Egert #:
Can you show the code that draws these lines please.


This part is in OnInit():

ObjectCreate(0,"bidLine",OBJ_HLINE,0,0,SymbolInfoDouble(_Symbol,SYMBOL_BID));
   ObjectSetInteger(0,"bidLine",OBJPROP_WIDTH,1);
   ObjectSetInteger(0,"bidLine",OBJPROP_STYLE,STYLE_DOT);
   ObjectSetInteger(0,"bidLine",OBJPROP_COLOR,clrBlack);
   ObjectSetInteger(0,"bidLine",OBJPROP_SELECTABLE,false);
   ObjectCreate(0,"askLine",OBJ_HLINE,0,0,SymbolInfoDouble(_Symbol,SYMBOL_ASK));
   ObjectSetInteger(0,"askLine",OBJPROP_WIDTH,1);
   ObjectSetInteger(0,"askLine",OBJPROP_STYLE,STYLE_DOT);
   ObjectSetInteger(0,"askLine",OBJPROP_COLOR,clrBlack);
   ObjectSetInteger(0,"askLine",OBJPROP_SELECTABLE,false);

And this is in OnTick():

ObjectSetDouble(0,"bidLine",OBJPROP_PRICE,SymbolInfoDouble(_Symbol,SYMBOL_BID));
ObjectSetDouble(0,"askLine",OBJPROP_PRICE,SymbolInfoDouble(_Symbol,SYMBOL_ASK));
 
Marbo #:

This part is in OnInit():

And this is in OnTick():

Very hard to see if there are any mistakes, where is your "ChartRedraw" call?
EDIT:
Please provide a compilable version that runs and shows the lines you are referring to.
 
Marbo:
Hey guys,

in the screenshot you see two bid prices and two ask prices. The inner spread are the bid/ask lines if they are activated in the chart settings. The real and tradable spread are the dotted lines which I get by SymbolInfoDouble(_Symbol,SYMBOL_ASK) and SymbolInfoDouble(_Symbol,SYMBOL_BID).

Can anyone tell me how I get the bid and ask prices of the inner lines?

I need that to place my trades correctly with an EA.

You are doing something that is not required.  Just use the built in chart display for bid and ask then you won’t have a problem 
 

Guys, I think here is a big misunderstanding.

Everything works fine in my code with the dotted lines. These lines represent the values I receive from SymbolInfoDouble().

But you can see that the other lines have different values. These lines are  activated by the checkboxes in the chart settings.

I just wanted to know IF I can get the values of these bid and ask lines somehow. 

Files:
screenshot.png  211 kb
 
Paul Anscombe #:
You are doing something that is not required.  Just use the built in chart display for bid and ask then you won’t have a problem 

The solid lines are the built in lines for bid and ask. But I need the values of them in my code. And my question was how I can get them. They are not the same values I receive with SymbolInfoDouble().

 
Yashar Seyyedin #:

For me they are the same.

Note that the tick that you use to draw the lines on chart are already expired. Depending on your broker this might cause problem. Although I find it very strange.

I think you should share your code. Maybe there is a problem in there.

My broker adds around 5 points to each side of the spread which is displayed by the solid lines.

 
Marbo #:

My broker adds around 5 points to each side of the spread which is displayed by the solid lines.

there is no inner spread, only that shown by your solid lines. You are clearly calling out of date information, refresh the prices before you get them, and redraw the chart if you are updating objects

 
Paul Anscombe #:

there is no inner spread, only that shown by your solid lines. You are clearly calling out of date information, refresh the prices before you get them, and redraw the chart if you are updating objects

Yes, I know there is no real "inner spread" and that's why I put into "". I don't know how I should name it otherwise. I just wanted to explain that my tradable spread and the spread which is shown in the built-in chart function of MT are different.

Reason: