How to run a script or multiple scripts (or EA) from a script?

 
Is there a way to run another script, EA or multiple scripts from a script?

An example will be very much appreciated.

Maji
 
You cannot run script from another script. Try to use libraries
 
Hi Slawa,
How to change script to an EA?
Thanks
Vlad
 
How to change script to an EA?

Close client terminal.
Move (or copy) your script from experts\scripts directory to experts directory
Start client terminal.
 
Thanks Slawa,
Script is working but...
How to change indicator to an EA?
Vlad
 
Vlad, you need to remove all custom indicator functions and move mq4 to experts directory
 
Slawa,
I try but EA is not working.
Somebody can transfer this indicator to EA.
Thanks
Vlad

//+------------------------------------------------------------------+
//| Correlation USDCHF/EURUSD .mq4 |
//| Copyright © 2005, Yuri Makarov. |
//| http://mak.tradersmind.com |
//+------------------------------------------------------------------+
//Correlates chf prive ON eur 1 min chart
// if chf bar (1 min) is greater than 3 pips it recommends sell/buy eur
//

#property copyright "Copyright © 2005, Perky_z."
#property link "Perky_z@yahoo.com"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 OrangeRed

extern string Curency = "CHF";

double UsdChf[],UsdChfO[];
double Idx[];
double diff,diff1;
int init()
{
IndicatorShortName(Curency);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Idx);
return(0);
}

void start()
{
//I've put the period statement in - this means that
// you can get close for other periods onto the current chart
ArrayCopySeries(UsdChf,MODE_CLOSE,"USDCHF",PERIOD_M1);
ArrayCopySeries(UsdChfO,MODE_OPEN,"USDCHF",PERIOD_M1);


int counted_bars=IndicatorCounted();
double USD;

if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{


diff=(UsdChf[i]-UsdChfO[i]);
diff1=(UsdChf[i+1]-UsdChfO[i+1]);
Comment("Before",diff1,"\nnow ",diff);
if (Curency == "CHF") Idx[i] = UsdChf[i];
if (diff<=-0.0004 && diff<0)
{
Comment("diff ",diff," Buy eur");
Alert ("USDCHF ",diff," Difference BUY EURUSD");
}
if (diff>=0.0004 && diff>0)
{
Comment("diff ",diff," Sell eur");
Alert ("USDCHF ",diff," Difference SELL EURUSD");
}
if (Curency == "CHF") Idx[i] = UsdChf[i];

}
}
 
Hello,
Somebody how a look, please.
Thanks
V.

//Correlates chf prive ON eur 1 min chart
// if chf bar (1 min) is greater than 6 pips it recommends sell/buy eur
//

extern double slippage=2,Lot=1.0,StopLoss=34,TakeProfit=8, TrailingStop=8;
extern int Slippage = 3;
extern string Curency = "CHF";

double UsdChf[],UsdChfO[];
double Idx[];
double diff,diff1;

int start()
{

//I've put the period statement in - this means that
// you can get close for other periods onto the current chart
ArrayCopySeries(UsdChf,MODE_CLOSE,"USDCHF",PERIOD_M1);
ArrayCopySeries(UsdChfO,MODE_OPEN,"USDCHF",PERIOD_M1);


int counted_bars=IndicatorCounted();
double USD;
int total, cnt;
int ticket;

if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{


diff=(UsdChf[i]-UsdChfO[i]);
diff1=(UsdChf[i+1]-UsdChfO[i+1]);
Comment("Before",diff1,"\nnow ",diff);
if (Curency == "CHF") Idx[i] = UsdChf[i];
if (diff<=-0.0006 && diff<0)
{
ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,0,Ask+TakeProfit*Point,"Correl",12345,0,Green);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}

/* Comment("diff ",diff," Buy eur");
Alert ("USDCHF ",diff," Difference BUY EURUSD");*/
}
if (Curency == "CHF") Idx[i] = UsdChf[i];
if (diff>=0.0006 && diff>0)
{
ticket=OrderSend(Symbol(),OP_SELL,Lot,Bid,3,0,Bid-TakeProfit*Point,"Correl",12345,0,Red);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}