Strategy tester? You working in bar data and indicators?? It's easy to get a timer set up, not sure by definition if you can sync your time with the timing of bars, if they are every 30 minutes and not 31, 62 etc then its trivial to set up. The only difference is your trading on past data but aslong as you've not set the code up for that data then theres literally no difference. Except maybe the strategy tester isnt 100% accurate but that works both ways, overall its probably beneficial because you get to test code under more circumstances.
If you really just want your EA to tick over the weekend why not plug your own data in? like something that matches relatively closely to current market conditions, whether your algorithm is trading per tick or being backtested the results shouldnt be a million miles different.
Like i say though, you have many more permutations and data sets to work with in the strategy tester and that will tick over for as long as you want.
Pretty much all my code is built on tick data so it works well for strategy testing, i was holding back on using bar data and indicators as i've heard they can be misleading but its what im gearing up to do now aswell to be honest.
Hey Keelan, thanks for reaching out. I wrote a reply but it seems it got deleted somehow, so I'll try to sum up what I'd written.
Looks like I'm more of a newbie than I would've led to believe, half your post sounded greek to me :) Well, maybe I'm exaggerating a bit but I've seen people talk about strategy tester and I'd sure give it a go, if not for one thing. One of my "requirements", if you will, is to be able to place manual trades at any arbitrary time, so batch type strategy testing wouldn't really help me here (maybe I'm slow, but I couldn't find the "visual mode" checkbox I'm supposed to find). What I'd like to have is basically MT4's main window running 24/7, either with a real or fake price feed, where I can place trades while my EA runs.
I really thought it would be something like a click away, right-click, "use virtual price feed" or whatever. Does everybody really take the weekend off and don't code? :)
Thanks man, appreciate your interest.
I haven't needed to do it for some time, but when I have wanted to test an EA that will include manually placed trades, I have coded it to place labels on the chart. Then the EA can read the labels to place trades.
//+------------------------------------------------------------------+ //| TesterTrades.mq4 | //| Keith Watford | //| none | //+------------------------------------------------------------------+ #property copyright "Keith Watford" #property link "none" #property version "1.00" #property strict //--- input parameters input int MagicNumber=99; input double LotSize=1; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { if(IsTesting()) { string name; string heading[4]={"Buy","Sell","Stop","TP"}; int xc=5; int yc=30; for(int i=0;i<4;i++) { name=heading[i]; ObjectCreate(0,name,OBJ_LABEL,0,0,0); ObjectSetText(name,name,10,"Arial",clrBlue); ObjectSetInteger(0,name,OBJPROP_XDISTANCE,xc); ObjectSetInteger(0,name,OBJPROP_YDISTANCE,yc); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); yc+=20; } name="EditSL"; ObjectCreate(0,name,OBJ_EDIT,0,0,0); ObjectSetText(name,DoubleToStr(0,Digits),10,"Arial",clrRed); ObjectSetInteger(0,name,OBJPROP_XDISTANCE,xc+50); ObjectSetInteger(0,name,OBJPROP_YDISTANCE,70); ObjectSetInteger(0,name,OBJPROP_XSIZE,60); ObjectSetInteger(0,name,OBJPROP_YSIZE,20); name="EditTP"; ObjectCreate(0,name,OBJ_EDIT,0,0,0); ObjectSetText(name,DoubleToStr(0,Digits),10,"Arial",clrRed); ObjectSetInteger(0,name,OBJPROP_XDISTANCE,xc+50); ObjectSetInteger(0,name,OBJPROP_YDISTANCE,90); ObjectSetInteger(0,name,OBJPROP_XSIZE,60); ObjectSetInteger(0,name,OBJPROP_YSIZE,20); } //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { if(IsTesting()) { string name="Buy"; if(ObjectGetInteger(0,name,OBJPROP_SELECTED)==true) { double sl=StrToDouble(ObjectGetString(0,"EditSL",OBJPROP_TEXT)); double tp=StrToDouble(ObjectGetString(0,"EditTP",OBJPROP_TEXT)); int ticket=OrderSend(Symbol(),OP_BUY,LotSize,Ask,50,sl,tp,NULL,MagicNumber,0,clrNONE); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); } name="Sell"; if(ObjectGetInteger(0,name,OBJPROP_SELECTED)==true) { double sl=StrToDouble(ObjectGetString(0,"EditSL",OBJPROP_TEXT)); double tp=StrToDouble(ObjectGetString(0,"EditTP",OBJPROP_TEXT)); int ticket=OrderSend(Symbol(),OP_SELL,LotSize,Ask,50,sl,tp,NULL,MagicNumber,0,clrNONE); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); } } //--- }
Above is an example.
Unfortunately, OnChartEvent() doesn't work in the tester with an EA, so I get round it by double clicking on Buy or Sell, to select it.
This could be expanded to include modifying or closing trades
Note: if you pause the EA while entering the trade, you will need to un-pause it before the trade is placed because it will need a new tick before checking for the selected label.
![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
I'm new here, long time lurker as a lot of google searches tend to end up in here anyway, so I thought might as well create an account and start participating.
I'm trying to get an EA off the ground, and being able to code during the next few days would help out a lot. Currently using only demo accounts for this. The EA uses some automated strategies but it also manages manual trades. For what I see, there's no way to place a trade whenever the market's closed, which would be tomorrow and up until next Monday. Is there any way I can get my MT4 installation to just accept trades and act like it's running a market over a fake price feed of some sort? I've looked but I can only find kludgy and outdated solutions.
I found something that promised being ideal or close to ideal, that's the MT4BAR, but it doesn't really work for my purposes at all. Afer installing it just sits there sending ticks, but my EA doesn't go anywhere. I've saw people recommending vHands, but that's like in 2011, and I've figured a lot must have changed since that.
Is anyone here able to code on MT4 during the weekend? I'd be very interested to know your experiences.