how to draw buy/sell signals on financial charts?

TeeChart for ActiveX, COM and ASP
Post Reply
Repka
Newbie
Newbie
Posts: 7
Joined: Wed Sep 22, 2004 4:00 am
Location: Moscow
Contact:

how to draw buy/sell signals on financial charts?

Post by Repka » Mon Nov 27, 2006 2:08 pm

Is there any way to draw buy/sell signals on financial charts?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Nov 27, 2006 2:48 pm

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
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Repka
Newbie
Newbie
Posts: 7
Joined: Wed Sep 22, 2004 4:00 am
Location: Moscow
Contact:

Post by Repka » Mon Nov 27, 2006 3:01 pm

thank you, this is exactly what i need :)

Post Reply