E7 BBKG NumSharp Sample
cBot
257 muat turun
Versi 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Sejak 18/12/2024
2
Jualan
4.24K
Pemasangan percuma

Penerangan

Seperti yang diminta oleh ramai daripada anda, kami kini sedang bekerja keras untuk menyediakan contoh beberapa kod dan pakej pembelajaran mesin kami.

TensorFlow, PyTorch, Keras, Numpy, Pandas dan banyak lagi pakej .NET untuk memulakan di dalam cTrader.

Misi kami adalah untuk memudahkan Pembelajaran Mesin di dalam cTrader untuk semua orang.

Selamat memburu!

*** Kod ini tidak melakukan sebarang dagangan (ia hanya mencetak data dan sebagainya). Ia hanyalah kod contoh bagaimana anda boleh mula mencipta model AI anda sendiri menggunakan pakej 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("Bar Diperlukan", DefaultValue = 50, MinValue = 1, MaxValue = 10000, Step = 1)]
        public int BarsRequired { get; set; }

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

        protected override void OnBar()
        {
            try
            {
                if (Mode == MethodName.DataSplitPrints)
                {
                    DataSplitPrints();
                }
                else if (Mode == MethodName.PandasPrints)
                {
                    PandasPrints();
                }
                else if (Mode == MethodName.NDArrayPrints)
                {
                    NDArrayPrints();
                }
            }
            catch (Exception ex)
            {
                Print($"Ralat: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Pengecualian Dalaman: {ex.InnerException.Message}");
                    throw;
                }
            }
        }

        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 Pecahan Data NumSharp
        public void DataSplitPrints()
        {
            // Bentuk semula data input untuk memadankan bentuk input yang dijangka oleh model
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("Input NDarray: " + string.Join(", ", inputData));
            
            // Bentuk semula data sasaran untuk memadankan bentuk sasaran yang dijangka oleh model
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("Target NDarray: " + string.Join(", ", targetData));
            
            // Bahagikan data kepada set latihan dan ujian
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% untuk ujian
            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()
        {
            // Tukar float[,] kepada Senarai<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()));
            }
            
            // Cipta DataFrame
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("Input DataFrame: " + inputDataFrame);
            Print("Target DataFrame: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Cetakan NumSharp NDArrays Mudah
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Memanggil Data Input float[,] anda
                float[,] inputData = GetDataSet();

                // Tukar kepada NDArray dan bentuk semula kepada (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 Dijangka: {expectedLength}");
                Print($"Saiz NumSharp NDarray Input: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Panjang Tidak Padan: Panjang Dijangka {expectedLength}, tetapi mendapat Saiz {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Pengecualian: " + ex.Message);
                Print("Jejak Tumpukan: " + ex.StackTrace);

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

Ringkasan

Ringkasan AI
E7 BBKG NumSharp Sample is a cTrader robot providing sample code to demonstrate integration of machine learning libraries within the cTrader environment. It includes examples using .NET packages such as TensorFlow, PyTorch, Keras, NumSharp, and PandasNet. The robot does not execute trades but prints out processed data to illustrate how users can start building AI models for trading analysis.
Key functionalities include:
- Data extraction from market bars (open, high, low, close prices, and tick volumes) over a configurable number of bars.
- Conversion of this data into formats compatible with machine learning workflows, including NumSharp NDArrays and Pandas DataFrames.
- Methods to split data into training and testing sets, and to print these datasets for inspection.
- Three operational modes selectable via parameters: DataSplitPrints, PandasPrints, and NDArrayPrints, each demonstrating different data handling approaches.
This sample code aims to facilitate machine learning development inside cTrader by providing foundational examples of data preparation and manipulation using popular ML libraries in a .NET context.
Profil dagangan

Ulasan pelanggan

0.0
Ulasan: 0
Ulasan pelanggan
Belum ada ulasan untuk produk ini. Anda sudah mencuba produk tersebut? Jadilah yang pertama untuk berkongsi pendapat anda!

Perbincangan

Soalan Lazim

AI
Produk yang tersedia melalui cTrader Store, termasuk bot dagangan, indikator dan plugin, disediakan oleh pembangun pihak ketiga dan diberikan akses untuk tujuan maklumat dan teknikal sahaja. cTrader Store bukan broker dan tidak memberikan nasihat pelaburan, syor peribadi atau sebarang jaminan prestasi masa hadapan.

Lebih banyak produk daripada 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 juga mungkin suka

cBot
AI
ATR
+15
A MAD UNICORN , PLEASE ENJOY!!
9.9%
ROI
3.4
Faktor keuntungan
cBot
Aggressive
Break Even
+1
This is a 2nd Version of "MycBots" swing trading + scalping strategy for XAUUSD and other Symbols.
37%
ROI
1.85
Faktor keuntungan
cBot
ATR
Grid
+11
Automated cTrader robot combining grid strategy, volatility-based TP, and risk protection
cBot
Fixed Risk %
Risk/Reward
+5
One-click fixed-risk execution with a built-in daily loss guard. Made for manual traders and prop challenges.
0.01
Faktor keuntungan
cBot
Forex
Scalping
Special H1-Version of UltimateScalper for EUR/GBP ... win rate 100% ... ROI 830%
cBot
RSI Scalping cBot scalper for volatile indexes.
cBot
Forex
Stocks
+1
The full version includes access to all features and customization options. It is designed for users who require advance
cBot
AI
Stocks
+1
Advanced Automated SPX Algorithmic Trading System
4
Faktor keuntungan
cBot
ADX
ATR
+5
Ai_GoldScalperPro XAU M15 – Premium Scalping Robot for cTrader
7.9%
ROI
1.92
Faktor keuntungan
cBot
EURUSD RE5 PROFITABLE SINCE 2014 # MINIMUMN STARTCAPITAL 150,- EURO
cBot
Forex
BTCUSD
+7
Strategia Spike Estremo Trial Day 15
cBot
AI
ATR
+27
Depth of Market + VIX Bot - Complete Analysis
cBot
Prop Firm Fit
One-click Trading
+3
Watches your equity in real time and blocks new trades the moment you're near your daily or max loss limit.
cBot
AI
Scalp you rich!
cBot
MACD
Forex
+5
CRT Trading_bot
100%
ROI
2.13
Faktor keuntungan
cBot
Trailing Stop
Break & Retest
+4
Smart Trade H4 Breakout Matrix (lower trader, higher accuracy)
3.73
Faktor keuntungan
cBot
Trade fearlessly: auto-adjusts stops, manages risk, and locks profits with precision
cBot
AI
ATR
+13
Multi-indicator scalping bot with concurrent trade management, and adaptive risk controls for professional forex trading

Harga

Sejak 18/12/2024
2
Jualan
4.24K
Pemasangan percuma