bid/ask price .....

 

Is it possible to get the Bid/Ask price in the top left of the chart screen & use those prices as variables in calculations using an indicator, I have searched for days & it's sheer desperation I ask now. I'm not asking for the code just whether it can be done or not OR do I need to do this as an EA. I can do it as a script but then I don't know if I can include scripts in an EA or indicator or if I can use that information in my calculations.

This is what I have found so far (as script)

void OnTick() 

  { 

//--- 

   double Ask,Bid; 

   int Spread; 

   Ask=SymbolInfoDouble(Symbol(),SYMBOL_ASK); 

   Bid=SymbolInfoDouble(Symbol(),SYMBOL_BID); 

   Spread=SymbolInfoInteger(Symbol(),SYMBOL_SPREAD); 

//--- Output values in three lines 

   Comment(StringFormat("Show prices\nAsk = %G\nBid = %G\nSpread = %d",Ask,Bid,Spread)); 

  } 

Would I be able to include this in an indicator/EA and use the bid/ask price as variables (hope that's a little more clear) 

Thanks for any advice

 

What you posted is not a script, it's an EA (or a part of).

Everything can be done, but honestly I don't understand your problem.

You don't need to display anything on a chart to afterwards use it in an indicator.

 
Alain Verleyen:

What you posted is not a script, it's an EA (or a part of).

Everything can be done, but honestly I don't understand your problem.

You don't need to display anything on a chart to afterwards use it in an indicator.

Thank you, that's actually a big help. I'm trying to learn about coding but it's a lot harder than I thought & there are no really basic tutorials out there. Much appreciated :)
Reason: