I apologies in advance if this has already been answered, do point me in the right direction if that were to be the case. I have managed to store BID and ASK prices by using xlsgate. I'm having a hard time to add timestamp whenever there is a change in price. How would one go about coding that into mql->excel?
I am by no means a coder, hardly a "scriptkiddie" if you will. So i apologies in advance if this code looks rubbish.
This is how it looks like:
Update 1: Found a solution. Nasty coding, but it works
I am by no means a coder, hardly a "scriptkiddie" if you will. So i apologies in advance if this code looks rubbish.
This is how it looks like:
Attached Image
Inserted Code
//+------------------------------------------------------------------+
//| Test1.mq4 |
//| Copyright 2015, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#include <xlsgate.mqh>
extern string StartBid= "C3";
extern string StartAsk= "D3";
bool xlsgateok=false;
string StrBid;
string StrAsk;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
StrBid=StartBid;
StrAsk=StartAsk;
if (ExcelInit("mt4") && ExcelStart(""))
{
Print("XLSgate init done");
xlsgateok=true;
Print("Office version = "+ExcelVersion());
ExcelSheetAdd("MT4");
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
double lastBid=0;
double lastAsk=0;
void OnTick()
{
//---
if(xlsgateok && lastBid!=Bid)
ExcelSetValue(StrBid,Bid);
lastBid=Bid;
StrBid=ExcelRowAdd(StrBid,1);
if(xlsgateok && lastAsk!=Ask)
ExcelSetValue(StrAsk,Ask);
lastAsk=Ask;
StrAsk=ExcelRowAdd(StrAsk,1);
}
//+------------------------------------------------------------------+ Update 1: Found a solution. Nasty coding, but it works
Energy, frequency and vibration.