SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Jul 06, 2020 5:39 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Component Strategy
PostPosted: Tue Dec 13, 2016 3:54 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 270
Dear all,

I have a few questions:
1.) How could I define a variable, like BarSeries data1min for the MyStategy and then access that in any of the component?
1.5) Like if I want to define a SMA, or TR on the MyStrategy of a compoenent strategy would that be updated then as well?
2.) How would I be able to access the Quotes/Trades in any component? Like last trade? Or last Quote?
3.) Do you recommend using the component model at all for a 1 min bar strategy? Or is it something from the past?
4.) Can you let me know how to add fields to a signal?


Regards
Mike


Top
 Profile  
 
 Post subject: Re: Component Strategy
PostPosted: Wed Dec 14, 2016 10:16 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 569
Hello mikembb,
1)
Code:
   public class MyStrategy : ComponentStrategy
   {
      public BarSeries bars;
      
      public MyStrategy(Framework framework, string name)
         : base(framework, name)
      {
         bars = new BarSeries();
         
         DataComponent = new MyData();
         AlphaComponent = new MyAlpha();
         PositionComponent = new MyPosition();
         RiskComponent = new MyRisk();
         ExecutionComponent = new MyExecution();
         ReportComponent = new MyReport();
      }
   }


MyAlpha:
Code:
      public override void OnBar(Bar bar)
      {
         if (Bars.Count < length)
            return;
         
         int barsCount = (strategy as MyStrategy).bars.Count;
            
         highestHigh = Bars.HighestHigh(length);
         lowestLow = Bars.LowestLow(length);
      }

1.5)Indicators will be calculated automatically when new data arrives.
2)Like in p.1 you can add series to keep ticks(Trade,Bid,Ask):
Code:
TickSeries trades = new TickSeries();

3)Commonly used InstrumentStrategy instead ComponentStrategy.
I think ComponentStrategy can be used for more complex strategies.
4)Signal class contains ObjectTable inside, where you can place any information:
Code:
      public void Signal(double value, string comment)
      {
         Signal signal = new Signal(value);

         signal.Fields[0] = comment;
         
         strategy.PositionComponent.OnSignal(signal);
      }


and in MyPosition : PositionComponent you can access to this ObjectTable:
Code:
      public override void OnSignal(Signal signal)
      {
         string comment = (string)signal.Fields[0];
         ....
}


Top
 Profile  
 
 Post subject: Re: Component Strategy
PostPosted: Wed Dec 14, 2016 3:13 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 270
thanks for the quick support


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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