Download MetaTrader 5

I need help in my EA

To add comments, please log in or register
You can test an application before buying it. Find out how to do that!
John_Cena_111
18
John_Cena_111 2014.06.02 21:45 

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 

Snelle Moda
602
Snelle Moda 2014.06.02 22:18  
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;

John_Cena_111
18
John_Cena_111 2014.06.04 21:25  
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
To add comments, please log in or register