You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
however if I look at the trade log, on 4-20, there are multiple entries, what's wrong with my code? There should be at most 2 entries . I have checked the stock data, nothing wrong and it's correct.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am just trying to write a very simple multiple entry strategy, the logic is as bellow:
The sample code is like bellow
`class SmaCross(Strategy):
n1 = 5
n2 = 60
however if I look at the trade log, on 4-20, there are multiple entries, what's wrong with my code? There should be at most 2 entries . I have checked the stock data, nothing wrong and it's correct.
| Size | EntryBar | ExitBar | EntryPrice | ExitPrice | PnL | ReturnPct | EntryTime | ExitTime | Duration -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- 4500.0 | 69 | 73 | 22.199286 | 22.635166 | 1961.461247 | 0.019635 | 2021-03-29 15:00:00 | 2021-04-02 15:00:00 | 4 days 2050.0 | 86 | 90 | 24.191797 | 24.293687 | 208.875693 | 0.004212 | 2021-04-22 15:00:00 | 2021-04-28 15:00:00 | 6 days 2250.0 | 84 | 90 | 21.990646 | 24.293687 | 5181.843478 | 0.104728 | 2021-04-20 15:00:00 | 2021-04-28 15:00:00 | 8 days 2050.0 | 91 | 97 | 24.348277 | 24.293687 | -111.908156 | -0.002242 | 2021-04-29 15:00:00 | 2021-05-12 15:00:00 | 13 days 1025.0 | 86 | 97 | 24.191797 | 24.293687 | 104.437847 | 0.004212 | 2021-04-22 15:00:00 | 2021-05-12 15:00:00 | 20 days 1125.0 | 84 | 97 | 21.990646 | 24.293687 | 2590.921739 | 0.104728 | 2021-04-20 15:00:00 | 2021-05-12 15:00:00 | 22 days 2000.0 | 102 | 105 | 24.413534 | 24.062656 | -701.756402 | -0.014372 | 2021-05-19 15:00:00 | 2021-05-24 15:00:00 | 5 days 1025.0 | 91 | 105 | 24.348277 | 24.062656 | -292.761422 | -0.011731 | 2021-04-29 15:00:00 | 2021-05-24 15:00:00 | 25 days 512.0 | 86 | 105 | 24.191797 | 24.062656 | -66.120178 | -0.005338 | 2021-04-22 15:00:00 | 2021-05-24 15:00:00 | 32 days 562.0 | 84 | 105 | 21.990646 | 24.062656 | 1164.469614 | 0.094222 | 2021-04-20 15:00:00 | 2021-05-24 15:00:00 | 34 daysBeta Was this translation helpful? Give feedback.
All reactions