Logo "E7 BBKG NumSharp Sample"
cBot
231 unduhan
Versi 1.0, Feb 2025
Windows, Mac, Mobile, Web
Gambar unggahan "E7 BBKG NumSharp Sample"
Sejak 18/12/2024
2
Penjualan
4.11K
Instal gratis

Seperti yang diminta oleh banyak dari Anda, kami sekarang bekerja keras untuk menyediakan contoh beberapa kode dan paket pembelajaran mesin kami.

TensorFlow, PyTorch, Keras, Numpy, Pandas dan banyak paket .NET lainnya untuk memulai di dalam cTrader.

Misi kami adalah membuat Pembelajaran Mesin di dalam cTrader menjadi lebih mudah untuk semua orang.

Selamat berburu!

*** Kode ini tidak melakukan perdagangan apapun (hanya mencetak data dll). Ini hanyalah contoh kode bagaimana Anda dapat mulai membuat model AI Anda sendiri menggunakan paket Pembelajaran Mesin kami.

.......................................................

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

using NumSharp;
using np = NumSharp.np;
using Shape = NumSharp.Shape;

using PandasNet;
using static PandasNet.PandasApi;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class E7BBKGNumSharpSample : Robot
    {
        [Parameter("Versi 1.01", DefaultValue = "Versi 1.01")]
        public string Version { get; set; }

        [Parameter("Sumber")]
        public DataSeries Source { get; set; }

        [Parameter("Jumlah Bar Diperlukan", DefaultValue = 50, MinValue = 1, MaxValue = 10000, Step = 1)]
        public int BarsRequired { get; set; }

        [Parameter("Nama Metode", DefaultValue = MethodName.DataSplitPrints)]
        public MethodName Mode { get; set; }
        public enum MethodName
        {
            DataSplitPrints,
            PandasPrints,
            NDArrayPrints
        }
        
        protected override void OnStart()
        {
            // Inisialisasi indikator apapun
        }

        protected override void OnBar()
        {
            coba
            {
                jika (Mode == MethodName.DataSplitPrints)
                {
                    DataSplitPrints();
                }
                lain jika (Mode == MethodName.PandasPrints)
                {
                    PandasPrints();
                }
                lain jika (Mode == MethodName.NDArrayPrints)
                {
                    NDArrayPrints();
                }
            }
            tangkap (Exception ex)
            {
                Print($"Kesalahan: {ex.Message}");
                jika (ex.InnerException != null)
                {
                    Print($"Inner Exception: {ex.InnerException.Message}");
                    lempar;
                }
            }
        }

        private float[,] GetDataSet()
        {
            int startBar = Bars.ClosePrices.Count - BarsRequired;
            float[,] inputSignals = new float[BarsRequired, 5];

            for (int i = 0; i < BarsRequired; i++)
            {
                int barIndex = startBar + i;
                inputSignals[i, 0] = (float)Bars.OpenPrices[barIndex];
                inputSignals[i, 1] = (float)Bars.HighPrices[barIndex];
                inputSignals[i, 2] = (float)Bars.LowPrices[barIndex];
                inputSignals[i, 3] = (float)Bars.ClosePrices[barIndex];
                inputSignals[i, 4] = (float)Bars.TickVolumes[barIndex];
            }
            return inputSignals;
        }
        
        private float[,] GetTargetDataSet()
        {
            int startBar = Bars.ClosePrices.Count - BarsRequired;
            float[,] inputSignals = new float[BarsRequired, 5];

            for (int i = 0; i < BarsRequired; i++)
            {
                int barIndex = startBar + i;
                inputSignals[i, 0] = (float)Bars.OpenPrices[barIndex];
                inputSignals[i, 1] = (float)Bars.HighPrices[barIndex];
                inputSignals[i, 2] = (float)Bars.LowPrices[barIndex];
                inputSignals[i, 3] = (float)Bars.ClosePrices[barIndex];
                inputSignals[i, 4] = (float)Bars.TickVolumes[barIndex];
            }
            return inputSignals;
        }
        
        /// Cetakan Pembagian Data NumSharp
        public void DataSplitPrints()
        {
            // Mengubah bentuk data input agar sesuai dengan bentuk input yang diharapkan model
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("Input NDarray: " + string.Join(", ", inputData));
            
            // Mengubah bentuk data target agar sesuai dengan bentuk target yang diharapkan model
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("Target NDarray: " + string.Join(", ", targetData));
            
            // Membagi data menjadi set pelatihan dan pengujian
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% untuk pengujian
            var (x_train, x_test) = (inputData[$":{inputData.shape[0] - testSize}"], inputData[$"{inputData.shape[0] - testSize}:"]);
            var (y_train, y_test) = (targetData[$":{targetData.shape[0] - testSize}"], targetData[$"{targetData.shape[0] - testSize}:"]);
            
            Print("Data X_train: " + string.Join(", ", x_train));
            Print("Data X_test: " + string.Join(", ", x_test));
            Print("Data Y_train: " + string.Join(", ", y_train));
            Print("Data Y_test: " + string.Join(", ", y_test));
        }
        
        /// Cetakan PandasNet
        public void PandasPrints()
        {
            // Mengonversi float[,] ke List<Series>
            var inputData = GetDataSet();
            var targetData = GetTargetDataSet();
            
            var inputSeriesList = new List<Series>();
            var targetSeriesList = new List<Series>();
            
            for (int col = 0; col < inputData.GetLength(1); col++)
            {
                List<float> columnData = new List<float>();
                for (int row = 0; row < inputData.GetLength(0); row++)
                {
                    columnData.Add(inputData[row, col]);
                }
                inputSeriesList.Add(new Series(columnData.ToArray()));
            }
            
            for (int col = 0; col < targetData.GetLength(1); col++)
            {
                List<float> columnData = new List<float>();
                for (int row = 0; row < targetData.GetLength(0); row++)
                {
                    columnData.Add(targetData[row, col]);
                }
                targetSeriesList.Add(new Series(columnData.ToArray()));
            }
            
            // Membuat DataFrame
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("DataFrame Input: " + inputDataFrame);
            Print("DataFrame Target: " + targetDataFrame);
            
            //Print("DataFrame Input: " + string.Join(", ", inputDataFrame));
            //Print("DataFrame Target: " + string.Join(", ", targetDataFrame));
        }
        
        /// Cetakan NDArrays NumSharp Sederhana
        public void NDArrayPrints()
        {
            jika (Bars.ClosePrices.Count < BarsRequired)
                kembali;

            coba
            {
                // Memanggil Data Input float[,] Anda
                float[,] inputData = GetDataSet();

                // Mengonversi ke NDArray dan mengubah bentuk menjadi (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Data NumSharp NDarray Input : " + string.Join(", ", inputNDArray));
                Print("Bentuk NumSharp NDarray Input: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Panjang NumSharp NDarray yang Diharapkan: {expectedLength}");
                Print($"Ukuran NumSharp NDarray Input: {inputNDArray.size}");

                jika (inputNDArray.size != expectedLength)
                {
                    Print($"Ketidaksesuaian Panjang: Panjang yang Diharapkan {expectedLength}, tetapi mendapatkan Ukuran {inputNDArray.size}");
                    kembali;
                }
            }
            tangkap (Exception ex)
            {
                Print("Exception: " + ex.Message);
                Print("StackTrace: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Inner Exception: " + innerException.Message);
                    Print("Inner Exception StackTrace: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Profil trading
0.0
Ulasan: 0
Ulasan pelanggan
Belum ada ulasan untuk produk ini. Sudah mencobanya? Jadilah pemberi ulasan pertama!
AI
Produk-produk yang tersedia melalui cTrader Store, termasuk bot trading, indikator, dan plugin, disediakan oleh pengembang pihak ketiga serta hanya ditujukan untuk akses teknis dan informasi. cTrader Store bukan broker dan tidak menyediakan saran investasi, rekomendasi pribadi, atau jaminan apa pun tentang kinerja di masa mendatang.

Produk lain dari penulis ini

Indikator
E7 Volume Profile, more modern look and feel.
Indikator
Prop
E7 BBKG indicator with 80% plus accuracy used to show both, possible reversal and trend.
Indikator
Polynomial Regression Channel which also reflects the volatility of the underlying asset.
Indikator
E7 Harmonic Structures Basic.
Indikator
E7 Correlation Dashboard.
Indikator
Bollinger
Bollinger Band Cloud, Heiken Ashi, Trend Follower and Parabolic SAR.
Indikator
Indices
Option pricing using the BlackScholes model and the Math.Numerics packages
Indikator
Bollinger
ADXR, KDJ, SineWave, Bollinger Band Volatility and AEOscillator.

Anda mungkin juga suka

cBot
Forex
cTrader Profit Defender: Safeguard Your Gains with Advanced Trailing Stops.
cBot
AI
RSI
+2
HannibalScalpLiteAI – A reliable scalping bot for EUR/USD (M1) using EMA, RSI, and COG indicators. Designed for simplici
cBot
DreamProfitFXBot hunts pips daily with precision, filters out noise, and locks profits fast. Built for sharp day-traders
cBot
AI
Forex
+4
Trend Following Strategy with adjustment Risk Management PLEASE ENJOY!!
10.9%
ROI
3.2
Faktor laba
17%
Drawdown maks
cBot
ATR
No Overtrading
+3
Intelligent negotiations and analysis PRO!
21.2%
ROI
3
Faktor laba
2%
Drawdown maks
cBot
Volume
Key Levels
Export OHLC data from any backtest to CSV. Works on Candles, Renko, Tick, Range. Perfect for external analysis.
cBot
Forex
EURUSD
+3
BtxScalper Final Trial Day15
cBot
RSI
Grid
+5
This production version of Dragon Money Forex Pro
cBot
RSI
Forex
+3
Wealthcraft Auto Profit is a smart trading robot with Auto Stop-Loss, Trailing Stop, and maximum profit management
cBot
NZDUSD
// AUD/NZD - 2MIN TIMEFRAME // 5 YEARS BACKTEST, PROFIT 1500 USD, DRAWDOWN ABOUT 50 USD (RISKY TRADES - NO SL)
cBot
Prop
Forex
+11
Risk On Trade Lite | Auto Position Size Calculator for cTrader | Risk & Reward Tool | Auto Lot Size Calculator
cBot
RSI
MACD
+7
XAU Session Trend Sniper ⚡️Gold M1 scalper with smart trend filter, ATR SL/TP & session logic – no grid, no martingale
cBot
RSI
MACD
+3
N.B.: Results with an initial invested capital of 100 euros.
cBot
Key Levels
SL Manager
+4
Multi-symbol dashboard with 3 fixed charts, dynamic position slots ranked by profit, Ratio analysis, MZ phase detection
cBot
Forex
Martingale
GBP/USD 1 min. ONE MONTH FREE TRIAL
cBot
MACD
Forex
+5
CRT Trading_bot
100%
ROI
2.13
Faktor laba
23.59%
Drawdown maks
cBot
Prop
Forex
+5
PivotPointsBot, leveraging the time-tested pivot point strategy!
cBot
Channel
SL Manager
+4
cTrader to Telegram trade notifier with custom message formats, risk alerts, and an on-chart dashboard.
Sejak 18/12/2024
2
Penjualan
4.11K
Instal gratis