multichart/timeframe scanning : help me with ideas

To add comments, please log in or register
Tusher Ahmed
252
Tusher Ahmed  

suppose, Broker offers 260 instruments . Each instruments got 7 time-frames which i want to scan for.(5,15,30,60,240,1440,10080)


for each intruments & each timeframes, i need to save info like :

bool  Trading_allowed_on_M5 = true; 

Im currently using an array

string symbol="";
int chartPeriod;
bool tradingAllowed[SymbolsTotal(true)][7];//7 means 7 timeframes  & its a 2d array

int periods[7]={PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1,PERIOD_W1};

/////////////////////////////////////////////////////////
//////scanning all instrunmenbts & timneframes by 2D loop
/////////////////////////////////////////////////////////
for(int zz=0;zz<SymbolsTotal(true);zz++)/////////symbols loop
  {
     for(int timeFrame=0;timeFrame<7;timeFrame++)///timeframe's loop
       { 
          //get all values from 
          symbol=SymbolName(zz,true);chartPeriod=periods[timeFrame];
            
             if (iRsi>70 )//***for "current" timeframe & "current" symbol
                       {
                          tradingAllowed[zz][timeFrame]=true;/////****TurnON FLAG
                       }
          
          if(   tradingAllowed[zz][1]//on M5 chart
             && tradingAllowed[zz][2]//on M15 chart 
             && tradingAllowed[zz][3]//on M30 chart
            ) Alert(" M5, M15, M30--all are over 70");


It may not be a smart way to do it(using arrays), i think there can be simpler ways to achieve this. Maybe class/struct?? but not sure how long they stay alive in memory.


Any simpler ways would be great.

Alain Verleyen
38674
Alain Verleyen  
Tusher Ahmed:

suppose, Broker offers 260 instruments . Each instruments got 7 time-frames which i want to scan for.(5,15,30,60,240,1440,10080)


for each intruments & each timeframes, i need to save info like :

bool  Trading_allowed_on_M5 = true; 

Im currently using an array


It may not be a smart way to do it(using arrays), i think there can be simpler ways to achieve this. Maybe class/struct?? but not sure how long they stay alive in memory.


Any simpler ways would be great.

Nothing is more simple then an array.
Tusher Ahmed
252
Tusher Ahmed  
Alain Verleyen:
Nothing is more simple then an array.

yes you are right. The code size is getting tremendous --following this traditional ways tho. But i couldn't find any better/simpler ways.

To add comments, please log in or register