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
ADX
ATR
+5
Ai_GoldScalperPro XAU M15 รขย€ย“ Premium Scalping Robot for cTrader
7.9%
ROI
1.92
Faktor keuntungan
cBot
Breakout
Powerfull and Optimized strategy based on the "Opening Range Breakout" on the 15 min chart.
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
AI
Scalp you rich!
cBot
Signal
Bollinger
This cBot uses a combination of Heikin Ashi and Bollinger Bands strategies.
cBot
Prop
News Timer Bot
cBot
ATR
NAS100
+5
A trading robot designed for traders who want precision for high-volatility markets (XAUUSD, US500, US100, WTI, others.)
cBot
ATR
EMA
+5
Smart Trading Bot with Rich Management Tools for FOREX PAIRS, NASDAQ, GOLD, OIL
14.4%
ROI
1.38
Faktor keuntungan
cBot
BTCUSD
Automated cTrader bot with webhook support, trade management, take-profit levels, and Telegram notifications
cBot
XAUUSD
Engulfing Pattern cBot Pro: Smart candlestick trading with filters, risk control & daily protection.
231.4%
ROI
1.32
Faktor keuntungan
cBot
Prop
Forex
+4
cBot designed to assist traders in managing position risk effectively.
cBot
Trailing Stop
Break & Retest
+4
Smart Trade H4 Breakout Matrix (lower trader, higher accuracy)
3.73
Faktor keuntungan
cBot
Prop
Forex
+11
๐Ÿฆ– T-Rex Risk Guardian - your personal T-Rex that protects your account ๐Ÿฆ–
cBot
Trade fearlessly: auto-adjusts stops, manages risk, and locks profits with precision
cBot
AI
SMC
+18
RISK SHIELD VERSION 2.0 - Smart Risk Manager for cTrader
cBot
Trend strategy Algorithm 20 DAYS DEMO .,risk/reward ratio (R/R) of 1:2 ,efficient risk management.
cBot
Conservative
Grid Recovery
Ziggy, an advanced algorithm designed to maximize efficiency and simplify profit control.

Harga

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