62 lines
1.6 KiB
MQL5
62 lines
1.6 KiB
MQL5
|
|
|
|
double closingprices[];
|
|
double pricedifferences[];
|
|
|
|
/*void OnInit()
|
|
{
|
|
/---
|
|
MqlRates rates[];
|
|
ArraySetAsSeries(rates,true);
|
|
int copied = CopyClose(_Symbol,PERIOD_M1,0,1440,rates);
|
|
if(copied>0)
|
|
{
|
|
Print("Bars copied: "+ copied);
|
|
/*string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
|
|
string out;
|
|
int size=fmin(copied,10);
|
|
for(int i=0;i<size;i++)
|
|
{
|
|
out=i+":"+TimeToString(rates[i].time);
|
|
out=out+" "+StringFormat(format,
|
|
rates[i].open,
|
|
rates[i].high,
|
|
rates[i].low,
|
|
rates[i].close,
|
|
rates[i].tick_volume);
|
|
Print(out);
|
|
}
|
|
}
|
|
else Print("Failed to get history data for the symbol -----------------------------",Symbol());
|
|
}
|
|
*/
|
|
|
|
|
|
void OnTick()
|
|
{
|
|
// create array for price data
|
|
MqlRates Priceinformation[];
|
|
|
|
//sort the array from the current candle downwards
|
|
ArraySetAsSeries(Priceinformation,true);
|
|
|
|
//fill the array with price data
|
|
int copied = CopyRates(_Symbol,PERIOD_M1,0,1440,Priceinformation);
|
|
|
|
Print("Last Price: ", Priceinformation[0].close);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void OnTimer()
|
|
|
|
void OnDeinit(const int reason)
|
|
{
|
|
/*
|
|
|
|
Print("Last Closingprice ",closingprices[0],"Forelast Closingprice", closingprices[1],
|
|
"\n Last pricedifference", pricedifferences[0]);
|
|
*/
|
|
}
|