Hello i need a code that can make a Binomial Tree with some black spaces in between each probability
[/FONT][/COLOR][/LEFT]
<colgroup><col width="64" style="width:48pt" span="4"> </colgroup><tbody>
</tbody>this is a example of what that code do
and this is what i need
<colgroup><col width="64" style="width:48pt" span="4"> </colgroup><tbody>
</tbody>
Code:
Sub Create(Pasos As Long, RangoSalida As Range, Volatilidad As Variant, TVencimiento As Variant, RF As Variant, Dividendos As Variant)
Dim M() As Variant
Dim i As Long, j As Long
ReDim M((2 * (Pasos ^ 2) + 3), Pasos)
U = Exp(Volatilidad * (TVencimiento / Pasos) ^ (1 / 2))
D = 1 / U
a = Exp((RF - Dividendos) * (TVencimiento / Pasos))
P = (a - D) / (U - D)
Q = 1 - P
M(Pasos + 1, 0) = 50
For j = 1 To Pasos
For i = 1 To 2 * Pasos + 1
If M(i + 1, j - 1) <> "" And M(i - 1, j - 1) <> "" Then
M(i, j) = M(i - 1, j - 1) * D
ElseIf M(i + 1, j - 1) <> "" Then
M(i, j) = M(i + 1, j - 1) * U
ElseIf M(i - 1, j - 1) <> "" Then
M(i, j) = M(i - 1, j - 1) * D
End If
Next i
[LEFT][COLOR=#222222][FONT=Verdana]
59.4555 | |||
56.12005 | |||
52.97171 | 52.97171 | ||
50 | 50 | ||
47.195 | 47.195 | ||
44.54736 | |||
42.04826 |
<colgroup><col width="64" style="width:48pt" span="4"> </colgroup><tbody>
</tbody>
and this is what i need
59.4555 | |||
56.12005 | |||
52.97171 | 52.97171 | ||
50 | 50 | ||
47.195 | 47.195 | ||
44.54736 | |||
42.04826 |
<colgroup><col width="64" style="width:48pt" span="4"> </colgroup><tbody>
</tbody>