I am sure I am doing something wrong here and I am hoping that the community can help correct my error. The Close function is returning zeros instead of a value. Here is my code:
#include <windows.h>
#include "StrategyInterfaceUnit.h"
#include "TechnicalFunctions.h"
#include <iostream>
using namespace std;
PChar Currency = NULL;
int Timeframe;
EXPORT void __stdcall InitStrategy()
{
StrategyShortName("Test");
StrategyDescription("Test");
RegOption("Currency", ot_Currency, &Currency);
RegOption("Timeframe", ot_TimeFrame, &Timeframe);
Timeframe = PERIOD_M15;
}
EXPORT void __stdcall DoneStrategy()
{
free(Currency);
}
EXPORT void __stdcall ResetStrategy()
{}
EXPORT void __stdcall GetSingleTick()
{
int index = 0;
// retrieve current values
double b = Bid();
double c = Close(index);
// initialize buffers
char buffer[50] = { '\0' };
char buffer1[50] = { '\0' };
// display bid
sprintf(buffer, "bid value : %.4f", b);
Print(buffer);
// display cost
sprintf(buffer, "close value : %.4f", c);
Print(buffer1);
}
Close() returning zeros C++
Who is online
Users browsing this forum: No registered users and 16 guests