-
Notifications
You must be signed in to change notification settings - Fork 2k
Creating a Strategy #640
Comments
I figured out the answer to question 2 through some trial-and-error. If anyone could shed some light on questions 1 and 3, that would be very helpful. |
@KryptoNova |
Sorry about that @tuxitor. That was rude of me. For question 2, the answer is yes. State is maintained in the s variable for any objects that are created for the lifetime of the zenbot process. When working with this variable care must be taken when it comes to memory management. Storing large, mutating objects in that variable can create large problems. When developing new strategies, it is a good idea to cleanup any array variables so they don't consume more resources than are available. Any help with questions 1 and 3 would be greatly appreciated. Question 1 is particularly intriguing now since question 2 has been addressed. |
For your first question: You can put the buy/sell signals in the calculate section. It works in simulations and there is a difference in timing of when the trade is executed, sometimes it's better and sometimes it's worse. I haven't tried it in live trading. For the third: I'm not sure but you should look in zenbot/lib/engine.js |
Hello,
When it comes to strategies, I'm having a hard time determining what the difference should be when it comes to the significance of the "calculate" and "onPeriod" method within the strategy.
It appears that "calculate" is done on a timeframe that is not in agreement with the "onPeriod" where the "onPeriod" seems to align with the candlestick period that is defined.
This leads me to three questions.
Should the "calcluate" method actually be firing buy/sell signals when the "onPeriod" is not soon enough?
If a new object is added to the "s" object in the "calcluate", will it maintain the state of these additional objects for the lifetime of the zenbot session?
Is there anywhere that I can see a breakdown of the core objects/properties and their explanations that reside in the "s" object that is passed between the "calculate" and "onPeriod" methods? Primarily, what is the significance of s.trend and s.signal and how they communicate to the bot what needs to happen in the market.
If anyone could shed light on these three questions, it would greatly help. Thanks!
The text was updated successfully, but these errors were encountered: