LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 July 21 2014

JackB
Member

Automated trading

Hello Folks,

It's been a while. I was reading my last posts on the website which dated back to 2012....damn how things changed since then!

Anyways, getting back to our topic:

Is there a way to make my laptop trade on behalf of me? here's what I'm thinking:

1- I get real time information on some stock price from a trading website and I feed it into my excel sheet automatically on some pre-defined time intervals (let's say 30-seconds interval, so that each 30-seconds my laptop gets the data it needs and I puts it on some excel sheet)

2- I put some nice formulas/conditions on the excel sheet, that allows the laptop to make a decision based on the outcome of those formulas/conditions
          ex:  if, the price of gold went down for 5 consecutive times (5 consecutive 30-second intervals), buy gold now and then resell it after 1 minute or so

3- I make my laptop automatically do the buying and selling for me on some trading platform, based on those conditions that I set on excel

Is this even possible? I hope so.......

Last edited by JackB (July 21 2014)

Offline

#2 July 21 2014

Kassem
Member

Re: Automated trading

Hey Jack. Yes this is very possible, except maybe not exactly the way you described.

It depends on the trading platform you are using. If you are using Metatrader 4 or 5 then you achieve that using an Expert Advisor. The platform has its own programming language: MQL

Offline

#3 July 21 2014

Johnaudi
Member

Re: Automated trading

Everything is possible except 'Buying' the gold, maybe a notification saying "You should buy the gold right now..." or so, unless the website doesn't have bot detection.

It is possible, yes.

Offline

#4 July 21 2014

JackB
Member

Re: Automated trading

Well the reason why I'm asking is because I think this would give me an advantage when it comes to trading

I Think I might have detected a couple of arbitrage opportunities that can only be executed in the way I described. But I think it can only work using an excel sheet (by running a macro) and this is because there's a lot of calculations involved in the process (conditions based on calculations being performed in real time). I haven't used these platforms and bots before but I doubt it'll be able to do the things I'm thinking about. In addition to doing the calculations, It's also important that it executes the trades on my behalf, based on the conditions I feed it

If anyone knows how to do this and is interested in discussing and executing it I'll be happy to share what I have in mind in private

Offline

#5 July 21 2014

rolf
Member

Re: Automated trading

Of course it is possible and it is done all over the world but you seem to underestimate how complex it is. There is probably software that does that.

Offline

#6 July 22 2014

JackB
Member

Re: Automated trading

Hey rofl, what part is the complex one? knowing how to use it to generate profit? or technically executing it?

Offline

#7 July 22 2014

Johnaudi
Member

Re: Automated trading

Honestly the only complex part I see is how you'd want to purchase the gold without some API's license, but that's not an issue if you're doing it with notifications.

I have PM'ed you @JackB, awaiting a reply.

Offline

#8 July 22 2014

IZO
Member

Re: Automated trading

I use Amibroker for back testing and evaluating strategies and trading ideas and in it you normally script your strategy in c/c++ similar language and you can write few lines to link your online broker to the platform and it will place buy and sell orders automatically

Offline

#9 July 22 2014

Johnaudi
Member

Re: Automated trading

IZO wrote:

I use Amibroker for back testing and evaluating strategies and trading ideas and in it you normally script your strategy in c/c++ similar language and you can write few lines to link your online broker to the platform and it will place buy and sell orders automatically

I'm not familiar with how to dynamically request to purchase stocks etc, but from my buy/sell experience on regular products, it does require  human verification everytime (captcha, questions...), and is not a simple HTTP POST/GET thing.

Well I'm guessing this varies depending on the broker.

Offline

#10 July 25 2014

NuclearVision
Member

Re: Automated trading

From my experience when paying money is involved there's no captcha or anti-flood, they have nothing to lose, most of the time
But in my opinion, it's dangerous, don't trust computers, don't trust your own programmed code, unless it's a demo account or no big numbers involved.
You could also search for trading systems that have API that work with different languages.
Good luck.

Offline

#11 August 2 2014

JackB
Member

Re: Automated trading

Thank you guys for the replies.

I'm still studying the potential of this. Here's another question though:
You guys mentioned the code could be tested on historical data right? in other words you can use the code to see how much return you could have made had u used it in the past, right?
1- i.e. Can you actually come up with a code that would simulate itself on historical movements and see how much return you would've have got after every executed trade based on the code?
2- how accurate is that thing? I know historical performance doesn't guarantee future one, but did any of you tried it and found similar future returns?
3- If this can be done, I don't see why one cannot
a) come up with a code
b) test it on historical data
c) get the return he gets on each trade he executes based on the code
d) keep on tweaking the code until you gets a nice return over a 4 - 5 years period (increase N so that you minimize risk, i.e. the greater the number of historical years you test the code on, the better the chance of future success) 

I know this is not as simple as it seems, but I don't see why it cannot be done

Offline

#12 August 3 2014

NuclearVision
Member

Re: Automated trading

@jackB you know people aren't perfect, they did mistakes over time, your code can't anticipate people's decisions which are sometimes ridiculous. People don't do the right things always, otherwise there wouldn't be "loss".

Offline

#13 August 3 2014

samer
Admin

Re: Automated trading

your code can't anticipate people's decisions which are sometimes ridiculous.

Actually, the field of behavioral economics studies factors on the economic decisions of individuals and their consequences. While we can't always anticipate people's decisions, we can certainly make educated guesses using models that factor the human reliance on heuristics and they proneness to cognitive biases.

Offline

#14 August 3 2014

rolf
Member

Re: Automated trading

JackB wrote:

Hey rofl, what part is the complex one? knowing how to use it to generate profit? or technically executing it?

Probably both, but I'm a programmer so all I can tell you is that the technical part, more precisely connecting different systems together and translating your ideas into code is complex.

Offline

#15 August 4 2014

JackB
Member

Re: Automated trading

NuclearVision wrote:

@jackB you know people aren't perfect, they did mistakes over time, your code can't anticipate people's decisions which are sometimes ridiculous. People don't do the right things always, otherwise there wouldn't be "loss".

I actually strongly disagree. People's behavior is easy to predict, no one acts randomly.

We all pretty much act in the same way to a certain stimulus, the speed and magnitude of reaction might differ though. Sure some exceptions much exist but collectively you'd expect the same outcome for the same type of experiment; if the outcome is different that's because new information exists, and not because people are acting randomly (the market is always fed with new information).

But again the principle is the same: everyone wants to maximize his net worth. If you can predict (with a statistical model) how the market reacts to different stimulus, you can theoretically beat the market by moving before everyone else. In practice this is much harder to do, but that's why I'm asking those questions.

If you can look at historical data and see how the market reacted to different stimulus (I'm thinking here about technical analysis), and then detect same future trends and make a computer make the trades on your behalf when such trends occur, then maybe profit can be done.

Offline

#16 August 5 2014

rolf
Member

Re: Automated trading

My name is not rofl but rolf.
If you want to move before everybody else, say by buying shares of a stock that should go up before everybody else does, then you want to be receiving your information faster than everybody else (Lebanon is not the best place for that) and you wan to be thinking and making decisions faster then everybody else or create a computer system that can think faster then a human being.

Offline

#17 August 5 2014

Johnaudi
Member

Re: Automated trading

rolf wrote:

My name is not rofl but rolf.
If you want to move before everybody else, say by buying shares of a stock that should go up before everybody else does, then you want to be receiving your information faster than everybody else (Lebanon is not the best place for that) and you wan to be thinking and making decisions faster then everybody else or create a computer system that can think faster then a human being.

Well he does want it to loop every 30 seconds, I don't think internet speed is a problem here to receive the stocks.

Offline

Board footer