IB Excel Api question - how to use VBA application.ontime?

Discussion in 'Automated Trading' started by omelet, Dec 28, 2015.

  1. omelet

    omelet

    I am trying to place an order at 10am everyday, so in VBA, I type these lines:

    Sub SetTime()
    Application.OnTime TimeValue("10:00:00"), "PlaceOrder"
    End Sub

    Sub PlaceOrder()
    ******
    ******
    End Sub

    The above "PlaceOrder" procedure can be executed successfully if I run it separately. The problem is the "SetTime" procedure failed to trigger the "PlaceOrder" at 10am (nothing happened on screen). I put these two Sub in the same module under the "Module" folder in VBA. Does anyone have a solution to this? Thanks a lot!
     
  2. Bowgett

    Bowgett

    Do you have any conditions or you just want to place order at 10:00?