SM
You dont say what pair (I'd guess a euro cross from the logic and hours?)
Most likely cause is in here
//Extra buffer for if price is too close to ask/bid, give it an extra 5
Spread varies in live trading, especially when the market is quiet, so spread-sensitive trading (which in effect yours is here) will be affected and will not show one-to-one results with back-testing
So Bid and Ask can go in different directions with no net movement
Far greater Asian-session spread variation is seen on ECN-like brokers, see this page to work out a couple of them ;)
Even if spread doesnt vary much, it is often greater in live forward than backtesting, just a pip can make a trade happen in a test but not in live...
I'm not saying the approach above is wrong at all, just dont expect live trading to be 'as simple' as backtesting!
BTW - maybe the ADX on H4 is a bit... laggy for this?
Maybe H1 would be better, and/or StdDev M15?
FWIW
-BB-
SM
You dont say what pair (I'd guess a euro cross from the logic and hours?)
Most likely cause is in here
//Extra buffer for if price is too close to ask/bid, give it an extra 5
Spread varies in live trading, especially when the market is quiet, so spread-sensitive trading (which in effect yours is here) will be affected and will not show one-to-one results with back-testing
So Bid and Ask can go in different directions with no net movement
Far greater Asian-session spread variation is seen on ECN-like brokers, see this page to work out a couple of them ;)
Even if spread doesnt vary much, it is often greater in live forward than backtesting, just a pip can make a trade happen in a test but not in live...
I'm not saying the approach above is wrong at all, just dont expect live trading to be 'as simple' as backtesting!
BTW - maybe the ADX on H4 is a bit... laggy for this?
Maybe H1 would be better, and/or StdDev M15?
FWIW
-BB-
It's GBPUSD but it's not the spread otherwise I would have got an error in the Journal. There are no errors.
Seems likely it didn't hit it's tick time?
It would be useful to put a few more Print() at strategic points so you know where it got up to, or not got up to. Which would cut down on the guessing.
True, I'll do that but do you see a problem with this in live running:
if(Hour()==EndHour && Minute()==0 && Seconds()==0)
True, I'll do that but do you see a problem with this in live running:
if(Hour()==EndHour && Minute()==0 && Seconds()==0)
If within this second no tick arrives then your code in this if statement won't be executed.
I will rather write something like (checking that if you want this to end at midnight you may want to look at the day too). As said previously if the =EndHour is not executed your line will never be executed!
The end hour is always 2100GMT though.
So If I check the end hour and the minutes then it has 60 ticks where it will check that loop on each tick.
If I add the seconds and the price doesn't change for 3 seconds then no ticks come through - is that right?
Maybe I could check the hour only but add a flag? or check if magic number orders exist.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My EA didn't create any pending orders this morning.
Kt ha sbeen working finr in the strategy tester. However, this morning nothing, no errors.
I have EAs enabled and live trading setup.
Any ideas?
Maybe I should change the hours, minutes, and seconds checks to just check the hour and minute and then return if any orders with magic order number 1 exist?
Some sample code: