Cookie Clicker

Cookie Clicker

413 ratings
CookiStocker | Automatic Stock Market Trading mod
By Gingerguy and 1 collaborators
Incredibly effective stock trader, available in local mod, workshop item and console script form.
7
7
5
8
3
5
2
2
   
Award
Favorite
Favorited
Unfavorite
What is this?
This is a mod that will automatically trade the Stock Market for you.

*
* - this footage is sped up about 5000 times.

Over a typically short length of time, this mod will easily get you the achievements Liquid Assets (profit 10 million $econds, or $10 million) and Gaseous Assets (profit 1 year of $econds, or $31.536 million), the latter of which is currently the rarest Cookie Clicker achievement of all time. The current version of this mod is capable of achieving Gaseous Assets in just one day of continuous runtime. Even if you don't level up your buildings as described in the section below labeled Increasing the Mod's Efficiency, you should still be able to achieve Gaseous Assets within three days, as long as you follow the other guidelines within that section.

In any case, if you follow the directions in this guide, stock market profits are guaranteed,, day in and day out, with no cheating required. The more advanced your game (i.e, the more your buildings are leveled up), the larger your profits will be.

If you find this guide outside of Steam - It has been copied without our permission. Click this link to see the most up-to-date original guide.
Installation
Note: For all installation options, you will need to make sure that CCSE is loaded before CookiStocker. If you're not using Steam, you can find the CCSE source file here.[klattmose.github.io]

Option 1: Subscribe to the mod on the Steam Workshop
- Workshop page -

This is by far the best way to get the current version of this mod and to have it automatically updated in your game when new releases come out.

Option 2: Install the mod
There are two ways to do this, each with its own advantages:

Option 2a: Install the mod from Google Drive
- Download CookiStocker 3.0 - [drive.google.com]

Clicking on the above link will bring you to a directory containing the mod's files. To install the mod, simply copy the files into a new or existing folder named CookiStocker in your local mod directory (...\Steam\steamapps\common\Cookie Clicker\resources\app\mods\local\CookiStocker). Restart your game, and the mod should be installed and running.

This is the easier of the two installation methods. Its only drawback is that someday, this Google Drive account may not exist.

Option 2b: Install the mod from Pastebin
This option works much like the previous one, except that the relevant files are retrieved directly from Pastebin. Here you can find the files - main.js - [pastebin.com] and - info.txt - [pastebin.com] in their full text form. For each of these files, copy all of the text and paste it into the appropriately named file in your local CookiStocker directory (...\Steam\steamapps\common\Cookie Clicker\resources\app\mods\local\CookiStocker). As in the previous method, when you restart your game, the mod should be installed and running.

Option 3: Run the script from the console
- Pastebin with the console script 2.0 -[pastebin.com]

If you do not want to install the mod, open your console, copy the - main.js - [pastebin.com] file from the Pastebin, paste it into the console, and then press Enter. Please note that if you choose this method, you will have to repeat it every time you restart the game if you want to continue using the mod.

Instructions on how to open the console in the Steam version of the game can be found here.. Be sure to follow this method if you are running the Steam version of Cookie Clicker, as simply setting the variable DEV to 1 at the beginning of the file will have the side effect of disabling Steam achievements. Note that you will have to restart the game for this change to take effect.
How it works
Version 1 of CookiStocker used a fairly basic trading algorithm based only on mode changes. An excellent explanation of how the stock market works can be found in the Steam Guide entitled Ultimate Stock Market Guide (WIP for v2.048). Another excellent guide is the Stock Market page[cookieclicker.fandom.com] of the Cookie Clicker Wiki, which goes into quite a bit of technical detail.

Version 3 of CookiStocker, which is now the current version, uses an algorithm that takes into account not only mode changes, but short term changes that occur while the mode stays the same. It also fixes a number of bugs. Finally, it handles boundary conditions intelligently, buying whenever a stock falls below $2, never selling when a stock is below $11, and being cautious about stocks selling for high prices.

The internal workings of CookiStocker 2.0 are covered in much more detail in the discussion The Trading Algorithm. A new and improved trading algorithm is currently being worked on, and will be present in CookiStocker 4.0.
Options
To access options, open the main.js file inside the mod folder. You will see all of the avaliable options at the start of the file.
Some options can either be turned on or off by writing "true" or "false" respectively, and some require a number.

Here are the current options:

• Toggle the Trading State
Toggles the mod between being active and inactive. Default - on . It hasn't been implemented yet, so right now it does nothing.

• Transaction Notifications
Turns on/off the notifications for every transaction. Here are examples of the types of transactions you will see; you can click on them to get a larger image displayed. (Default - on.)





Note that all notifications are now timestamped, using a 24-hour clock. This should make it a lot easier to see what happened when.

Both the buy and sell notifications refer to the stock's current mode, as well as its previous mode if the stock was bought or sold at a mode transition. Modes, along with many other details of the inner workings of the stock market, are explained in depth in the excellent Steam Guide Ultimate Stock Market Guide (WIP for v2.048). CookiStocker uses slightly different names for the modes than the Guide, but there are no "official" names. What's most important to remember is that even though "rapidly rising" means that most of the time the stock in question will be rapidly rising, this is not always true (which the Guide acknowledges), and sometimes the stock price may steadily fall in this mode.

The same goes for all the other modes as well. That's why you may see CookiStocker buying a stock that's in "slowly falling" mode or selling a stock that's in "rapidly rising" mode; if you look at the stock graphs in the main stock market display, you will see that in cases such as these, the actual stock movement is In the opposite direction than the one that the mode name would imply.

Users of previous versions of Cookie Stocker will notice that stock transactions occur much more frequently than they did before. Fortunately, the game limits the number of transactions displayed at one time to five, with earlier transactions being stacked. If this obscures your screen too much, though, you may simply want to disable notifications and turn on the console (see below), as the console contains all the information contained in the notifications and much, much more.

CookiStocker now makes an important distinct between profits and revenue. The number displayed as "Profits" in the upper left of the main stock market display is actually just the total amount of money generated by the stock market, with or without this mod. Whenever you buy a stock, the total purchase price of your stock is immediately subtracted from this number, even though you haven't actually suffered any losses. That's why in the early stages of play this number is always negative, and it explains CookiStocker's opening message of "click clack you are now in debt".

With CookiStocker 2.0, for the first time there is a way of seeing what your actual profits and losses from individual stock trades are. Profits are defined in the usual way as the stock sell price minus the stock buy price, all times the number of units (or shares) sold. If this number is negative, it is called a loss. Revenue is the total amount of money received for selling a stock, and it is always positive. It is this revenue figure that is added to the "Profits" number shown in the upper left of the main stock market display. Over time, as your true profits grow, total revenue and total profits tend to converge.

• Activity Report
Toggles the activity report (shown below). Default - on.



• Activity Report Frequency
Controls the frequency of the activity reports described above, as well as the corresponding activity report if console announcements are turned. on. If the Activity Report option is turned off but console announcements are turned. on, then this interval will still control the frequency of the periodic activity summary shown on the console. See the thread New Changes and Additions to the Console Output for an example of this console output; the first part of the output shows an example of the console output that occurs after every tick, while the second part, which occurs about a third of the down with the line that begins "Running", shows an example of console periodic activity summary. For those people who want to closely monitor stock market activity, setting this value to one minute can be very instructive. Note that if you reduce Loop Frequency from its default (see below), Activity Report Frequency should be set to be the same as Loop Frequency. Default value for Activity Report Frequency - 60 minutes.

• Fast Notifications
Makes the mod's notifications fade away quickly on their own. If you have 'Fast notes' option of the base game turned off, then the notifications will stay up until closed manually. Default - off

• Console Announcements
Shows more info about the algorithm's logic in the game console. See the Discussion thread New Changes and Additions to the Console Output for full details. Default - off

• Loop Frequency
This option controls the frequency at which the algorithm looks at the market.

The market itself updates every 60 seconds, so it is set to 30 seconds (30000 in milliseconds) to make sure the logic triggers every update no matter when the mod initialized. However, if the option Force Loop Updates is turned on (see below), then CookiStocker will be running the stock market, typically at a faster tick rate, and the market's tick length will be set to the value of Loop Frequency.

• Force Loop Updates
When this option is turned on, CookiStocker runs the stock market at the frequency specified by Loop Frequency, as noted above. Normally, this is done to speed up the stock market. Doing so is a blatant cheat, however, and in future versions of CookiStocker, setting this option to "true" will disable Steam achievements.
Increasing the Mod's Efficiency
Before you launch, be sure to:
  1. Check if you are running the latest version of the mod.
    The algorithm is constantly being improved, so using the most recent version will guarantee that all discovered bugs and suboptimal expressions are fixed and optimized.

  2. Max out your brokers.
    Obviously, they will increase the efficiency of your trading. For the best results with this mod, it is recommended to have at least 100 brokers. Playing with fewer than 70 brokers can seriously cut into your profits. Keeping your brokers at the maximum limit you can afford is the easiest way for the advanced player to maximize stock market profits using this mod.

  3. Leave enough spare cookies in the bank.
    The bot will try to buy as much stock as it can when it detects an opportunity, so make sure you have the cookies to fill up your warehouse. A good rule of thumb is that your bank should have at least a million seconds of CPU production before you enable CookiStocker. For those who are good at generating combos, a good time to enable CookiStocker is after your first major combo. Alternatively, if you can buy 100 brokers at once without diminishing your bank by more than a few percent, you should have plenty of cookies for stock market play.

  4. Level up your offices.
    Warehouse space is very important if you do not want to wait hours to sell 100 shares of stock. If you want to get the best results, you should focus your lumps on getting cursors to level 12. Upgrading your cursors to level 20 also improves the productivity of clicking once the heavenly upgrades Aura Gloves and Luminous Gloves are acquired, but this does not directly impact the stock market.

  5. Level up your bank.
    Increasing the bank level by one increases the resting value of all stocks by one and the bank ceiling of all stocks by three. (See the Steam Guide Ultimate Stock Market Guide for more details of the function and importance of these values.) Getting the bank level to level 10 should be high on your priority list, but not as high as raising your cursors to level 12 (or to level 20, as described in the previous section). Raising the bank level is the most powerful way of raising the earnings potential of the stock market, and the effects described above apply even when raising the bank level past level 10. Before going past level 10, however, it's best to level up the rest of your buildings, as described in the next section.

  6. Level up the rest of your buildings
    Finally, level the rest of your buildings as much as you are able to, up to level 10. For the stock market, the best strategy is to level up your buildings evenly rather than get each of them to level 10 before moving on to the next. This former strategy will give you the most building levels for your sugar lumps early on, and it will also ensure that your resources are spread out evenly among your stocks, thus reducing large fluctuations due to overconcentrating in just a few stocks.

  7. Run your game at full speed.
    Although many people know that the game "runs" more slowly when it is closed, and that many features simply aren't updated then, few people know that the game runs slower any time it's not in focus. In other words, if you want to use your computer interactively for anything else other than playing Cookie Clicker, the game will slow down, even if it's running. This can severely affect stock market returns, cutting them by up to 90% or more. To eliminate this behavior (the only downside is that your computer will be slightly more loaded), follow the directions in the Steam Guide How to fix the game pauses when minimized, which fixes this problem completely. Note that this problem affects the game at all times when it doesn't have focus - not just when it's minimized.
All of the previous steps can be done before you start running the mod. In contrast, the following, final step needs to be done only at the end of an ascension.
  1. Turn off the mod and sell all your stocks before ascending.
    For now, "turning off the mod" means disabling it. An option to simply turn it off without disabling it will be added in CookiStocker 3.0.

    In order for this strategy to be useful, you must have unlocked but not purchased the Chocolate Easter Egg. Typically, experienced players store this egg in their vault until the end of an ascension. By selling all your stocks, you increase the base value upon which the total number of cookies resulting from the purchase of the Chocolate Egg is based. This in turn increases your prestige level when you next ascend. The result is that taking the step of selling all your stocks gives you a permanent boost in your prestige level that persists across ascensions.
Troubleshooting & FAQ
Q: The mod is not doing anything; have I installed it correctly?
A: That can be easily checked by checking the Mod Manager menu. If it does not show up there, then you did not install it properly. Also, be sure that the mod is enabled.
Check that you have unarchived the folder properly; the directory should look like Steam\steamapps\common\Cookie Clicker\resources\app\mods\workshop\CookiStocker with main.js and info.txt in it. The version of the mod installed by Steam when you subscribe to the mod can be found in Steam\steamapps\common\Cookie Clicker\resources\app\mods\workshop\CookiStocker.

Q: The mod is installed correctly, but it is still not doing anything.
A: First, be sure that the CCSE mod is installed. If it is, and If the game shows you the following notification when it is launched, then this means the mod has initialized and is working.



Q: Why does this mod keep losing money for me?
A: Actually, it doesn't. The "Profits" number in the upper left of the stock market display is unfortunately misnamed, but as this is implemented in the main Stock Market minigame by Orteil, I cannot change it without causing a lot of confusion. What is called "Profits" is actually "Revenue". Whenever you spend money to buy stocks, that investment is subtracted from this "Profits" number. So everyone starts out negative until they start selling stocks at a profit. That's why when you get the notice "CookiStocker is ready," the subtext says, "click clack you are now in debt," as in the above picture.

You can see a more detailed explanation of all of this in this post from this discussion that is linked to from the main CookiStocker 2 mod page. This includes pictures of the coming statistics. A brief summary of the true profits is also displayed once an hour via a notification. You can currently get full statistics by turning on the "Console Announcements" option in the mod; see this section above for how to do this.

Notice also that while stock market profits add to your current prestige just like any other income, stock market losses do not subtract from your prestige. (Nothing in the game subtracts from your prestige.) Since your cookies don't persist across ascensions but your prestige does, this makes your stock market proceeds more valuable than they may seem at first.

Q: I closed the game. Will it remember the purchases it made?
A: Not yet; this capability will be coming in CookiStocker 3.0. For now, the results of the first few minutes of trading may be less optimal than once the mod gets fully underway.

Q: Does this mod conflict with any other mods?
A: No conflicts have been detected with any popular mods, and there is no reason to expect that this will happen in the future.

Q: What effect do the Supreme Intellect and Reality Bending dragon auras have on this mod's performance?
A: Although Supreme Intellect (and to a much lesser extent, Reality Bending) makes the stock market more chaotic (in Orteil's words), extended tests have shown that this additional chaos does not affect the performance of this mod in any detectable way. For detailed information on how these two dragon auras affect the stock market's performance in general, please see the section "Supreme Intellect & The New Meta (WIP)" in the Steam Guide Ultimate Stock Market Guide (WIP for v2.048), and/or the section "With Supreme Intellect" in the Stock Market[cookieclicker.fandom.com] page of the Cookie Clicker Wiki.

Q: Does the stock market work any differently in Cookie Clicker version 2.053 versus version 2.048?
A: No.

Q: Does this mod disable Steam achievements?
A: No.



If you are still having issues - write a comment below.
If the mod is working correctly - write a comment as well and show off your success.
Changelog
Please see the thread Changelog in the Discussion section of the Workshop page.
Feedback
Feel free to ask any questions you have about the mod in the comments, I will try my best to answer all of them.
Do not hesitate to show off your achievements and milestones as well.

Help me gather statistics!
Take a quick survey[forms.gle]

Keep up with CookiStocker's development
There is once again new development happening with CookiStocker! You can keep up with all new development and contribute to ongoing discussions in the Discussions tab on the CookiStocker mod page. Development of CookiStocker is currently being handled by z.

Make sure to check out Gingerguy's other scripts:


- CookiWizord | Automatic spellcasting mod





- CookiAscender | Automatic ascention script
408 Comments
z  [author] 18 Oct @ 1:55pm 
There are now multiple users requesting that this mod add no extra achievements. As a result, I think I need to address this issue in full. Please read Post #13 in the Future Development discussion and post a response there if you're interested. The responses in that discussion thread will help me decide how to handle this issue.
z  [author] 16 Oct @ 11:00pm 
β-H - In your issue with profits not being shown correctly, I realized that there is a bug in the mod that can cause exactly the situation you describe. The bug is quite straightforward to fix, and I expect to have a new version with the fix ready shortly.

In the meantime, a workaround is to turn on the "Console Announce" option, even if you don't have the console displayed.
z  [author] 16 Oct @ 10:47pm 
The negative cookies bug was discovered a while ago, and in my previous message here from a day ago, I described fixing it. The current version of CookiStocker has that fix; if you're experiencing this problem, reload the game and it should disappear.

The bug was indeed involved with the automatic buying of brokers. The fix made sure that this did not get out of hand, and that no purchase of brokers could in total exceed 10% of the player's bank. It also disabled the automatic buying of brokers (and all other CookiStocker activity) during an ascension and the cookie countdown that follows reincarnation, as many things don't behave normally then.

The reason auto-buying of brokers is on by default is that CookiStocker is designed to automate your stock trading, and automating the buying of brokers seems to be a natural part of this. As you saw, though, it's easy enough to turn this off if you don't like it.
β-H 16 Oct @ 8:58pm 
Hey, there's a nasty bug in v3.0. It successfully introduced me to "negative cookies."

The "AUTO-BUY BROKERS" feature in 3.0 literally "broke" the game (pun intended). In short, it buys way too fast. Around the E+30 (nonillion) mark, it decided to instantly buy 15 brokers at once, while a single broker costs up to 20 minutes' worth of CPS. This completely shattered the cookie counter. In a flash, my total cookie count flipped to its negative equivalent.

Right, after I turned off "AUTO-BUY MINIMUM BROKERS" and "AUTO-BUY ADDITIONAL BROKERS," everything went back to normal.

Also, I really don't think auto-buying brokers should be on by default. Given that CookiStocker tends to go all-in and you need a cookie bank of E+6 times your CPS, I just turned off all auto-buying in my last ascension when I had around 900 Cursors and 550 "You"s to focus on the Stock Market. And it paid off—I just got the Gaseous Assets achievement today.
β-H 16 Oct @ 3:21am 
I'm experiencing an issue: Profits per hour and Profits per day consistently show $0, and there's no hourly report.
However, the algorithm is running normally, and both game and mod's Net profits are showing normally.
I have this issue with both 2 and 3. It suddenly occurred one day, and previously, both Profits were showing normally.
I initially thought Cookie Monster had changed their counting method, as I'd already changed it, but reverting to the previous method didn't resolve the issue.
z  [author] 14 Oct @ 10:08pm 
I have fixed the negative cookies problem, and I also fixed the init() routine so that race conditions that can cause load failures do not arise. The new release (3.0.2) has been installed in the Workshop, and if you subscribe to CookiStocker, you should get this release automatically the next time you reload your game. Pastebin and Google Drive versions of the mod have also been updated; please see the section on Installation above for more details on these. This version of CookiStocker contains no known bugs.
z  [author] 14 Oct @ 9:12am 
The negative cookies problem is proving to be more difficult to solve than anticipated. I know where things are going wrong, and I have constructed a test case that clearly demonstrates the problem. So it shouldn't take too long to get to the bottom of this problem and fix it. This is my top priority.
z  [author] 13 Oct @ 7:14pm 
qbix - It turns out that I just came across a similar failure to load issue when testing out my new fix, and I also ended up adding a timeout inside the init function in order to fix it. So the next release of CookiStocker (coming shortly) should contain a fix equivalent to yours.

And yes, the mod is supposed to load CCSE on it's own when it's undefined. But it's always possible that some obscure condition could prevent that from happening, hence my question.
qbix 13 Oct @ 7:48am 
@z, on web
It doesn't matter if CCSE was loaded manually before or not (this mod is supposed to load it on it's own when it's undefined?)

Did some testing and adding a timeout inside CookiStocker's init function when registering the mod solved the issue.
z  [author] 13 Oct @ 7:43am 
qbix - Are you running this in Steam, or in the Web version? Do you load CCSE before CookiStocker?