VPS not taking trades unless recently sync'ed

 

Hey guys,

So, I have made a very simple EA, which does exceptionally well in backtesting (on some forex pairs. Not all, ofcourse - makes sense).

In backtest, it makes approximately 1 trade per day - give or take.


Although more forwardtesting needs to be done, it seems to do equally well when trading live. Yay! So far so good.


BUT.... it seems like I need to sync to VPS multiple times a day, for the EA to actually take the live trades even though entry conditions are met. 

I've seen it many times now. Happened again just now (1 minute prior to writing this). 

It goes like this:


Sync the EA to VPS

Sometime later it looks like entry conditions are met.

Nothing happens......

Sync the EA to VPS again (for the nth time).

Trades immediately placed on 5 pairs.


As mentioned, this is not the first time this happens. Not always the same number of trades being placed, ofcourse, but you get the picture.

This, clearly, is not the point of running an EA on VPS.


Anyone experienced something similar (or identical) and if so, anyone know of an explanation for this behaviour and possibly a solution?


Thanks

 
Are you setting conditions for trade execution as a global variable? That would explain the resetting of levels/conditions in you EA
 
Darryl Andrew Weston #:
Are you setting conditions for trade execution as a global variable? That would explain the resetting of levels/conditions in you EA
I'll look into that. Thanks
 
Darryl Andrew Weston #:
Are you setting conditions for trade execution as a global variable? That would explain the resetting of levels/conditions in you EA

It doesn't look like it. All functions and a single calculation are declared onTick.

The calculation is a formula containing 2 operands, one of which is an input double (that I call LotsizeBalanceFactor) and the other is the account balance. This then results in a global variable (that I call Lotsize) used as the Lotsize.

1 other input double exists, which is used for a max spread entry condition

That's it. 2 input doubles and 1 variable, the variable depending on one of the input doubles as it is used in a calculation which is done onTick 

Hope this makes sense

 
Post your recent Expert log
 
Darryl Andrew Weston #:
Post your recent Expert log

I'm not sure where I find this log file. Do you mean the one I have attached here? 

If so, then when I request an error log, it is empty. I don't know if that makes any difference and if something else can be spotted in Full log regardless, but anyway, there it is

Files:
 
Desktop and VPS expert logs
 
Darryl Andrew Weston #:
Desktop and VPS expert logs

These are the only ones I was able to find. I hope they are the right ones, so I called them what I think they are.


Even if they are not, though, I have spotted an inconsistency between the two!

Two trades were entered this morning. One of the logs shows both those orders being entered. The other shows only one.


As in the example in my original post, the orders were only entered at the moment I synced to VPS. This even though I had, at that time, Autotrading already enabled locally as well - as an experiment to see if it might have something to do with the hosting service. I'm usually having Autotrading turned off locally.

So, I'm not sure if the two trades this morning were entered from VPS or from my local machine. All I know is that they were entered a few seconds after syncing to VPS. Can you tell, from the attached documents, which is which

and can you think of any possible explanations for the inconsistency mentioned above?

Files:
 

Add some call-backs into the EA to see what its doing. Still think its a variable being set before Ontick() thats why its placing trades correctly after Migrate the VPS - its resetting the variables to recent conditions

int  maxSpread = 30;

if(SymbolInfoInteger(Symbol(),SYMBOL_SPREAD) < maxSpread){

//execute trade

}else{

Print("[TRADING STOPPED] Spread: ",SymbolInfoInteger(Symbol(),SYMBOL_SPREAD)," > Max Spread: ",maxSpread);

}
 
Darryl Andrew Weston #:

Add some call-backs into the EA to see what its doing. Still think its a variable being set before Ontick() thats why its placing trades correctly after Migrate the VPS - its resetting the variables to recent conditions

After much tinkering, I seem to have it working as intended now.

It's supposed to trade on H1, but because of less time between signals, I tried it on M1 and except for spreads causing the trades to lose (totally as expected) 3 live trades were taken within 15 minutes via VPS.

Turns out I needed to change a condition and also change the onTick sequence of conditions and a timefilter.

Now, it works in backtesting completely as before AND also in livetrading. At least on M1... Time will tell about H1. The conditions are not timeframe specific or dependant, though, so I don't see any immediate reason it wouldn't work on H1.

Now comes the unbearable wait to see what happens. Very exciting times.


A million thanks to you man. The problem may not have been exactly what you pointed to, but it was somewhat familiar and you have helped me rule out some things making me better able to spot it.

 
Yes. It works on H1 as well. Yay