SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Jan 29, 2020 7:05 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Question about KCU
PostPosted: Wed Sep 08, 2010 9:50 pm 
Offline

Joined: Sat Jul 24, 2004 12:40 am
Posts: 77
Location: Odessa, Florida
In the documentation I found an indicator called KCU defined as follows:
Formula:
KCU = SMAT(n) + ATR(n) where
SMAT(n) = Simple Moving Average of Typical prices
ATR(n) = Average True Range.

I have two questions about this.
1) What is meant by SMA of Typical prices? Does this mean that SMAT(n) does not use the close to compute the simple moving average?

2) I wish to compute something very close to the KCU. The formula I wish to use is this:
modifiedKCU = SMAT(n) + SMA(ATR(n) * C, m)
Where: SMAT(n) would be the Simple Moving Average based on the Close (or Median) price.
ATR(n) is the Average True Range over a period n
C is a constant
m is the period over which I compute the Simple Moving Average of ATR(n) * C

Can anyone provide some help in how I could code this modified KCU. The ultimate would be if someone could provide me with the code that would create such an indicator.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2010 12:58 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Hi,

http://www.smartquant.com/outsourcing.php

it mentions custom indicators as well ;)

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2010 1:04 pm 
Offline

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

1) Typical price is (High + Low + Close) / 3, it is hardcoded, so if you need your indicator to use Close price instead of Typical - you should create a new indicator or create a TimeSeries in your strategy and fill it with values in the OnBar handler.

2) Please find SampleIndicators demo project in the installation, it contains examples of several indicators, that should help you to develop your own.

Another wat is to create a series in a strategy, not by developing a new indicator:


Code:
SMA smat;
ATR atr;
TimeSeries multATR;
SMA smaMultATR;
int n;
int C;
int m;
TimeSeries modifiedKCU;

public override void OnStrategyStart()
{
smat = new SMA(Bars, n, BarType.Typical);
atr = new ATR(Bars, n);
smaMultATR = new SMA(multATR, m);
}

public override void OnBar(Bar bar)
{
if (atr.Count > 0)
    multATR.Add(bar.DateTime, atr.Last * C);

if (smaMultATR.Count > 0)
    modifiedKCU = smat.Last + smaMultATR.Last;

// here you can use modifiedKCU
// ...
}



Regards,
Sergey.


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