Cookie Clicker

Cookie Clicker

CookiStocker 2 | Automatic Stock Trading Mod
213 Comments
z  [author] Sep 10 @ 10:34pm 
Currently, the minimum number of brokers required for automatic trading is set to 58, which corresponds to a commission rate of 1% (in contrast to the commission rate of 20% that you get if you have no brokers). Surprisingly, I have found through testing that a 1% commission results in long-term profits that are only 30% as much as those that are made when using 162 brokers, which corresponds to a commission of 0.005%. Therefore, I am doing tests with a larger number of brokers to see what commission level gives the best balance between number of brokers and investment return. This number, which will be the new default, will be at least 103, which corresponds to a commission rate of 0.1%. However, there will be a slider in the new Options settings that will allow you to adjust this minimum to whatever you want.
z  [author] Sep 10 @ 10:21pm 
After much investigation, I found that the mod's failure to buy stocks was not a bug at all. The mod was simply following its directions that no single purchase should be more than 5% of the current bank.

Now different people may have different tolerances for risk, and also different ideas of how much of their bank they're willing to spend on a single stock. Therefore, although I'm keeping the 5% minimum as a default, I'm adding a slider in the Options that will let the player set this value anywhere between 1% and 100%. Hopefully, this should make everyone happy (at least about this feature).
z  [author] Sep 10 @ 1:57am 
Status update - As some of you have noticed, CookiStocker occasionally gets into a mode where it will not trade stocks even when it should. I have found and fixed this bug, and this fix will be present in the next release. More updates in the following post...
z  [author] Sep 10 @ 1:56am 
[continued]
The Options buttons feature has been fully implemented and appears to be working perfectly; testing is almost complete, and will not take much longer.

The biggest holdup right now is that the statistics showing earnings per hour and per day in the main window, and the more detailed statistics when console logging is turned on, often get corrupted upon game reload. Other statistics, such as total profits and various other totals, are not affected. This should not take long to fix.

There are also a couple of other features I'd like to get in here if time permits; one of them will extend the stock market's usefulness substantially.

All in all, I expect to put out a new release within the next week. This will still be a Version 2 release, as Version 3 will include a much more sophisticated trading algorithm.

Your patience is greatly appreciated here.
EightBitDonut Sep 9 @ 12:09pm 
when do you think you'll be able to finish the update? i want to use the mod but having to go into the files to do so is too unintuitive for me to follow.
-|-Gancro-|- Sep 6 @ 7:38am 
I forgot to mention that I have same issue as SirZedlus. Nothing is buying anymore. I should've seen it after few hours but it doesn't seem to it now.
-|-Gancro-|- Sep 6 @ 2:49am 
This cookistocker you've been working is version 3 or an update?
z  [author] Sep 3 @ 3:38pm 
I'm adding something that people have wanted for a long time, and it's almost finished. You can see a screenshot of it here. [drive.google.com]

Note that I didn't write the code. In fact, nobody wrote the code.
z  [author] Sep 3 @ 12:51pm 
SirZedlus - How long has the mod not been buying stocks (e.g., hours, days, etc.)? The stock market as a whole often goes through periodic declines where all stocks fall for many hours at a time, and the mod typically does not buy stocks during these declines.
SirZedlus Sep 2 @ 4:56am 
its wierd I have 23 million in displayed profits now but the mod just stopped working and does not buy any stocks anymore any Idea why?
z  [author] Aug 28 @ 3:22am 
Overspark - It is indeed! I just implemented this feature on my version of the mod a few days ago, and I was surprised to see how nice it was just to have the mod buy the brokers automatically and not have to worry about them at all.

This feature will be in the next release, which is coming very soon.
Overspark Aug 26 @ 5:11am 
Automatic buying of brokers would be an awesome feature.
z  [author] Aug 25 @ 6:32pm 
No problem, sarath_dilrow. The new requirements are currently mentioned only in this conversation. I need to add them to the main documentation, and more importantly (since few people read the documentation), I have to fix the new display to notify the player when and why automatic buying is not running.

It also occurred to me that I should add automatic buying of brokers up to the minimum limit, doing this in a way that doesn't have a significant impact on the bank.

Also, you'll get slightly better results the more brokers you have. I personally recommend 100; after 162, adding brokers essentially has no effect.
sarath_dilrow Aug 24 @ 9:48am 
Thank you for the answer and sorry for the question. Yes, the problem was that I was at 50 brokers instead of 58, bought 10 more and it started auto buying inmediately. Sorry again for the question.
z  [author] Aug 24 @ 5:54am 
sarath_dilrow - If the mod is auto-selling properly but not buying anything, by far the most likely explanation is that you have not met the recently introduced requirements for the mod to purchase stocks. These consist of having a minimum of 58 brokers as well as enough cookies in your bank so that a purchase of all the available shares of a single stock will not consume more than 5% of your bank. The number of cookies in your bank required to fulfill this requirement is given by the following formula:

Cookies required = (number of shares) * (highest raw CPS this session) * (price per share) * 20

Since neither the existence nor the value of this formula is obvious, it seems, I'll need to add another line to the new display indicating what's going on here. In the meantime, a rough guide is that when you have 150,000 seconds or more worth of cookies in your bank (more or less), the mod should be able to purchase stocks. (That's a little less than two days' worth of cookies.)
sarath_dilrow Aug 22 @ 9:39pm 
Hello, sorry if this question is dumb but does the mod wait for some special requirement to buy stocks? The mod auto-sells everything just fine but I have left it running for around 6 hours and it hasn't buy any stock. I tried doing what yaboi did and even reinstalled the mod but no luck.
yaboi skweezy jibbs1 Aug 22 @ 3:00pm 
Added CCSE and everything works now, thanks for figuring it out :crystaldragon:
dyl4n010 Aug 21 @ 4:35pm 
Doing gods work Z. Insane how quickly and active you're working on improving the mod. Plenty of other mod developers would have taken their sweet time or completely dropped the mod when having so many people report in broken features. Thank you :leyhappy:
z  [author] Aug 21 @ 12:29pm 
Fascinating! The mod even includes the standard line that checks for the existence of CCSE and loads it if it isn't present, but obviously that wasn't sufficient. Therefore, I've added CCSE to the list of Required Items on this page. Thanks, lil' orange for finding this, and thanks, mxrc, for verifying that this fixes your problem as well.
mxrc Aug 21 @ 12:11pm 
Installing CCSE/Enabling CCSE and putting it on top of the mod list has actually solved my issue. Thanks for helping :)
lil' orange Aug 21 @ 6:36am 
Ah yes, my bad I had a typo with my comment. It was supposed to be 615. (Which was wrong anyway I had meant the line you mentioned 610, it’s just that both of those functions gave errors as I was commenting out that function) I commented out the whole replacegamemenu function and its call later on and the mod and the mod worked again. Then I restored it back to the latest, added CCSE and then the mod worked again. I imagine if you remove CCSE or disable it you’ll reproduce the same issues that others have been getting. Prior to this update CCSE I imagine must have been loading fine so not sure why this is happening now for us.
If you want to continue chatting about it I don’t mind but perhaps another place would be better?
z  [author] Aug 21 @ 5:16am 
lil' orange - The function customOptionsMenu.push is just a placeholder for the eventual option buttons code. It's been there for a long time without causing any problems.

BTW, the function ReplaceGameMenu is at line 620 in my code, so if it's at line 516 in yours, you don't have the latest version of CookiStocker.
lil' orange Aug 21 @ 4:30am 
Hey Z, I checked out what the issue was as I saw you were having issues figuring it out. So essentially around line 516 there’s this new function Replace Game menu that when it calls customOptionsMenu.push it can’t. Presumably because it’s a CCSE thing? Not sure what might cause CCSE not be loaded on starting any more but installing CCSE from the workshop and placing it at the top of my mods seems to have fixed it. I imagine anyone else also experiencing the trading not working for the last while will be able to fix it by adding CCSE and doing the same.

Anyway there’s my fix for now. Good luck and keep up the good work
z  [author] Aug 21 @ 12:13am 
I must say that the problems being reported here are a bit mysterious to me, as I've been running the mod 24/7 for quite a while now, and my daily profits in the stock market are identical to what they were before I made the latest update. The only difference is that I don't have to disable the mod before ascending and re-enable it once my bank and brokers reach a sufficient level.

Nevertheless, a number of people are clearly having very different experiences here, so there's definitely something going on that needs to be addressed. You can rest assured that I will get this to the point where the mod works as well for everyone as it does for me.
z  [author] Aug 20 @ 10:47pm 
For bug reports, please post in the Bug Reports discussion group. Doing so will allow you to post screenshots if I need them, as well as allow more complex formatting than is permitted in these comments. It will also keep these comments from turning into long discussions that may make it harder for other people to get the information that they need. Furthermore, posts in the discussion groups don't have the short length limits that the comments do.

I'll address the comments by yaboi skweezy jibbs1 , mxrc , and Tap W in the Bug Reports discussion group shortly. If you subscribe to this group, you'll be notified whenever new entries are posted.
Tap W Aug 20 @ 10:31pm 
Can attest to the two comments below me. Ever since the update, I've had the game on for days and it hasn't traded at all. I have 90 brokers, and my bank is large enough that even the most expensive purchases should be possible.
Reinstalled the mod and tweaked any settings that vaguely looked like they could help, but nothing changed.
mxrc Aug 20 @ 4:06pm 
For demonstration I bought every stock manually now and it isn't selling them (Additionally I reinstalled the mod as well)
yaboi skweezy jibbs1 Aug 20 @ 3:05pm 
Been using the new update since it came out, have 109 brokers, buying maximum of any stocks costs a fraction of my total bank, and still it hasnt sold or bought a single stock in almost 4 days...
Overspark Aug 19 @ 5:20am 
Unsubscribing in the workshop seems to have worked! Thanks for the tip, very happy I can keep using this wonderful mod the way I want.
z  [author] Aug 19 @ 3:13am 
dyl4n010 - I have fixed the problem of the overlaying of the statistics lines when the display pane is narrow. Currently, this fix is only in my version of the mod; I want to fix a few other bugs before releasing yet another version. This shouldn't take long.
z  [author] Aug 19 @ 3:10am 
Overspark - The problem with option changes being overwritten has been present since before I took over this mod more than two years ago. For unknown reasons, it just manifests more or less frequently for different people at different times.

One workaround I have found that always works is to unsubscribe from the mod in the workshop, but not in the game. That's what I'm currently doing.

Option buttons are clearly needed here, and I will get them in as soon as possible.
z  [author] Aug 19 @ 3:05am 
mxrc - You need to give the mod more time. To make sure that trading begins as soon as possible, build up a big bank, and be sure to have at least 58 brokers. To complete a purchase, your bank must be at least 20 times the maximum number of shares available for the stock the mod wants to buy, times the stock price as expressed in cookies, where the cookies are the highest number of raw cookies per second for this session.

As this is not a trivial calculation to do in your head, I'll put in an option in the statistics line when the mod fails to make a purchase that will show if there's a deficit in the number of brokers owned, or what the requirement number of cookies in your bank was if that was too low for a trade.

Note that as you progress in the game, this problem quickly disappears after your first automated stock purchase.
z  [author] Aug 19 @ 2:49am 
Ivoravoid - In a situation like yours, where you have 750/775 of a stock, and the mod just doesn't buy the last 25 shares, that simply means that the stock has shifted from a "buy" mode to a "neutral" mode (which is why it's not selling the 750 shares). Given time, the situation will change so that the mod will either buy the remaining 25 shares or sell the original 750.

The reason your Chocolate is not being sold even though it's falling is that the mod's central algorithm isn't convinced that this is going to be a long term fall. This algorithm was built empirically with a huge amount of testing, during which I discovered that although the four central modes provide good information about where a stock is heading, there is additional emergent information in the movement of stocks that can help get much better returns than if only the four modes (or the stock's current direction) were followed. Give the mod time, and watch the stats in the new info lines.
Overspark Aug 18 @ 5:20am 
Version change doesn't work for me, file still gets overwritten. Even making the file read-only doesn't work, it still gets overwritten and the read-only attribute is gone.
I would love to have options buttons, this version is challenging to use like this! (Changing settings did stick for me with previous versions of the script).
mxrc Aug 17 @ 3:16pm 
Isn't buying / selling for me neither
Ivoravoid Aug 17 @ 1:33pm 
By "$44M in overhead" I mean that I have 44 million seconds of CPS in my bank.

Vanilla is currently at $1.61 each and I have 750/775 stock, and it's not buying the last 25. Chocolate is at $100 and falling, I have 850, and it's not selling.

I have 89 brokers, a Tiny Bank (level 2 offices), and level 1 banks.
z  [author] Aug 17 @ 9:16am 
As for making changing to the options that don't get reverted, some experimentation shows that the following simple procedure always works for me:

1. On line 45 of main.js, change the version number to one greater than the current version. Since the current version is 2.4, that would mean changing it to 2.5.

2. Do not make any other changes to the file. Save it, and reload the game.

3. Check the source code; if the version number is still 2.5, you should be able to change any options you want from now on, and they will stick.
z  [author] Aug 17 @ 9:10am 
Ivoravoid - The recent fix means that the mod will no longer use more than 5% of your cookies to make a single purchase. This provides better returns over the long run. However, as a result, it may take a bit more than an hour to start trading.

When you say you have $44M in overhead, what exactly do you mean here?

With the size of your bank and your CPS, it sounds like you should be getting trades, or at least on the verge of getting them. The mod takes an "all or nothing" approach to purchases. What are some of the typical amounts of stocks that you have, and what are their prices?

Also, note that the mod will now not buy stocks unless you have at least 58 brokers, which represents a commission rate of 1%. A level of 100 or more brokers is recommended if you can afford it; the maximum effective number of brokers is 162.
Ivoravoid Aug 17 @ 7:14am 
Mod not buying or selling anymore. I have $44M in overhead (2.187 novemdecillion cookies over 49.6 sexdecillion CPS) and the game has been open for over an hour. Is there a fix for this out yet?
Callen Aug 16 @ 10:09pm 
Making the main.js read only ended up doing the trick as well.
z  [author] Aug 16 @ 8:58pm 
I discovered that the recent upgrade that prevented excessive buying at the beginning of a run did not work in all circumstances. I have fixed this, and this is now CookiStocker 2.4.

dyl4n010 - Your problem with the display is that your middle pane is too narrow. Widening your window will fix this. However, CookiStocker should fail gracefully here and simply split the lines that are too long. (There are actually two of them, and they are not the ones you think!) I should be able to fix this shortly.

As for having variable changes being reverted to their defaults, once you have upgraded your copy of CookiStocker to version 2.4, you should be able to to change the version number in line 45 of main.js to '2.5'. It may take a couple of tries to get this to work. There are various other alternatives, such as unsubscribing from CookiStocker in the Workshop, but not in the game. As mentioned earlier, a more permanent solution is coming with the implementation of option buttons.
Callen Aug 16 @ 3:18pm 
Idk why but trying to turn off Transaction Notifications after this most recent update is not working. I make the changes and save the js and it just resets to one from the 14th.
dyl4n010 Aug 15 @ 4:46pm 
Sadly i can't post images within the comments, if you accept the friend request I've send, i'll show you a screenshot of the overlapping stats. This MIGHT just be an issue on my part in some way but i don't know. It's in full screen mode :PuroAmazed:
z  [author] Aug 15 @ 3:58pm 
As has been noted, occasionally, options that you set are overwritten the next time you load the game. Fortunately, there is an easy fix for this. On line 45 of main.js, change the version number from '2.3' to 2.4'. Your changes will now be preserved. When CookiStocker 2 is next upgraded, you will still get the new upgrade automatically, though you will have to reset your preferences.

This will all be completely fixed when standard option buttons are added; they are next on the list. This requires more than just adding the buttons, though, so it may take a little while until I get to it.
z  [author] Aug 15 @ 3:51pm 
dyl4n010 - While the mod may indeed make its initial buys more slowly, this is merely to assure that it does not gobble up all your cookies at once. The more cookies you have, the faster the initial purchases will proceed.

Note that this applies only to the initial purchases; once your bank contains enough cookies, purchase rates will proceed at the same rate they did in the previous version. You can verify this by looking at the new statistics feature.

Speaking of which, what do you mean when you say that "some of the stats overlap in the middle"?
dyl4n010 Aug 14 @ 10:02am 
This new update makes it buy REALLY slow and feels like a significant downgrade.

Also some of the stats overlap in the middle.
dyl4n010 Aug 14 @ 9:41am 
Pretty sure that the mod still works, except those options you are supposed to be able to change in the main.js file don't save anymore.

I change the stockerActivityReportFrequency from 1 hour to 1 minute, save it and restart my game. And then the code is back to 1 hour again.
z  [author] Aug 14 @ 8:52am 
No, the 2.3 update did not break anything; I've ben using it for quite a while with no problems.. However, the improvements in its behavior may mean that it waits a little longer before starting to buy stocks. This is beneficial in the long run. Just give it a little more time, and make sure you have at least 58 brokers.
Klein Aug 14 @ 3:28am 
Did the 2.3 Update broke anything? It worked just yesterday and now its not doing anything for me.
z  [author] Aug 14 @ 1:06am 
I have released CookiStocker 2.3. As promised recently (see two posts below), this version behaves reasonably if you leave it on all the time. Specifically, in order to make a stock purchase, the follow two new conditions must be satisfied:

1. The total amount of the stock purchase must be less than 5% of your current bank.
2. You must have at least 58 brokers, which corresponds to a commission rate of about 1%.

You can change the number of brokers required by modifying the variable stockerMinBrokers at the top of the source file. (Yes, option buttons are still being worked on.)

This version of CookiStocker also has 2 to 4 lines (selectable) of additional stock market statistics near the top of the stock market display. These essentially duplicate the summary statistics that were previously available only in the Console Announcements, and they are updated in real time.

More details on these changes will be coming soon. Subscribers to this mod will be updated automatically.