[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 964
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Why does the speed of the tester drop towards the end of the third year?
there is such a problem - i had this problem too, if the Expert Advisor makes many trades per year - maybe a lot of data is stored for displaying the final result or maybe indicator buffers eat memory
as a whole saw - i do not know, bear with me - for the big picture, the test for 10 years, and it is better to optimize one year at a time and then make a selection of the optimum parameters
I want to analyse different crosses followed by placing orders on another pair:
int magic = 428;//magic number of the Expert Advisor
extern double volume = 0.1;//volume of the order being placed
extern int slippage = 3;//slippage
int OPB;//the mark of the Buy order
int OPS;//the marking of the order to sell
int Profit=1;//open order profit level
string comB = "Entry into the trend on Buy; // comment on the order
string comS = "Entry by trend to Sell";// order comment
double StochasticCAD;//position of the main Stochastic line on the current bar on USDCAD
double StochasticAUD;//position of the main Stochastic line on the current bar for AUDUSD
double SARCAD;//position of the current indicator on USDCAD
double SARCAD;//position of the indicator bar back on USDCAD
double SARAUD;//current position of indicator on AUDUSD
double SARСAUD;//position of the indicator bar back on AUDUSD
int start()
{
//______________________________определение значений переменных_______________________
StochasticCAD = iStochastic("USDCAD",30,5,3,3,1,1,0,0);
StochasticAUD = iStochastic("AUDUSD",30,5,3,3,1,1,1,0);
SARCAD=iSAR("USDCAD",30,0.02,0.2,0);
SARСCAD=iSAR("USDCAD",30,0.02,0.2,1);
SARAUD=iSAR("AUDUSD",30,0.02,0.2,0);
SARСAUD=iSAR("AUDUSD",30,0.02,0.2,1);
double bidCAD =MarketInfo("USDCAD",MODE_BID);
double askCAD =MarketInfo("USDCAD",MODE_ASK);
double bidAUD =MarketInfo("AUDUSD",MODE_BID);
double askAUD =MarketInfo("AUDUSD",MODE_ASK);
//______________________________поиск и закрытие ордеров_______________________________________
int i;
for(i=0; i<=OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
break;// if the order number i does not exist, stop the search
if (OrderSymbol() != "GBPUSD" || OrderMagicNumber() != magic) // if the order is not from the pair where our EA is located
continue; // skip the order and look at the next order following it
//_______close Buy_______
if (OrderType() == OP_BUY && OrderProfit()>=Profit)
// if order is Buy
{
OPB=1;
if(StochasticCAD==0 || StochasticAUD==100 || SARCAD<bidCAD || SARAUD>askAUD)//and the market is about to reverse
{
OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Wheat); // close it if it is in profit
OPB=0;
}
}
else
{
//_______close Sell_______
if(OrderType() == OP_SELL && OrderProfit()>=Profit)// if order is Sell
{OPS=1;
if(StochasticCAD==100 || StochasticAUD==0 || SARCAD>askCAD || SARAUD<bidAUD)//and market is close to reversal
{
OrderClose(OrderTicket(),OrderLots(),Ask,slippage,PaleTurquoise); // close it if it is in profit
OPS=0;
}
}
}
}
//______________выставление ордеров______________________________________________________________________
if (SARCAD>askCAD && SARCAD<bidCAD && SARAUD<bidAUD && SARCAUD>askAUD && OPB<1)//define conditions
{ //_______Buy_______
if(!IsTradeAllowed())
{
Alert("trade thread is busy, try again buy...");
return(-1);
}
OPB =OrderSend("GBPUSD",OP_BUY,volume,Ask,slippage,0,0,comB,magic,0,Red); //set an order
if(OPB == -1)
{
Alert("GBPUSD", "Error: buy", GetLastError());
return(-1);
}
if(OPB > 1)
Alert("GBPUSD", "We have a Buy order!)
}
else
{//_______Sell_______
if (SARCAD>askCAD && SARCAD<bidCAD && SARCADAUD<bidAUD && SARAUD>askAUD && OPS<1)//define conditions
{
if(!IsTradeAllowed())
{
Alert("the trade thread is busy, try again to sell...");
return(-1);
}
OPS=OrderSend("GBPUSD",OP_SELL,volume,Bid,slippage,0,0,comS,magic,0,Blue); //set an order
if(OPS == -1)
{
Alert("GBPUSD", "Error: Sell", GetLastError());
return(-1);
}
if(OPS > 1)
Alert("GBPUSD", "Put Sell order!)
}
}
return(0);//exit
}
Nothing comes out when I test it. No results.
In the log there is a set of errors:
Can you tell me what's wrong?
I want to analyse different crosses and then place orders on another pair:
int magic = 428;//magic number of the Expert Advisor
extern double volume = 0.1;//volume of placed order
extern int slippage = 3;//slippage
int OPB;//tag of placed Buy order
int OPS;//tag of placed Sell order
int Profit=1;//profit level of opened orders
string comB = "Entry by trend to Buy"; //request for order
string comS = "Entry by trend to Sell"; //request for order
double StochasticCAD;//position of Stochastic main line on the current bar in USDCAD
double StochasticAUD;//position of Stochastic main line on the current bar in AUDUSD
double SARCAD;//current position of indicator on USDCAD
double SARCAD;//position of indicator bar back on USDCAD
double SARAUD;//current position of indicator on AUDUSD
double SARAUD;//position of indicator bar back on AUDUSD
int start()
{
//______________________________ determination of variable values_______________________
StochasticCAD = iStochastic("USDCAD",30,5,3,3,1,1,0,0);
StochasticAUD = iStochastic("AUDUSD",30,5,3,3,1,1,1,0);
SARCAD=iSAR("USDCAD",30,002,0.2,0);
SARCAD=iSAR("USDCAD",30,0.02,0.2,1);
SARAUD=iSAR("AUDUSD",30,0.02,0.2,0);
SARAUD=iSAR("AUDUSD",30,0.02,0.2,1);
double bidCAD =MarketInfo("USDCAD",MODE_BID);
double askCAD =MarketInfo("USDCAD",MODE_ASK);
double bidAUD =MarketInfo("AUDUSD",MODE_BID);
double askAUD =MarketInfo("AUDUSD",MODE_ASK);
//______________________________ search and close orders_______________________________________
int i;
for(i=0; i<=OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
break;// if order number i does not exist, stop the search
if (OrderSymbol() !="GBPUSD" || OrderMagicNumber() != magic) // if the order is not from the pair where our Expert Advisor is located
continue; // skip it and look at the order following it
//_______close Buy_______
if (OrderType() == OP_BUY && OrderProfit()>=Profit)
// if the order is BUY
{
OPB=1;
if(StochasticCAD==0 || StochasticAUD==100 || SARCAD<bidCAD || SARAUD>askAUD)//and the market is close to reversal
{
OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Wheat); // close it if it is BUY
OPB=0;
}
}
else
{
//_______close Sell_______
if(OrderType() == OP_SELL && OrderProfit()>=Profit)// if the order is Sell
{OPS=1;
if(StochasticCAD==100 || StochasticAUD==0 || SARCAD>askCAD || SARAUD<bidAUD)//and the market is close to a reversal
{
OrderClose(OrderTicket(),OrderLots(),Ask,slippage,PaleTurquoise); // close it if in profit
OPS=0;
}
}
}
}
//______________ order placing ______________________________________________________________________
if (SARCAD>askCAD && SARCAD<bidCAD && SARAUD<bidAUD && SARAUD>askAUD && OPB<1)// define conditions
{ //_______Buy_______
if(!IsTradeAllowed())
{
Alert("the trade thread is busy, try again buy...");
return(-1);
}
OPB =OrderSend("GBPUSD",OP_BUY,volume,Ask,slippage,0,0,comB,magic,0,Red); //set order
if(OPB == -1)
{
Alert("GBPUSD", "error: buy", GetLastError());
return(-1);
}
if(OPB > 1)
Alert ("GBPUSD", "Put Buy Order!");
}
else
{//_______Sell_______
if(SARCAD>askCAD && SARCAD<bidCAD && SARCAD<bidAUD && SARAUD>askAUD && OPS<1)//define conditions
{
if(!IsTradeAllowed())
{
Alert("the trade thread is busy, try again to sell...");
return(-1);
}
OPS=OrderSend("GBPUSD",OP_SELL,volume,Bid,slippage,0,0,comS,magic,0,Blue); //set order
if(OPS == -1)
{
Alert("GBPUSD", "error: sell", GetLastError());
return(-1);
}
if(OPS > 1)
Alert ("GBPUSD", "Put Sell order!");
}
}
return(0);//exit
}
Nothing comes out when tested. It produces no results.
There's a set of errors in the log:
Can you tell me what's wrong?
First of all, learn how to insert code into window by simultaneous pressing "Counterclick + Alt + M", so that in your halimatry people navigate and give recommendations.
Also try double-clicking on the corresponding error message in the log - perhaps it will lead to some thoughts...
First, learn how to insert code into a window by pressing the Conrle + Alt + M keys at the same time, so that you can guide people through your nonsense and make recommendations.
Also, try double-clicking on the corresponding error message in the logbook - maybe that will give you some ideas...
Errors are in the tester's log, not the compiler's... (you can actually see it in the picture if you look at it first and comment on it later...). Double-clicking doesn't do anything there...
A test on all tics? Problems with history
A test on all tics? Problems with history
I.e. Do you need to reload the history for all pairs involved in the analysis?
I.e., you need to reload the history for all pairs involved in the analysis?
Maybe. If of course the brokerage company supports it.
But we should not forget that you can open positions in the tester for the current symbol, and there are some restrictions for other symbols
It is possible. If of course the brokerage company supports it.
Just keep in mind that in the tester you can open positions in the current instrument, and there are some restrictions on other instruments
What is a DC? And what are the restrictions on other instruments?
What is a brokerage company? And what are the limitations on other symbols?
DC - Dealing Desk
In the tester for other instruments you can only get the opening price on the zero bar, ticks for other instruments are not modelled, the market environment is practically unavailable.
Trades in other instruments are not opened.
If you need to correctly perform multicurrency analysis, it's better to use MT5. There is a multicurrency tester.