Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Missing | lead to bitwise operation being performed rather than an OR…
Browse files Browse the repository at this point in the history
… logical comparison. (#1053)
  • Loading branch information
kernelsndrs authored and DeviaVir committed Jan 6, 2018
1 parent a310803 commit 738246f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/strategies/trendline/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ module.exports = function container (get, set, clear) {
s.signal = 'buy'
}
else if (
s.growth === false |
s.growth2 === false |
s.growth === false ||
s.growth2 === false ||
s.accel === false
)
{
Expand Down

8 comments on commit 738246f

@yang2lalang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kernelsndrs Can you precise the effect of this missing OR. What did you expirience with this. Because with trendline, i get wrong signals and the robot is buying and selling at a different price than i see on the log. I was doing paper trading on gdax using:

./zenbot.sh trade --paper gdax.BTC-EUR --asset_capital 0 --avg_slippage_pct 0.045 --avgpoints 1000 --avgpoints2 100 --buy_pct 99 --buy_stop_pct 1 --currency_capital 1000 --days 3 --lastpoints 100 --lastpoints2 10 --markdown_buy_pct 0 --markup_pct 0.01 --markup_sell_pct 0.01 --max_sell_loss_pct 15 --max_slippage_pct 5 --order_type maker --period 1s --periodLength 1s --profit_stop_enable_pct 0 --profit_stop_pct 1 --rsi_periods 14 --sell_pct 99 --sell_stop_pct 1 --show_options true --strategy trendline --debug

@kernelsndrs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is very little changes here other than the correct usage of the logic operators. a single | is a bitwise operator:

The logical and operator ‘&&’ expects its operands to be boolean expressions (either 1 or 0) and returns a boolean value.
The bitwise and operator ‘&’ works on Integral (short, int, unsigned, char, bool, unsigned char, long) values and return Integral value.

Since JS is flexible it has been working but this change to logical operators should have no effect. Here is an example showing the various possible logic states and how they have the same "buy/sell" signal, bitwise or logical operation:
http://rextester.com/SKIT11216

@SlackerATX
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yang I don't think this strat can be working right now after a commit about 10 days ago. Which version are you using. This recent change updates markup_sell_pct and markdown_buy_pct dynamically making the orders prices in such a way the orders would never be filled.

#988

@yang2lalang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kernelsndrs exaclty the logical changes look ok to me

@yang2lalang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SlackerATX can you explain to me how to check the exact version of zenbot i am using. i use git log but i see many commits all in the logs. I know i did a pull after the gdax was updated with a websocket client for trading. That was about 7 days ago

@yang2lalang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err1

Here zenbot buys at a higher price than what is displayed on the logs and does not even show where got the price because its not in the logs

@yang2lalang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

er2

Here zenbot sells at a lower price than is in the logs and also does not show where it got the price so i was wondering if the changes from the bitwise OR remedies this but apparently it doesnt

@SlackerATX
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's the problem but the logical OR fix won't bit the problem. I'm not sure what they were trying to do that last checkin but I commented out those two lines affecting the price and it does sane things.

Please sign in to comment.