System using a lot of memory when EA running

To add comments, please log in or register
Melv
13
Melv  

Hi all,

I have an EA that is checking an indicator every tick to see if an arrow appears. Should an arrow appear it will do something.

I am finding that the EA is locking up my system with the amount of RAM and CPU  its using for the task. so clearly my approach is wrong or i am asking too much.


   if (  iCustom(Symbol(),0, Indicator,"M5",6,8,6,EntryType, 2, "Off",1,1)!=0 && AllowTrading == True) 


   {  

      // do something

   }


Is it simply that i am asking to much querying this indicator each tick or is there any pointers to how i should approach this?


Thanks

Madmiln

Lorentzos Roussos
29002
Lorentzos Roussos  
Study the indicator first ,check when the arrows appear and where (offset from latest bar).
If you already know this , then limit your testing cycles to only when new bars form on the target timeframe.
Melv
13
Melv  

Hi Thanks,


i cannot limit the cycles to new bars as i need to check each tick.

William Roeder
18304
William Roeder  
Melv: I am finding that the EA is locking up my system with the amount of RAM and CPU  its using for the task.

Reading iCustom takes no time, all it does is read the indicator's buffer, which the terminal has already updated before it called OnTick.

Fix your broken code. Probably you have an indicator that recomputes all bars every tick instead of only changed bars.
          How to do your lookbacks correctly.

You can also try setting max bars on chart (not history) to something reasonable (like 1K) and restart the terminal

lippmaje
607
lippmaje  

Melv:

i cannot limit the cycles to new bars as i need to check each tick.

I think he meant that you could limit the call to iCustom to once on a new bar.

static double signal=0;
if(IsNewBar()) signal=iCustom(...); // once a bar
if(signal!=0 && AllowTrading) DoTrade(); // on every tick
To add comments, please log in or register