Multiple buys in a row? #688
Unanswered
bioluminesceme
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Your assumptions are slightly misguided. When you place an order via |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm probably doing something stupid, but I'm testing basic things and I don't understand why I'm getting more than 1 buy in a row.. despite my if conditions.
I'm getting 2 or more buys in a row. Shouldn't it buy with all available cash, and then wait for the sell condition - because there is no money left to buy with? (and my if condition is not met in the first place)
If I print the broker cash amount it does show that it did not actually buy anything I think, but there seems to be something wrong with the math there too. the self._broker._cash gets printed after the buy or sell is executed, so shouldn't broker cash reflect that buy or sell? the first two prints show the initialamount..
It's a "buy when StochRSI is below 30, sell when StochRSI is over 70".
print output example (download last year of TSLA data from Yahoo)
2021-09-14 00:00:00 - Buy when StochRSI is below 30 at $744.48999
1000
2021-09-27 00:00:00 - Sell when StochRSI is over 70 at $791.359985
1000
2021-11-04 00:00:00 - Buy when StochRSI is below 30 at $1229.910034
1042.200012
2021-11-05 00:00:00 - Buy when StochRSI is below 30 at $1222.089966
1042.200012
2021-11-08 00:00:00 - Buy when StochRSI is below 30 at $1162.939941
1042.200012
2021-11-09 00:00:00 - Buy when StochRSI is below 30 at $1023.5
1042.200012
(?!?!)
2021-11-22 00:00:00 - Sell when StochRSI is over 70 at $1156.869995
1042.200012 (? it sold at 1156-1023 = 133 profit why is the broker cash amount still the same?)
Beta Was this translation helpful? Give feedback.
All reactions