Jump to content

# Script for automated Buy/Sell using Excel

## Recommended Posts

I am trying to automate my trading. I have used NEST RTD so that I can receive live data in excel. I want to compute average of 14 cells dynamically and the if average is greater than a particular number(for ex: 90), We buy a script and parameters for buy (i.e. Quantity, Limit Price) could be defined from excel itself.

#### Share this post

##### Share on other sites

show the excel document and/or the code you have currently.  You will find lots of resistance if you expect us to code something while you have thought exercises.

Edited by iamtheky

```,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)```

#### Share this post

##### Share on other sites

why can't you use VBA inside of your Excel sheet and automate it that way?

My resources are limited. You must ask the right questions

#### Share this post

##### Share on other sites

I went through some articles on internet but isn't aware how to inject dll into system from VBA.

Attaching the excel file that is being used in current context. The cell B2 is tracked and its value is recorded on cell V2 and so on at time interval of 3 minutes and I am trying to calculate average of 14 relevant cells(which keeps on changing as new rows are recorded)  in cell W2 and if W2 > V2 inject a buy dll into system. Please also help in how to pass parameters to dll from excel.

Thanks in advance.

Default MW1.xlsm

#### Share this post

##### Share on other sites

you really need to search google.

When you have Excel open, press ALT-F11 keys and the VBA editor shows up.

Next, use Insert from the menu and add a new module

You can now create custom VBA functions now and call your DLL all you want.

you can attach the module to cells and whatnot, just like a formula

Edited by Earthshine
• 1

My resources are limited. You must ask the right questions

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

×

• Wiki

• Back

• Git