//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
A = MarketInfo("EURUSD",MODE_BID);
B = MarketInfo("USDJPY",MODE_BID);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if ( (lasttime != NULL) && ((Time[0] - lasttime )<60)) return(0);
lasttime = Time[0] ;
int handle=FileOpen("mydat.csv",FILE_CSV|FILE_READ | FILE_WRITE);
if(handle>0)
{
FileSeek(handle, 0, SEEK_END);
//---- add data to the end of file
FileWrite(handle, A,B);
但是attach to a chart之後
在C:\Program Files\FXDD - MetaTrader 4都找不到檔案mydat.csv
有誰拜託幫我下
#property copyright "Copyright ?2007, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"
#property indicator_chart_window
extern double A;
extern double B;
datetime lasttime=NULL;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
A = MarketInfo("EURUSD",MODE_BID);
B = MarketInfo("USDJPY",MODE_BID);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if ( (lasttime != NULL) && ((Time[0] - lasttime )<60)) return(0);
lasttime = Time[0] ;
int handle=FileOpen("mydat.csv",FILE_CSV|FILE_READ | FILE_WRITE);
if(handle>0)
{
FileSeek(handle, 0, SEEK_END);
//---- add data to the end of file
FileWrite(handle, A,B);
FileClose(handle);
handle=0;
}
return(0);
}