Quick Note : Use this if your EA trades but is MultiPair/MultiTimeframe ,or requires external data feeds , and cant be tested with the default methods . In other cases just choose one of the non trading product categories while uploading (Utilities etc)
//+------------------------------------------------------------------+//| MarketFrame.mq4 |//| Copyright 2019 , Thomas Hoegh Reisenhus |//| https://www.mql5.com/en/users/baltobi |//+------------------------------------------------------------------+#property copyright"Copyright 2019 , Thomas Hoegh Reisenhus"#property link"https://www.mql5.com/en/users/baltobi"#property version"1.00"#property strict//--- input parametersinputbool Simulator=true;
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- create timer//EventSetTimer(60);//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Expert deinitialization function |//+------------------------------------------------------------------+voidOnDeinit(constint reason)
{
//--- destroy timer//EventKillTimer();
}
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+int sim_tr=0;
int sim_lm=19000;
voidOnTick()
{
//---int intester=MQLInfoInteger(MQL_TESTER);
//Simulation starts here if(intester==1&&Simulator==true)
{
sim_tr++;
if(sim_tr==sim_lm)
{
int mot=OrdersTotal();
int cot=(int)AccountInfoInteger(ACCOUNT_LIMIT_ORDERS);
double lot=MarketInfo(Symbol(),MODE_MINLOT);
double pip=Point();
int ilim=(int)SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL);
double lim=ilim;
lim=lim*2;
double sl=600;
if(sl<lim) sl=lim;
double tp=5000;
if(tp<lim) tp=lim*2;
//check if margin is available//margin for one lotdouble mfol=MarketInfo(Symbol(),MODE_MARGINREQUIRED);
//margin for min lot
mfol=mfol*lot*2;
if(mfol<AccountFreeMargin())
{
if(mot<cot)
{
bool check=OrderSend(Symbol(),OP_BUY,lot,Ask,10,Ask-sl*Point(),Ask+tp*Point(),NULL,0,0,clrRed);
}
}
sim_tr=0;
}
}
//Simulation ends here
}
//+------------------------------------------------------------------+//| ChartEvent function |//+------------------------------------------------------------------+voidOnChartEvent(constint id,
constlong &lparam,
constdouble &dparam,
conststring &sparam)
{
//---
}
//+------------------------------------------------------------------+
Hello, I want to update my EA to the latest version, which I created specifically for XAUUSD/Gold. However, validation always fails when tested on EURUSD, which was specifically designed for XAUUSD/Gold. Why is it being tested on EURUSD? Can you help me? Thank you.
There is the following information during validation:
test on EURUSD,H1 (netting) tester stopped because OnInit returns non-zero code 1 disconnected there are no trading operations
Try adding this on ontick .
I had an EA made with this code only and when uploading it to the market place it returns the attached error. Any idea how to fix this?
Thanks.
Quick Note : Use this if your EA trades but is MultiPair/MultiTimeframe ,or requires external data feeds , and cant be tested with the default methods .
In other cases just choose one of the non trading product categories while uploading (Utilities etc)
Try this one :
It worked, thanks!
Hello, I want to update my EA to the latest version, which I created specifically for XAUUSD/Gold. However, validation always fails when tested on EURUSD, which was specifically designed for XAUUSD/Gold. Why is it being tested on EURUSD? Can you help me? Thank you.
There is the following information during validation:
test on EURUSD,H1 (netting) tester stopped because OnInit returns non-zero code 1 disconnected there are no trading operations