Saturday, June 23, 2018

Expert Advisor for Simple Close Price

View Candle Close Price on your MT4 chart.
Step 1.
create SimpleClosePrice file in expert folder and

Step 2. copy paste code given below on your SimpleClosePrice file :
//code start

//+------------------------------------------------------------------+
//| simple close price EA                                            |
//+------------------------------------------------------------------+
void OnTick()
  {
//Create an Array
MqlRates PriceInformation[];
//Sort it from current candle to oldest candle
ArraySetAsSeries (PriceInformation,True);
//copy price data into the array
int Data=CopyRates(Symbol(),Period(),0,Bars(Symbol(),Period()),PriceInformation);
//get the current close price
double closePrice= PriceInformation[0].close;
//chart output
Comment ("Close Price for candle 0:",closePrice);
   
  }
//+------------------------------------------------------------------+

//code end

Step3.
Now open MT4 and go to :
View >> strategy test : 
set your symbol
Use date
Visual Mode
Start

Step4.
View Candle Close Pricel on left side on top in your chart.

No comments:

Post a Comment