I need to write a script that makes testers fuctionallity not for one expert, symbol
or timeframe as a bulit-in one but for a set of them. So I need to call user written
experts by it name and receive form them threi results. Tell me please how is it
possible to call an expert from a script by name. I've not found something like
this in the documentation.
- Errors, bugs, questions
- Is it possible for an indicator to call a script?
- Need help on how to call an indicator
stringo:
Stringo, Please how do I attach this code to a particular trading account.The code
is meant to close all to open positions and pending orders when acertain condition
is fulfilled. Help me check if it is correct. Thanks You cannot call experts from other mql4-programs. You can call functions.
Write your own mql4-library and call it's functions
double balance;
double equity;
int init(){
balance = AccountBalance();
}
int start(){
equity = AccountEquity();
if(equity >= balance*1.2){
bool flag;
//----
for(int cnt=OrdersTotal()-1; cnt>=0; cnt--)
{
flag=false;
if(OrderSelect(cnt,SELECT_BY_POS) && OrderSymbol()==Symbol())
{
if(OrderType()==OP_SELL) { flag=true; OrderClose(OrderTicket(), OrderLots(), Ask, 3); }
if(OrderType()==OP_BUY) { flag=true; OrderClose(OrderTicket(), OrderLots(), Bid, 3); }
if(flag)
{
Sleep(1000);
RefreshRates();
}
}
}
//----
balance = AccountBalance(); // new starting point for future trades
}
return(0);
}
Well, I've encountered one more question if I use libraries with experts function:
can I switch to testing mode programaticaly? I've found in the help just a function
to get if it's switchted on IsTesting but no links how to switsch to it. If not, how can I view an account history to
make a report of operation made by an expert form a library?
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