Moving Average again

 

Friends,

it is possible not new, but i don't know how to optimize it.

Target is having signals if in one in selected schedule of instruments (around 200) will be broken Moving Average (N) in time frame (NN).

Will be grateful for any advises or piece of information about.

 

If you use code like 'if (MA1<MA2) {Do something} is normaly to recive a lots of signals because the condition is true how much MA1<MA2.


To optimize try to use OrdersTotal() if you open a order or use a variable if you want the code execute one time.

Sample code:


bool access=False

if (MA1<MA2 && access==true)

{ do something

access=False

}