[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bull - Bear calculations



PureBytes Links

Trading Reference Links

You can use VBA code if you want. I find it a pain. In-cell code is faster
and once the template is set up you can just paste in other contract data
using VBA and the calculation sheet will automatically update itself very
quickly. That's why I only use the last 240 days of the contract.

Unfortunately, VBA only accepts RC code. Here's the Linear regression and
slope code to calculate them in the workbook. This does not produce a chart.

Range("AJ6:AK6").FormulaArray = _
        "=LINEST(R[-2]C[-30]:R[238]C[-30],R[-2]C[-33]:R[238]C[-33])"

    Range("AL6").Select
    ActiveCell.FormulaR1C1 = _
        "=RSQ(R[-2]C[-35]:R[238]C[-35],R[-2]C[-32]:R[238]C[-32])"

Best regards

Walter