PDA

View Full Version : Bid/Ask indicator/ea



tjdm1980
11-21-2013, 01:12 PM
Can a Bid and Ask price level indicator or EA be developed so both Bid and Ask prices can be viewed on charts? Thanks.

Hassan-HS
11-21-2013, 03:36 PM
Dear Sir,


Definitely yes, you can develop your own script using VTL Client (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2567)



The following VTL client code print over the current chart the bid and the ask of it (see the attached picture).





Sub Main ()

CreateObjectLabel 0,0,"Bid",10,20, ""
CreateObjectLabel 0,0,"Ask",66,20, ""

End Sub


Public sub OnTick(symbolName)
dim bid
dim ask
if SymbolName = ChartSymbol(0) then
if SymbolInfoDouble(Cstr(SymbolName),SYMBOL_ASK,ask) then
Objectset Clng(0),Cstr("Ask"), 2 ,Cstr("Ask" & ask)

end if

if SymbolInfoDouble(Cstr(SymbolName),SYMBOL_Bid,bid) then
Objectset Clng(0),Cstr("Bid"), 2 ,Cstr("Bid: " & bid)
end if
end if
End Sub








Note: as you see in the picture that is attached, VertexFX client terminal is print over the chart the bid & the ask & high & low automatically.

tjdm1980
11-22-2013, 02:32 PM
Thanks much.

tjdm1980
11-25-2013, 09:25 PM
Any way to show this graphically with lines on the chart? thanks much

Hassan-HS
11-26-2013, 07:19 AM
Dear Sir,



This code is draw two horizontal lines, the green is the bid price and the red is the ask price.





dim bid
dim ask
dim SName
Public Sub main()

SName = ChartSymbol(0)
if (SymbolInfoDouble(Cstr(SName),SYMBOL_ASK,ask)) and (SymbolInfoDouble(Cstr(SName),SYMBOL_Bid,bid)) then
AddObject 0,"ASK",15,0,GetTime(0,1),Cdbl(ask),CurTime,Cdbl(ask)
AddObject 0,"BID",15,0,GetTime(0,1),Cdbl(ask),CurTime,Cdbl(bid)
end if
ObjectSet 0,"ASK",3,RGBcolor(255,0,0)
ObjectSet 0,"BID",3,RGBcolor(0,255,0)


End Sub



Public Sub OnTick(symbolName)

If symbolName = ChartSymbol(0) then
if (SymbolInfoDouble(Cstr(SName),SYMBOL_ASK,ask)) and (SymbolInfoDouble(Cstr(SName),SYMBOL_Bid,bid)) then
ObjectMove 0,"ASK",2,CurTime,Cdbl(ask)
ObjectMove 0,"BID",2,CurTime,Cdbl(bid)
end if
end if

End Sub

Hassan-HS
01-09-2014, 10:05 AM
Dear Sir


Please update us if every thing is clear now or not, and let me know if you need any further assistance.