SmartQuant Discussion
http://www.smartquant.com/forums/

bollinger band on trade price
http://www.smartquant.com/forums/viewtopic.php?f=44&t=9027
Page 1 of 1

Author:  jamesbond [ Fri Apr 08, 2011 4:28 am ]
Post subject:  bollinger band on trade price

Hi, Can you make a bollinger band off of trade price ? Thanks

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

Author:  Dr. Anton Fokin [ Fri Apr 08, 2011 8:09 am ]
Post subject:  Re: bollinger band on trade price

You can collect trade prices in a time series (DoubleSeries) and use this series as input for your BB indicator.

Author:  jamesbond [ Thu Apr 21, 2011 2:35 am ]
Post subject:  Re: bollinger band on trade price

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);

}
}

Author:  Dr. Anton Fokin [ Thu Apr 21, 2011 8:37 am ]
Post subject:  Re: bollinger band on trade price

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.

Author:  jamesbond [ Thu Apr 21, 2011 10:51 am ]
Post subject:  Re: SMA on trade price

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);

}

}

Author:  Baraz Sergey [ Thu Apr 21, 2011 11:10 am ]
Post subject:  Re: bollinger band on trade price

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.

Author:  jamesbond [ Thu Apr 21, 2011 11:25 am ]
Post subject:  Re:mov avg on trade price

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);
}
}

Author:  Baraz Sergey [ Thu Apr 21, 2011 11:44 am ]
Post subject:  Re: bollinger band on trade price

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.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/