bgwrites / Forex-Trader

Other
74 stars 34 forks source link

"error, closing down" #2

Open kupfer22 opened 5 years ago

kupfer22 commented 5 years ago

Hello bgwrites,

thank you for posting this code, it is really helpful. For some reason, I am running the code but it just prints "Error, Closing down" when it should be looking for trades. My access key is correct as well as currency pair, time frame, SMAbig, SMAsmall are fine. I am not sure if I am doing something wrong on the kill switch. (apologies for the double posting, I initially put this under another issue in error)

rmendal commented 5 years ago

Assuming you cloned the repo and only entered your account id and key in the appropriate places in the init file then it should work out of the box. It does for me. If you have any trades open already then it will close down. It only searches for and executes trades one at a time so if you manually opened one it will close.

kupfer22 commented 5 years ago

thanks @rmendal. I was trying to run it in Jupyter as a .pynb file and that is where I was getting the issue. (I changed init, strategy, and candles to .pynb also). I just cloned the repo and I am attempting to run it with Jupyter using ! python app.py . Once I execute the code, it just sits there for minutes at a time not running the data. As you can tell, I am used to running all .pynb so I am really unfamiliar with .py.

rmendal commented 5 years ago

You might have to change them all to pynb files as all the files pull info from each other. Not sure what operating system you're using but it should be fairly easy to run the app from a terminal (command prompt, iterm, bash) with what is listed in the readme file by running python app.py You may need to run it as python2 app.py depending on how your system is configured.

bgwrites commented 5 years ago

Hi @kupfer22 thanks for bringing up the issue. Seems @rmendal was able to help you out a bit. I am going to be putting up a newer version of this code very soon. I have implemented some new features into it including better error handling and pre-checks of opened/closed positions. I have also been able to implement a time based approach to entering orders, (i.e. at market open place trade depending on conditions).

The code should run well from a terminal with a virtualenv.

I have also switched to TA-Lib going forward. I would recommend looking into their documentation as it is a much better way to implement technical analysis.

kupfer22 commented 5 years ago

Thank you @rmendal, I downloaded Git Bash and ran from the terminal and it works!

@bgwrites, thank you for the prompt response and for your assistance. I was able to get it to work but I noticed that when the strategy opens one position the kill switch is activated and strategy turns off. Based on the logic, I believe this is because the risk is set to 2% by default so if a position is already open, it will not exceed 2% even if further trades are found, correct?

I appreciate the explanation and I look forward to the new version of the code!