SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sat Oct 24, 2020 3:29 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Apr 08, 2011 4:28 am 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
Hi, Can you make a bollinger band off of trade price ? Thanks

ex. bbl_tick = new BBL(Trade_Price,20,2);


Top
 Profile  
 
PostPosted: Fri Apr 08, 2011 8:09 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
You can collect trade prices in a time series (DoubleSeries) and use this series as input for your BB indicator.


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 2:35 am 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
I created something like this but I don;t see any chart. Could you help me why I am not getting any draw on the chart ?

public class MyStrategy : Strategy
{
TimeSeries tix;

public override void OnStrategyStart()
{

tix = new TimeSeries();

SMA sma_tix = new SMA(tix,10);
sma_tix.Color = Color.White;
Draw(sma_tix,0);

}
}


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 8:37 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Do you have any bar series on your chart? I suggest you create 1min bars from trades and draw this main series on the chart.


Top
 Profile  
 
 Post subject: Re: SMA on trade price
PostPosted: Thu Apr 21, 2011 10:51 am 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
Hi, i tried like this but no luck on getting tick(trade) sma graph on the chart . could you please help me ? thanks

using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

public class MyStrategy : Strategy
{
Instrument qqq;
TimeSeries tix;
BarSeries br;

public override void OnStrategyStart()
{

qqq = InstrumentManager.Instruments["QQQ"];
br = GetBars(qqq,BarType.Time, 60);

tix = new TimeSeries();

SMA smatix = new SMA(tix,10);
smatix.Color = Color.White;
Draw(smatix,0);

SMA smabar = new SMA(br,10);
smabar.Color = Color.White;
Draw(smabar,0);

}

}


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 11:10 am 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Are you sure that you put something into the "tix" series? You can do it in OnTrade handler for example: tix.Add(trade.DateTime, trade.Price);

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 11:25 am 
Offline

Joined: Mon May 18, 2009 10:10 pm
Posts: 23
Hi, I added like this. But How come i don't get trade graph on the chart ?? I only see a bar moving average price on 10 sec bar chart.. Is there a way to see tix moving average on the chart ? Thanks

using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

public class MyStrategy : Strategy
{
Instrument qqq;
TimeSeries tix;
BarSeries br;

public override void OnStrategyStart()
{

qqq = InstrumentManager.Instruments["QQQ"];
br = GetBars(qqq,BarType.Time, 10);

tix = new TimeSeries();

SMA smatix = new SMA(tix,10);
smatix.Color = Color.Pink;
Draw(smatix,0);

SMA smabar = new SMA(br,10);
smabar.Color = Color.White;
Draw(smabar,0);

}

public override void OnTrade(Trade trade)
{
tix.Add(trade.DateTime, trade.Price);
}
}


Last edited by jamesbond on Thu Apr 21, 2011 11:50 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Apr 21, 2011 11:44 am 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Unfortunately only indicators created on base of Bar series are visible on the BarChart. Please take a look at DrawSeries.cs script (MainMenu -> View -> Script Explorer -> Samples) - this script pops up new Canvas and draws a series on it. You could try to use the same technique to draw series or indicators that are based on Trades.

Regards,
Sergey.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 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