I for backtesting use minute data.
ExitOnClose apparently work only tick data.
But in real strategy i want to close positions and orders exactly when session close.
Is
...Initialize()
{
ExitOnClose = false; // initially disable ExitOnClose
Add(PeriodType.Minute,1)
...
...OnBarUpdate()
{
ExitOnClose = !Historical; // when real data, use ExitOnClose!
if (BarsInProgress == 1 && Historical) // minute data, "hand" cancel in simulation on minute data
{
if (ToTime(Time[0]) == 161400))
{
CancelOrder(stopOrder);
...
I can use too
...Initialize()
{
Add(PeriodType.Minute,1)
Add(PeriodType.Second,1)
...
...OnBarUpdate()
{
if (BarsInProgress == 1 && Historical) // minute data
{
if (ToTime(Time[0]) == 161400))
{
CancelOrder(stopOrder);
...
if (BarsInProgress == 2) // second data
{
if (ToTime(Time[0]) == 161459))
{
CancelOrder(stopOrder);
...
Is second solution safe?
Both strategies are simplified...
Thanks for help Petr




Comment