Cara Membuat Candle Stick Pergerakan Harga CryptoCurrency dengan Visual Basic 6.0 (VB6)
Kali Saya akan mencoba coba membuat grafik pergerakan harga suatu asset yang dikenal dengan Candle Stick, artikel ini terinspirasi dari pergerakan harga Crypto.
Pembuatan Grafik Candle Stick ini saya akan mencobanya dengan Visuak Basic 6.0 (vb6).
Apa itu CandleStick ?
Grafik candlestick dalam analisis teknikal trading (diagram visual pergerakan harga saham/forex), yang menunjukkan harga buka, tutup, tertinggi, dan terendah dalam satu periode waktu. Grafik candlestick adalah alat visual yang populer di kalangan trader untuk memprediksi tren pasar dengan mengamati pola seperti Hammer, Doji, Morning Star, yang memberi informasi penting tentang sentimen pasar.
| CandleStick di vb6 |
Berikut adalah langkah Cara Membuat Candle Stick Pergerakan Harga CryptoCurrency dengan Visual Basic 6.0 (VB6):
1. Buka Form VB6 Anda
2. Pada Form tanamkan PictureBox, atur properties PictureBox:
AutoRedraw=True
BackColor=&H00400000&
Height=2415
Width=3615
3. Copy Paste pada bagian General-Declaration kode dibawah ini :
Private Type Candle
OpenP As Single
HighP As Single
LowP As Single
CloseP As Single
End Type
Private Candles(20) As Candle
Private Sub Form_Load()
' ---- 8 CANDLE ----
Candles(1).OpenP = 100: Candles(1).HighP = 110: Candles(1).LowP = 95: Candles(1).CloseP = 108
Candles(2).OpenP = 108: Candles(2).HighP = 115: Candles(2).LowP = 105: Candles(2).CloseP = 107
Candles(3).OpenP = 107: Candles(3).HighP = 112: Candles(3).LowP = 101: Candles(3).CloseP = 102
Candles(4).OpenP = 102: Candles(4).HighP = 109: Candles(4).LowP = 99: Candles(4).CloseP = 107
Candles(5).OpenP = 107: Candles(5).HighP = 113: Candles(5).LowP = 104: Candles(5).CloseP = 105
Candles(6).OpenP = 105: Candles(6).HighP = 111: Candles(6).LowP = 98: Candles(6).CloseP = 100
Candles(7).OpenP = 100: Candles(7).HighP = 113: Candles(7).LowP = 104: Candles(7).CloseP = 105
Candles(8).OpenP = 105: Candles(8).HighP = 111: Candles(8).LowP = 98: Candles(8).CloseP = 100
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = True
DrawCandlestick
End Sub
Private Sub DrawCandlestick()
Dim i As Integer
Dim x As Integer
Dim bodyTop As Single
Dim bodyBottom As Single
Dim wickTop As Single
Dim wickBottom As Single
Dim colorUp As Long, colorDown As Long
Dim ChartBottom As Single
Dim ChartTop As Single
colorUp = vbGreen
colorDown = vbRed
ChartBottom = 250
ChartTop = 50
x = 20
For i = 1 To 8
' --- Wick (High-Low) ---
wickTop = ChartBottom - Candles(i).HighP
wickBottom = ChartBottom - Candles(i).LowP
Dim wickColor As Long
' warna wick mengikuti body
If Candles(i).CloseP >= Candles(i).OpenP Then
wickColor = vbGreen
Else
wickColor = vbRed
End If
' gambar wick sesuai warna body
Picture1.Line (x, wickTop)-(x, wickBottom), wickColor
' --- Body (Open-Close) ---
If Candles(i).CloseP >= Candles(i).OpenP Then
bodyTop = ChartBottom - Candles(i).CloseP
bodyBottom = ChartBottom - Candles(i).OpenP
Picture1.Line (x - 5, bodyTop)-(x + 5, bodyBottom), colorUp, BF
Else
bodyTop = ChartBottom - Candles(i).OpenP
bodyBottom = ChartBottom - Candles(i).CloseP
Picture1.Line (x - 5, bodyTop)-(x + 5, bodyBottom), colorDown, BF
End If
x = x + 15
Next
End Sub
Private Sub MakeCandlesStairUp()
Dim i As Integer
Dim base As Single
base = 100 ' nilai awal
For i = 1 To 10
Candles(i).OpenP = base
Candles(i).CloseP = base + 5 ' close lebih tinggi ? candle naik
Candles(i).HighP = Candles(i).CloseP + 3
Candles(i).LowP = Candles(i).OpenP - 2
base = Candles(i).CloseP ' agar candle berikutnya lebih tinggi ? efek tangga
Next i
End Sub
Jalankan Project dan Anda akan melihat hasilnya seperti gambar diatas
Post a Comment for "Cara Membuat Candle Stick Pergerakan Harga CryptoCurrency dengan Visual Basic 6.0 (VB6)"
Berkomentarlah dengan sopan sesuai tema yang Anda baca.
Jangan menyimpang dari tema