I am working on automating our trading based of an excel spreadsheet. We were provided a spreadsheet we can place orders in and click a button, running a macro to send the orders to the Redi Platform.
What we want to do from here is either update the existing macro or create a new one that automatically sends the trades, once all the required fields are populated. In other words once the Macro recognizes the required trade fields are all populated it will automatically trigger the existing macro sending the trades to the Redi system; without actually clicking to send the trades.
Would someone be able to help us either modify the existing macro or create a new one to trigger the existing Macro once the criteria is met?
We strive to help, by guiding developers and developer community toward coding, owning and maintaining robust solutions.
The examples that we provide to the community are simple, well-documented, and widely applicable.
We do not code custom use cases to requirements, rather we are willing to help in advisory capacity for you take responsibility for coding and maintaining.
But whenever possible, we try to find a way to help.
Your use case is not simple, as you require:
In my understanding, the use case is just complex enough, that there are several ways to approach it. I have coded, as an example, within the code you have included, a version of what I believe your require.
The cornerstones of my approach are:
It is very likely that this is not all that you require, or not exactly as you envision, or you would prefer a different approach.
In this case, I hope that the example that you will find attached, will help guide you toward fully implementing to your requirements, next.
Not sure if what I am about to answer is what you are looking for :)
But will try to answer straight-on.
Developer-> View Code
Type something like:
Function ORDERCOND(Ready) If Ready = "Yes" Then 'Copy code from our order example for example Dim hOrder As New OPTIONORDER hOrder.Side = "Buy" hOrder.symbol = "SBUX" hOrder.Type = "Call" hOrder.Date = "Apr '16" '.... b = hOrder.Submit(myerr) End If End Function
When you type "=ORDERCOND" into one of your cells, enter the location of "Trade now" cell, such as
If you are looking to validate more parameters, before creating the order, just use the same approach, increase the number of parameters into ORDERCOND and run the checks.
I am sending and canceling orders via excel VBA and Redi on 150 stocks. Redi crashes after a certain period of time, I will often get this response "Microsoft Excel is waiting for another application to complete an OLE action."