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

Stop loss trigger granularity #1246

Open
laloch opened this issue Jan 30, 2018 · 4 comments
Open

Stop loss trigger granularity #1246

laloch opened this issue Jan 30, 2018 · 4 comments

Comments

@laloch
Copy link

laloch commented Jan 30, 2018

System information

  • Zenbot version: v4.1.0

Hi,

as of now (if I understand the node.js "spaghetti" right) the executeStop(...) function, which takes care about triggering all our stop orders, is being called only on the period edge. This behavior makes Zenbot unsuitable for very high volatility (cryptocurrency) markets using long periods. I wonder if it wouldn't be better to rather evaluate and trigger the stops in periods based on c.poll_trades or its multiples.

@defkev
Copy link
Contributor

defkev commented Jan 30, 2018

executeStop() is [sic] executed for every new trade we polled from the exchange as long as my_trades/my_prev_trades is not empty.

@laloch
Copy link
Author

laloch commented Jan 30, 2018

OK, thanks for clarification. I got confused by the fact that the executeStop(true) call is done from within the if (period_id !== s.period.period_id) { block which made me think it's triggered just for the first trade of the new period. I still don't understand the code, though. JS is a write-only language for me.

@laloch
Copy link
Author

laloch commented Jan 30, 2018

Turns out that I'm not that bad in reading JS code. Simple console.log(...) revealed that the executeStop(true) gets indeed called only for the first trade in a period. So for --period=1h the sell stop is only evaluated once per hour.

@ujesh-t
Copy link

ujesh-t commented Jan 8, 2019

Totally agree with @laloch, Stoploss is not required if it is evaluated once per hour for an hourly candle.
Is there any way to tweak the existing code to make it call stop loss at poll level

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants