Average number of Pips per Tick

 

Is there a way to calculate the Average number of Pips per tick?

I am new to coding in MQL4.

I would like to check in my code if there is a sudden fast movement against my trade and close it out if true.

 Thanks for any assistance.

Paul

 

Average number of Pips per tick? Do you perhaps mean the the average delta price change between ticks?

Each tick (quote) is a bid/ask price at a particular time. So if you want to know the average (in this case a moving average) of change in price between one tick (price quote) and the next, you could use for example an EMA (exponential moving average) at the tick level of the tick price changes/deltas.

Another way is to look at the ATR (Average True Range) of the Bars (instead of the tick price deltas) and detect when the current bar has surpassed a certain amount of range in reference to the ATR of that time-frame.

Since you have not supplied source code or sufficient details, it is difficult to provide an exact and detailed answer.

 
Burkster: Is there a way to calculate the Average number of Pips per tick?
Yes, calculate it.
int OnTick(){
   static double ave_tick_size = 0;
   static double last_tick = Bid;
   double change = MathAbs(last_tick - Bid);
   ave_tick_size += (change - ave_tick_size) / 100;  last_tick = Bid;
   :
Reason: