Predicting Stock-Prices with Grasshopper and Galapagos?

Hey Guys

I made a little experiment on trying to predict stock-prices with Grasshopper and Galapagos.
The Idea is to take the last part (for example last 6 hours) of the chart and search the complete rest of the chart for the best fitting counter-part.

It is only an experiment and definitely not working. But if anyone is interested in the script.
-> It is attached.

-You need to have Excel, I think.
-You need to have the Plugin Lunchbox for Grasshopper.
-I can not upload my Excel file. I got mine from:
It is the GDAX - BTC-USD hourly file - But you need to save the csv file with Excel to xlsx-file and convert the commas from the csv file to columns.
Once Again. The Script is not predicting stock-prices. Do not use it trying to make money.
I`m not taking any responsability on the script.
-The Excel File needs to be open.

18.04.05 Hourly candlesticks (56.3 KB)


Price a random walk and not predictable. Any pattern is only in the past and can’t be put forward, like any price indicator, its going to lag.

Coding in Metatrader is going to get you closer.

Don’t forget I liked your post first after you get filthy rich.


Haha, won`t forget. Send me your BTC-Address :wink:

I don`t know if it is totally random.
The Dot-com bubble developed almost the same as Bitcoin…
And there are chart-patterns that indicate a change or at least a probability of a change.

I don`t know these patterns. Thats why I made the script…


Does anyone have an idea on how to set up Galapagos when there is no real “logic” in finding the best solution. Galapagos should more or less just randomly search for the solution.

Thanks for your help.

Im pretty sure Galapagos only works when you provide a fitness function, I think the “randomness” on the way Galapagos finds the answer lies in the coupling algorithm, which I belive you cannot modify other than the initial boost in Galapagos, so for it to work you should provide real “logic” towards the best solution, however is best to ask @DavidRutten, Do let us know when you get filthy rich!

1 Like

This is called a brute-force search and it is not how Galapagos works. Ideally, at every possible combination of input variables it should be possible evaluate the local fitness gradient and from there infer the best direction in which to modify the variables to up the fitness. GP can handle a fair amount of discontinuity in the fitness function, but if it’s flat everywhere except for a few sharp peaks, they probably won’t be found.

1 Like

I just saw this one:

Hi Jonathan,

If you are still into using GH for crypto trading you are welcome to have a look at Squirrel. It has price tickers for several markets, and historical data (only for Binance atm). I’m slowly adding more components to make it more useful. I have already several new components for simple technical analysis (not published yet):

Another new feature yet to be published is a component for sending mail from GH. I use it to send alerts to myself when prices meet certain conditions :slightly_smiling_face:.

I’m deliberately avoiding components that can send buy/sell orders to a market, or any kinds of price predictions, not to mess with others’ money, or get into security issues, but I’m open to requests/suggestions in the field of data collection/analysis.

1 Like

And here I was thinking I hit moral rock bottom when my software ruined Architecture for a generation…

I may as well publicly release the seal clubbing components now.


don’t forget the whale harpoon targeting package


So it didn`t work out too well for me. The Skript worked, but the market is just a mess :wink:
I wish you good luck Michael.

Im actually thinking of using GH to optimize file storage allocations - idea still germinating. :slight_smile:

Other possible uses i’ve seen are for packaging optimization in logistics (placement of packages in trucks, boats, etc. Seems silly to constraint GH to just Rhino.

Look at Mathematica or my favorite IDE LiveCode. It’s really handy to make a great design and then compile it - this is something missing in GH IMOHO.