¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Fw: Bracket trade


 

¿ªÔÆÌåÓý

To who ever created Bracket Trade,
?
I got to looking at the file at the TWS API?site called "bracket trade" .
How would I go about incorporating this initiating order
?
Private Sub cmdLongES_Click()
Call PlaceNewOrder("BUY", 1, "ES", "FUT", "200209", 0, "", "GLOBEX", "", "MKT", 0, 0)
End Sub
?
and then getting the corresponding stop and target to execute after filled with the above order?
?
Private Sub Command1_Click()
?longtarget = longentry + ptarget
?longstop = longentry - pstop
?ocaID = ocaID + 1
?Tws1.oca = ocaID
?Call PlaceNewOrder("SELL", 1, "ES", "FUT", "200209", 0, "", "GLOBEX", "", "LMT", longtarget, 0)
?Call PlaceNewOrder("SELL", 1, "ES", "FUT", "200209", 0, "", "GLOBEX", "", "STP", 0, longstop)
?
End Sub
?
!. I was trying to get the initial fill price of market order into "Text5" by using
?
Private Sub Tws1_orderStatus (ByVal price As Single)
Text5 = price
End Sub
?
But I get an error.
?
2. Once I get the filed price of initial order in "Text5" then
?
Private Sub Text5_Change ( )
something something something
?
I get lost after this.
?
Bottom line is I like the project and if I could get an initiating order with the above stop and targets it would be great.
?
Any help you can give me is appreciated,
?
Sincerely,
?
Bruce
?


larrysy.geo
 

Hi Bruce,

I have already uploaded my Bracket Trader with market entry, with
the VB code available for everyone to study (I hope other members of
this group do the same !).

Feedback on bugs, improvements welcome.

Larry






--- In twsapi@y..., "Bruce Hawkins" <hawkinsk001@h...> wrote:
To who ever created Bracket Trade,

I got to looking at the file at the TWS API site called "bracket
trade" .
How would I go about incorporating this initiating order

Private Sub cmdLongES_Click()
Call PlaceNewOrder("BUY", 1, "ES", "FUT", "200209",
0, "", "GLOBEX", "", "MKT", 0, 0)
End Sub

and then getting the corresponding stop and target to execute
after filled with the above order?

Private Sub Command1_Click()
longtarget = longentry + ptarget
longstop = longentry - pstop
ocaID = ocaID + 1
Tws1.oca = ocaID
Call PlaceNewOrder("SELL", 1, "ES", "FUT", "200209",
0, "", "GLOBEX", "", "LMT", longtarget, 0)
Call PlaceNewOrder("SELL", 1, "ES", "FUT", "200209",
0, "", "GLOBEX", "", "STP", 0, longstop)

End Sub

!. I was trying to get the initial fill price of market order
into "Text5" by using

Private Sub Tws1_orderStatus (ByVal price As Single)
Text5 = price
End Sub

But I get an error.

2. Once I get the filed price of initial order in "Text5" then

Private Sub Text5_Change ( )
something something something

I get lost after this.

Bottom line is I like the project and if I could get an initiating
order with the above stop and targets it would be great.

Any help you can give me is appreciated,

Sincerely,

Bruce