Page 1 of 1

how to draw buy/sell signals on financial charts?

Posted: Mon Nov 27, 2006 2:08 pm
by 9524255
Is there any way to draw buy/sell signals on financial charts?

Posted: Mon Nov 27, 2006 2:48 pm
by narcis
Hi Repka, you can easily draw buy and sell signals in a financial chart using arrow series, for example:

Code: Select all

Private Sub Form_Load()
    TeeCommander1.Chart = TChart1

    'Populate candle (OHLC) series
    TChart1.Series(0).FillSampleValues 40
    
    With TChart1.Series(0)
        For i = 2 To .Count - 1
            If ((.asCandle.CloseValues.Value(i) > .asCandle.CloseValues.Value(i - 1)) And _
                (.asCandle.CloseValues.Value(i) > .asCandle.CloseValues.Value(i - 2))) Then
                'Sell signal
                TChart1.Series(1).asArrow.AddArrow .XValues.Value(i), .asCandle.HighValues.Value(i) + 5, _
                                                    .XValues.Value(i), .asCandle.HighValues.Value(i) + 1, _
                                                    "Sell Signal", vbRed
            Else
                If ((.asCandle.CloseValues.Value(i) < .asCandle.CloseValues.Value(i - 1)) And _
                (.asCandle.CloseValues.Value(i) < .asCandle.CloseValues.Value(i - 2))) Then
                    'Buy signal
                    TChart1.Series(1).asArrow.AddArrow .XValues.Value(i), .asCandle.LowValues.Value(i) - 5, _
                                                    .XValues.Value(i), .asCandle.LowValues.Value(i) - 1, _
                                                    "Buy Signal", vbGreen
                End If
            End If
        Next
    End With
End Sub

Posted: Mon Nov 27, 2006 3:01 pm
by 9524255
thank you, this is exactly what i need :)