Start many script with one script

 

Hi!

I have one script for each time: 1, 5, 15, 60 minutes and 1 day and 1 week.

For each time, I put or drag my script for over.

How Can I to create a script that start all this scripts in the same time in each windows that each script belongs?

Thanks

 

manually is very simple the question is if u need automatic

 
qjol:

manually is very simple the question is if u need automatic


Hi qjol.

Many functions can play or make manually. But making this automatically functions, we can to leanin more mql4 or mql5, so besting the code, lapidaring this.

Sorry my english...

If this possible, other ideas can to be play...

 

maybe u can use sendkey (CTRL + E)

 

Is possible make an only script with all in?

My script save the candles values in csv file:

int handle1=FileOpen("dados15.csv",FILE_CSV|FILE_WRITE, ",");
for(int i=65000;i>bars_count;i--)
FileWrite(handle1, TimeToStr(Time[i], TIME_DATE),TimeToStr(Time[i], TIME_MINUTES),Open[i],Close[i],High[i], Low[i]);

FileClose(handle1);

Above, save 65000 candle in 15 minutes time. I drag this script in over windows with the time seted in 15 minutes.

Is possible I sabe the candle of time 60 minutes in one scripr runing in 15 minutes time?

 
bisewski:

[...]

How Can I to create a script that start all this scripts in the same time in each windows that each script belongs?

Why have it in separate scripts in the first place? Do it all in one script. Anything related to different timeframes can be handled via code.
 

Your idea is very good, but how Can I make this? Only an introduction...

In mql5 there are the Chart Function, and not in mql4...

 
if (Period() == 15)
   {
   //do X;
   }

if (Period() == 30)
   {
   //do Y;
   }
else
//do Z;
 

You can access the prices of any other pair and time frame from within any other chart. All you have to use is:


other_bars = iBars(other_symbol, other_timeframe); // the equivalent of the Bars variable for the other pair
other_close = iClose(other_symbol, other_timeframe, other_shift);
// the equivalent of Close[shift], the close in the other pair
other_open = iOpen(other_symbol, other_timeframe, other_shift);
// see above
other_high = iHigh(other_symbol, other_timeframe, other_shift);
other_low = iLow(other_symbol, other_timeframe, other_shift);

other_volume = iVolume(other_symbol, other_timeframe, other_shift);


other_shift = iBarShift(other_symbol, other_timeframe, Time[this_shift]);
// useful when aligning candles of multiple pairs in one table since the shifts tend to drift apart because some bars are always missing.

 

then you would rewrite your export function so that it is generic and accepts any arbitrary symbol and timeframe:

int start(){
   export_all();
   return(0);
}

void export_all(){
   int s, p;
   string symbols[] = {"EURUSD", "GBPUSD", "USDJPY"};
   int periods[] = {1, 5, 15, 30, 60};

   for (s=0; s<ArraySize(symbols); s++){
      for (p=0; p<ArraySize(periods); p++){
         export_one(symbols[s], periods[p]);
      }
   }
}

void export_one(string symbol, int period){
   int i;
   int F;
   F = FileOpen(symbol + period + ".csv", FILE_CSV | FILE_WRITE, ",")
   for (i=0; i<iBars(symbol, period); i++){
      FileWrite(F, TimeToStr(iTime(symbol, period, i), TIME_DATE), ... , ILow(symbol, period, i));
   }
   FileClose(F);
}
something like this.