Download MetaTrader 5

Help needed: - page 3

To add comments, please log in or register
Have you made a screenshot in MetaTrader? Share it with friends!
Frenchytrader
359
Frenchytrader 2014.04.22 08:40  

Thank you Thrdel, i'm fine now with Condition_1... I needed the logic to get trough.


Now the pb is how the EA can check Condition_1 into multiple timeframes && multiples pairs in 1 chart ?

Daniel Petrovai
440
Daniel Petrovai 2014.04.22 11:42  
FrenchyTrader:

Thank you Thrdel, i'm fine now with Condition_1... I needed the logic to get trough.


Now the pb is how the EA can check Condition_1 into multiple timeframes && multiples pairs in 1 chart ?


If you figured out the loop properly, I would have a string array for the symbols and an int array for time frames, then make a loop within a loop within a loop.

Here's an example of what I mean :

string symbolsArray[]={"EURUSD","USDJPY","YourSymbolHere","YourSymbolHere","YourSymbolHere"};
int    timeFrameArray[]{1,5,15,30,...your time frames };
int i=0,k=0,x=0;
bool cond1=false;
for(i=0;i<nuberOfSymbols;i++) //replace number of symbols with a number // this is the loop for symbols
   {
   for(k=0;k<total Number of time frames;k++) // replace the number of time frames with your number / when loop completed goes to next symbol and starts the loop trough all time frames again
      {
      for(x=0;x<5;x++) // this is the loop for your condition 1 //when loop completed , goes to next time frame , when all time frames complete , goes to next symbol and starts with the first time frame
         {
         cond1=false;
         if(close[x]>iMA(...,x)
            {
            cond1=true;
            continue;
            }
         else
            {
            cond1=false;
            break;
            // Print if you want, condition not met on symbol+symbolArray[i];
            }
        }
     if(cond1=true)Print(condition 1 true on symbol + symbolArray[i]+" time frame M +(string)timeFrameArray[k]); //if at the end of loop for cond1 all is good on that symbol and time frame
     }
 }

Something around those lines . I didn't compiled it so if you think you can use the idea, make sure it's all good.

Hope it gives you an idea of how it can be done.

Cheers

Frenchytrader
359
Frenchytrader 2014.04.22 15:14  

Thank you... I see how it works.

I will give it a go.

123
To add comments, please log in or register