New Bar

Examples step by step how to make your own automated strategy or user indicator
Message
Author
imamushroom
Posts: 11
Joined: Wed Jan 20, 2016 2:52 pm

New Bar

#1 Postby imamushroom » Sun Feb 19, 2017 10:47 am

Hi,

How do I detect a new bar opening (in C++11) in your product please?

Thanks in advance,

User avatar
neHcioHep
Posts: 14
Joined: Sat Nov 21, 2009 5:49 pm

Re: New Bar

#2 Postby neHcioHep » Mon Feb 20, 2017 9:19 am

Please try something like this

Code: Select all

#include <windows.h>
#include "StrategyInterfaceUnit.h"

TDateTime lastKnownBarTime;
//...

EXPORT void __stdcall InitStrategy()
{
   //...
}

EXPORT void __stdcall DoneStrategy()
{}

EXPORT void __stdcall  ResetStrategy()
{}


EXPORT void __stdcall GetSingleTick()
{
   SetCurrencyAndTimeframe(Currency, Timeframe);
   if (Time[0] != lastKnownBarTime)
   {
      // operations for new bar
      //...
   }
   lastKnownBarTime = Time(0);
}


imamushroom
Posts: 11
Joined: Wed Jan 20, 2016 2:52 pm

Re: New Bar

#3 Postby imamushroom » Tue Feb 21, 2017 11:42 am

Thanks, I'll give it a go.


Return to “Programming lessons”

Who is online

Users browsing this forum: No registered users and 1 guest