How to place order at distance from moving average?

 

Good day .

‌I am trying to place an order at 10 points below from the LWMA using the following line of code:

if ((Ask<=(iMA(Symbol(), 1, 2 , 0, MODE_LWMA, 0, 0)) -10*Point)

‌It does it right only sometimes. How do I get it to always count the correct distance from the ask line ?

Thanks in advanced.‌

 

Most brokers are 5 digits now.

In which case 10 points = 1 pip.

You may already be aware of that 

 

Just figured out its just the lag and it cant be perfect all the time.

Thanks ‌

Reason: