I need help in my EA

 

I need the CODE of the difference between the last tick and the previous tick of the last tick for Example 

the last tick for Eur is 1.3254 and the previous tick of the last tick is 1.3256 so the difference between them is 1.3254-1.3256=-0.0002 

 
John_Cena_111:

I need the CODE of the difference between the last tick and the previous tick of the last tick for Example 

the last tick for Eur is 1.3254 and the previous tick of the last tick is 1.3256 so the difference between them is 1.3254-1.3256=-0.0002 


Hi, see this example how to get the previous price by using a static double variable.

I use the BID price for the calculation.


// Previous BID price    static double dBid_Price;      double dOldBid_Price = dBid_Price;    // To be used for getting recent/latest price quotes    MqlTick Latest_Price;          SymbolInfoTick(Symbol() ,Latest_Price);

// Update the BID price    dBid_Price = Latest_Price.bid; // Check the difference between prices.    double dDifferencePrice = 0;    dDifferencePrice = dBid_Price - dOldBid_Price;

 
snelle_moda:


Hi, see this example how to get the previous price by using a static double variable.

I use the BID price for the calculation.


Thank you Snelle for your support