Stuck in loop and stuck in pause manager???

WhoKnows
Trader
Posts: 102
Joined: Wed Mar 19, 2014 11:57 pm
Location: North Brisbane, Australia

Stuck in loop and stuck in pause manager???

Post by WhoKnows »

Thanks Renexxx and Thomas,
1. You could build an EA that looks at the existing trades and alarms you when the trades of a given other EA (identified by magic number or trade comment) havent changed for a given period.
Your idea must have traveled through the air to me.I suggested something like this when editing my previous post.
The disadvantage of this approach is that some EAs won't take trades for hours, so how to set the trigger for the alarm. But it would work for tradoholics such as RnR or Dotty.
2. Your EAs could update global variables periodically to the current date/time. If one EA stops working, it will stop updating this variable. An EA that observes these variables could then alarm you.
3. Or, alternatively, your EA could periodically broadcast a custom event, saying "I'm still alive". That custom event can be picked up by the monitoring EA, that in turn raises the alarm bells if it hasn't received an event from your EA for x minutes.
2. and 3. appear to be an ideal solution to me. They will give an immediate feedback in an EA gets stuck, looped or paused.
Ultimately these potential solutions would give an extra protection that may prevent you from losing your shirt.

I have no clue if 2. or 3. will be easier as generic approach.
As I understand it, you need a monitoring EA, and some code which you would need to slot into existing EAs.
Ideally I would envision a 'basket/monitor' which would automatically close and reinitialize unresponsive EAs/magics. Of course you would still investigate the alert ASAP, but your trading system would be running again preventing the risk of non-monitored trades.
This approach would also save you from EAs that 'PAUSED' their selves in a spread-widening event and failed to revive from their sleep.

Unfortunately I am no coder. So unless one of the coder geniuses here takes this under his/her wings as useful project for the SHF community, it will take some time for me to learn enough Empty4 to to it.
So if anybody want to take this further, please do.

First step for me now is to find how to learn enough about Empty4 to do the simple stuff.
Again thanks for all your input. At least I now know it could be done.

Thanks again,
Peter
Last edited by WhoKnows on Thu Aug 04, 2016 12:26 am, edited 1 time in total.
User avatar
rapple
Trader
Posts: 277
Joined: Fri Feb 21, 2014 10:56 pm
Location: Sydney, Australia

Stuck in loop and stuck in pause manager???

Post by rapple »

Hi Peter

I was thinking about your issue over night and I think that it mostly comes down to your terminal speed.

In a fast moving market, if your connection speed is slow you are sending trades after the price has already moved past that point. This is why you get the error alerts

If it's happening on Dotty two options could be:
move to a VPS with high speed (I am running live on BEEKS with no issues) or,
Increase the grid spacing so there is a better chance to get the trade filled

I am also getting a lot of alerts on my Dotty DEMO account which is trying to run Dotty on all 22 pairs with a connection speed of around 200ms. I will see if increasing the grid spacing works and let you know

Cheers Richard
WhoKnows
Trader
Posts: 102
Joined: Wed Mar 19, 2014 11:57 pm
Location: North Brisbane, Australia

Stuck in loop and stuck in pause manager???

Post by WhoKnows »

Thanks for the suggestion Richard.

I already tried increasing the grid from 5 to 15, but also a 15 grid with lot less trades gave problems.
Per terminal I never run more than 5 charts. Also got a stuck one on on a terminal with 2 RnRs.

What also baffles me is that there is so much difference between brokers:
- Global Prime, 1 % stuck, connection 310ms
- Tickmill, about 25% stuck after 2 days, connection 360ms
- Exness, 100% stuck within 6 hours, connection 344ms
There is not much difference between them in connection speed... all bad

But you are right, I already concluded that I will need a VPS. Just part of the cost of doing business.

I can't run this from home. Not only because of connection speed, but also because of electricity brown-outs and poor ADSL2+ quality. :arrrg:

But with my experience with stuck EAs, I was/am very concerned how long it would take me to notice that an EA was stuck in a Empty4 terminal running on a VPS. Hence this thread.

Hopefully I am just over-concerned unnecessarily. I did not read anything yet from VPS users that hey had problems.
User avatar
rapple
Trader
Posts: 277
Joined: Fri Feb 21, 2014 10:56 pm
Location: Sydney, Australia

Stuck in loop and stuck in pause manager???

Post by rapple »

I think its essential that we find a way to monitor VPS. As I said previously I only check the VPS client once a day so it could really hurt a Live account if an EA gets stuck in a rapidly moving market.

I am sure the brighter minds than I can come up with a solution. However I wonder how a VPS server could contact me (SMS?)

Kind regards Richard
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Stuck in loop and stuck in pause manager???

Post by renexxxx »

Peter,

Have a look at these attached pieces of code. For the non-coders, don't bother downloading those, as they are not trading and won't make you rich.

The RogueEA is an EA that will crash after having received 100 ticks. Whilst it is working (i.e. before the crash) it sends a PING to whoever (or is it whomever, I never know this) is listening. In fact, the PING is broadcasted to all other charts. Charts that do NOT implement the OnChartEvent() event handler will be oblivious to this PING, and it will silently disappear into nothing.

However, the MonitorEA does implement the OnChartEvent() event handler, and is particularly interested in events with the EVENT_PING eventID. Such events, he knows, have a particular message format (i.e. <chartID>|<expertName>|<symbolName>. Also, the message is sent with the datetime of when it was sent. With this information, MonitorEA can do a little housekeeping, and can keep track of which EA (or chart I should say) has stopped pinging for a given time. Once it notices this, it (MonitorEA) will start bothering you with Alert()'s to that effect.

Over to you. You can use the code, to create a super-duper dashboard showing the latest ping times of each participating (monitored) EA.

Rene.
You do not have the required permissions to view the files attached to this post.
WhoKnows
Trader
Posts: 102
Joined: Wed Mar 19, 2014 11:57 pm
Location: North Brisbane, Australia

Stuck in loop and stuck in pause manager???

Post by WhoKnows »

Thank you Renexxxx, that was fast, much appreciated.

The approach makes a lot of sense.
Just opened it in the editor. It looks like you already wrote a whole system. A lot more than just code snippets. Certainly never could have done that myself.

Got to go in a minute. Will study it when back.

Thanks again,
Peter
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Stuck in loop and stuck in pause manager???

Post by tomele »

@pivotter
I have moved your post to the RnR forum
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Stuck in loop and stuck in pause manager???

Post by renexxxx »

I have made a few more changes to the MonitorEA (particularly, the ability to restart charts that have stopped PINGing), and I have given it its own home. As mentioned in that topic, MonitorEA has a limited reason d'etre, but may be the code can be useful for other projects.
Post Reply

Return to “Coders Hangout”