Pause button in Robots?
Pause button in Robots?
24 Mar 2016, 19:54
Is there a way to pause a robot and resume it later? Is it possible to have a Pause button?
I know in some robots it might not make much sense but say in the Martingale one, you have lost the first trade and it will need to take a new trade as soon as the previous close. But i see that the place it will take it is not the best and i'd rather Pause it and let it resume the Martingale series at some other place.
So is something like that possible?
I had a quick search in the forum but didn't find anything, i may have missed something.
Thank you.
Replies
solark
28 Mar 2016, 23:11
Maybe there's an "official" way but somehow I doubt it... The best solution would be to modify the code so that the Start/Stop button becomes the pause button. That is, make the bot's OnStart method lookup postions/orders using labels to continue from where it left off from. This is ideal since it puts you in a good spot for cases where you're forced to restart your bot. The down side is if you have a long startup time it may not be feasible.
The next best solution (imo) requires some general programming skills. Not to go to far in depth but ideally you'd create a separate program for the bots UI (pause button and other real-time settings) that would communicate with the actual cbot using standard inter-process methods (mutexes, named pipes, sockets, etc).
Another possibility (not recommended) have the actual cbot generate some ui OnStart. This is most likely not worth it, could effect the stability of cAlgo as a whole.
Quick hack solution would be to use "System.IO.File.Exists" to check for the presence of a dummy file which would represent whether the cbot should be paused or not. Generating/deleting the file could be done by a simple batch file you can run. If a shortcut to these batch files are placed on the desktop you can (right click shortcut, properties) assign an arbitrary hotkey to both of them. Then you would just hit your defined hotkeys to pause/resume the bot.
@solark
solark
28 Mar 2016, 23:18
Another "hacky" solution. Create a separate 'pause' cbot which simply modifies an environment variable (System.Environment). As long as this cbot is running a certain environment variable is set and when it's stopped the variable gets cleared. The main cbot could then determine it's pause/running state based off the environment variable. (pretty sure cbots run in their own appdomains and using the process environment variables should work fine, if not there's other ways).
@solark
Spotware
29 Mar 2016, 11:44
Dear Traders,
Thank you for your suggestion. We will consider it. Additionally, you can post your ideas/suggestions to http://vote.spotware.com/
@Spotware
a1112
30 Mar 2016, 09:11
lol @ "1007601" . Lets not forget the Fast Forward button ;)
@ "solark" . Thank you for your interesting ideas. Too advanced for me at this point but certainly got me thinking of "patch-work" solutions. Best would be if Spotware can implement it of course.
@ Spotware . I'll put it in the voting section as you suggested. Thank you.
If anyone has any more ideas about it, you are very welcome to add them here. Thank you all :)
@a1112
1007601
28 Mar 2016, 13:54
Totally separate point, and kind of tongue in cheek, but a pause button on the general Forex market would be fantastic. Just curious when the devs are going to implement this?!?
[sorry for wasting your valuable reply space]
GH
@1007601