TimeCurrent. I can´t get it

Examples step by step how to make your own automated strategy or user indicator
Message
Author
javierp
Posts: 8
Joined: Thu Apr 16, 2015 6:04 am

TimeCurrent. I can´t get it

#1 Postby javierp » Sat Apr 25, 2015 2:09 am

Hello everybody

I´m trying to get in C++ (Code::Blocks) the current time (TimeCurrent) and print it in the journal screen but all the time it returns me a 0 value

In "StrategyInterfaceUnit.h" the declaration of TimeCurrent is:

TDateTime TimeCurrent()
{
if (rec.pTimeCurrent == NULL) return false;
return rec.TimeCurrent(rec.pTimeCurrent);
}


My code is:

#include <iostream>
#define DLL_EXPORT
#include <windows.h>
#include "FF2_TimeCurrent.h"
#include "StrategyInterfaceUnit.h"

PChar Currency;
char buff[200];

DECLDIR void InitStrategy()
{
StrategyShortName("TimeCurrent");
StrategyDescription("Print TimeCurrent in Log");

RegOption("Currency", ot_Currency, &Currency);
ReplaceStr(Currency, "EURUSD");
SetCurrencyAndTimeframe("EURUSD", PERIOD_M1);

TDateTime curr_time;
curr_time = TimeCurrent();

sprintf (buff,"Current time: %.6f", curr_time);
Print(buff);

}

DECLDIR void DoneStrategy()
{
free(Currency);
}
DECLDIR void ResetStrategy()
{
}

DECLDIR void GetSingleTick()
{
}

and what I get is in the attached file

May somebody help me

Thanks
Attachments
FF2_TimeCurrent.rar
(63.86 KiB) Downloaded 843 times

Return to “Programming lessons”

Who is online

Users browsing this forum: No registered users and 30 guests