Lean
$LEAN_TAG$
VolumeProfile.cs
1
/*
2
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
using
QuantConnect
.
Data
.
Market
;
17
18
namespace
QuantConnect.Indicators
19
{
20
/// <summary>
21
/// Represents an Indicator of the Market Profile with Volume Profile mode and its attributes
22
/// </summary>
23
public
class
VolumeProfile
:
MarketProfile
24
{
25
/// <summary>
26
/// Creates a new VolumeProfile indicator with the specified period
27
/// </summary>
28
/// <param name="period">The period of the indicator</param>
29
public
VolumeProfile
(
int
period = 2)
30
: this($
"VP({period})"
, period)
31
{
32
}
33
34
/// <summary>
35
/// Creates a new VolumeProfile indicator with the specified name, period and priceRangeRoundOff
36
/// </summary>
37
/// <param name="name">The name of this indicator</param>
38
/// <param name="period">The period of this indicator</param>
39
/// <param name="valueAreaVolumePercentage">The percentage of volume contained in the value area</param>
40
/// <param name="priceRangeRoundOff">How many digits you want to round and the precision.
41
/// i.e 0.01 round to two digits exactly.</param>
42
public
VolumeProfile
(
string
name,
int
period, decimal valueAreaVolumePercentage = 0.70m, decimal priceRangeRoundOff = 0.05m)
43
: base(name, period, valueAreaVolumePercentage, priceRangeRoundOff)
44
{ }
45
46
/// <summary>
47
/// Define the Volume for the Volume Profile mode
48
/// </summary>
49
/// <param name="input"></param>
50
/// <returns>The volume of the input Data Point</returns>
51
protected
override
decimal
GetVolume
(
TradeBar
input)
52
{
53
return
input.
Volume
;
54
}
55
}
56
}
Indicators
VolumeProfile.cs
Generated by
1.8.17