SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Fri Dec 13, 2019 1:32 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Nov 30, 2019 3:25 pm 
Offline

Joined: Fri Sep 28, 2012 8:16 am
Posts: 144
Hi,

I have only daily bars no trades,
I send market order at begin of the day, but filled at yesterday close.
If i send order after stock dividend, the error is too big.

My Data:
Quote:
DateTime,Open,High,Low,Close,Volume,OpenInt
2019-01-04 00:00:00.000,100,110,90,105,100,1
2019-01-05 00:00:00.000,200,210,190,205,100,1
2019-01-06 00:00:00.000,300,310,290,305,100,1
2019-01-07 00:00:00.000,400,410,390,405,100,1
2019-01-08 00:00:00.000,500,510,390,505,100,1


My Code:

Code:
using System;
using SmartQuant;

namespace OpenQuant
{
   public class Backtest : Scenario
   {
      public Backtest(Framework framework)
         : base(framework)
      {

      }

      public override void Run()
      {
         Instrument instrument1 = InstrumentManager.Instruments["TEST"];
         
         // Create SMA Crossover strategy
         strategy = new MyStrategy(framework, "SMACrossover");

         // Add instruments
         strategy.AddInstrument(instrument1);
         // Set simulation interval
         
         this.DataSimulator.SubscribeAll = true;
         
         // Run the strategy
         StartStrategy();
      }
   }
}


using System;
using System.Drawing;

using SmartQuant;
using SmartQuant.Indicators;
using SmartQuant.Optimization;

namespace OpenQuant
{
   public class MyStrategy : InstrumentStrategy
   {
      public MyStrategy(Framework framework, string name)
         : base(framework, name)
      {
      }
      
      protected override void OnBarOpen(Instrument instrument, Bar bar)
      {
         Buy(instrument, 1);
      }
   }
}



the ExecutionSimulator:
Quote:
FillMarketOnNext=false
FillOnBarOpen=true


OrderManager export to csv:
Quote:
DateTime,Provider,Symbol,Side,SubSide,Type,Qty,Avg. Price,Price,Stop Price,Status,Text
01/08/2019 00:00:00.000,2,TEST,Buy,Undefined,Market,1,405.00,0.00,0.00,Filled,
01/07/2019 00:00:00.000,2,TEST,Buy,Undefined,Market,1,305.00,0.00,0.00,Filled,
01/06/2019 00:00:00.000,2,TEST,Buy,Undefined,Market,1,205.00,0.00,0.00,Filled,
01/05/2019 00:00:00.000,2,TEST,Buy,Undefined,Market,1,105.00,0.00,0.00,Filled,
01/04/2019 00:00:00.000,2,TEST,Buy,Undefined,Market,1,105.00,0.00,0.00,Filled,


Or, Could you provide an interface for user to control the fill price and fill qty.


Top
 Profile  
 
PostPosted: Mon Dec 02, 2019 12:26 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 562
Hi, problem will be fixed in next release.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group