present
Đăng ký và nhận ưu đãi $50 cho lần mua đầu tiên
Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
E7 BBKG NumSharp Sample
cBot
281 lượt tải
Phiên bản 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Kể từ 18/12/2024
2
Lượt bán
4.43K
Cài đặt miễn phí

Mô tả

Theo yêu cầu của nhiều bạn, chúng tôi hiện đang làm việc chăm chỉ để cung cấp các ví dụ về một số mã và gói học máy của chúng tôi.

TensorFlow, PyTorch, Keras, Numpy, Pandas và nhiều gói .NET khác để bắt đầu bên trong cTrader.

Sứ mệnh của chúng tôi là làm cho Machine Learning trong cTrader trở nên dễ dàng hơn cho mọi người.

Chúc bạn săn tìm vui vẻ!

*** Mã này không giao dịch gì cả (nó chỉ in ra dữ liệu, v.v.). Đây chỉ là mã mẫu về cách bạn có thể bắt đầu tạo các mô hình AI của riêng mình bằng cách sử dụng các gói Machine Learning của chúng tôi.

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

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("Phiên bản 1.01", DefaultValue = "Version 1.01")]
        public string Version { get; set; }

        [Parameter("Nguồn")]
        public DataSeries Source { get; set; }

        [Parameter("Số lượng Bars cần thiết", DefaultValue = 50, MinValue = 1, MaxValue = 10000, Step = 1)]
        public int BarsRequired { get; set; }

        [Parameter("Tên phương pháp", DefaultValue = MethodName.DataSplitPrints)]
        public MethodName Mode { get; set; }
        public enum MethodName
        {
            DataSplitPrints,
            PandasPrints,
            NDArrayPrints
        }
        
        protected override void OnStart()
        {
            // Khởi tạo bất kỳ chỉ báo nào
        }

        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($"Lỗi: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Lỗi bên trong: {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;
        }
        
        /// In dữ liệu NumSharp Data Split
        public void DataSplitPrints()
        {
            // Định dạng lại dữ liệu đầu vào để phù hợp với hình dạng đầu vào mong đợi của mô hình
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("NDarray đầu vào: " + string.Join(", ", inputData));
            
            // Định dạng lại dữ liệu mục tiêu để phù hợp với hình dạng mục tiêu mong đợi của mô hình
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("NDarray mục tiêu: " + string.Join(", ", targetData));
            
            // Chia dữ liệu thành tập huấn luyện và kiểm tra
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% cho kiểm tra
            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("Dữ liệu X_train: " + string.Join(", ", x_train));
            Print("Dữ liệu X_test: " + string.Join(", ", x_test));
            Print("Dữ liệu Y_train: " + string.Join(", ", y_train));
            Print("Dữ liệu Y_test: " + string.Join(", ", y_test));
        }
        
        /// In dữ liệu PandasNet
        public void PandasPrints()
        {
            // Chuyển đổi float[,] thành 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()));
            }
            
            // Tạo DataFrames
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("DataFrame đầu vào: " + inputDataFrame);
            Print("DataFrame mục tiêu: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// In dữ liệu NumSharp NDArray đơn giản
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Gọi dữ liệu đầu vào float[,]
                float[,] inputData = GetDataSet();

                // Chuyển đổi sang NDArray và định dạng lại thành (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Dữ liệu NumSharp NDarray đầu vào : " + string.Join(", ", inputNDArray));
                Print("Hình dạng NumSharp NDarray đầu vào: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Độ dài NumSharp NDarray mong đợi: {expectedLength}");
                Print($"Kích thước NumSharp NDarray đầu vào: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Không khớp độ dài: Độ dài mong đợi {expectedLength}, nhưng nhận được kích thước {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Ngoại lệ: " + ex.Message);
                Print("Dấu vết ngăn xếp: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Ngoại lệ bên trong: " + innerException.Message);
                    Print("Dấu vết ngăn xếp ngoại lệ bên trong: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Tóm tắt

Tóm tắt 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.
Hồ sơ giao dịch

Đánh giá của khách hàng

0.0
Đánh giá: 0
Đánh giá của khách hàng
Sản phẩm này chưa có đánh giá nào. Bạn đã dùng thử chưa? Hãy là người đầu tiên chia sẻ với mọi người!

Thảo luận

Câu hỏi thường gặp

AI
Các sản phẩm có sẵn trên cTrader Store, bao gồm bot giao dịch, chỉ báo và plugin, được cung cấp bởi các nhà phát triển bên thứ ba và chỉ nhằm mục đích cung cấp thông tin và tiếp cận kỹ thuật. cTrader Store không phải là nhà môi giới và không cung cấp lời khuyên đầu tư, khuyến nghị cá nhân hay bất kỳ đảm bảo nào về hiệu suất trong tương lai.

Sản phẩm khác của tác giả này

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

Bạn cũng có thể thích

cBot
FiboSmart cBot automates Fibonacci-based trading with trend, RSI, and MACD filters, plus built-in money management, trai
cBot
ATR
Signal
+1
✨ N.B.: Results with an initial invested capital of 100 euros.📈
cBot
Forex
Crypto
+5
Professional execution engine for the Visual Risk Terminal. Instant batch orders, PnL syncing, and automated hedging.
1
Hệ số lợi nhuận
cBot
Volume
Key Levels
+4
Automate open orders with smart grid lines, DCA scaling, Martingale multipliers, and safe zone recovery.
cBot
ATR
XAUUSD
+2
Long-only trend-following cBot for XAUUSD using EMA cross entries, ATR-based risk management, and pyramiding into strong
18.6%
ROI
1.59
Hệ số lợi nhuận
cBot
ATR
Grid
+3
QuantumLimit - XAUUSD/BTCUSD - up to 100 000 %+ cumulative ROI
cBot
GBPUSD
Indices
fixed bug
cBot
AI
ATR
+26
Review and User Guide: PROP Account Guardian Pro cBot 🛡️
cBot
BOS
CHOCH
+5
Ai_SMC Trading Robot v2 – Precision Smart Money Concept Automation
1.4
Hệ số lợi nhuận
cBot
Fibonacci
TP Manager
+2
Harmonic Patterns Bots and Indicator: Automation and Precision
14.4%
ROI
2.5
Hệ số lợi nhuận
cBot
Prop
Forex
+11
A Fintech-Engineered Investment Opportunity in Algorithmic Gold Trading
cBot
AI
ADX
+5
Gold Scalper Pro XAU M15 – Release Notes Version 2.0 – ATR‑Based Scalping Robot for XAU/USD
2.34
Hệ số lợi nhuận
cBot
ATR
Grid
+3
“University-Built Gold–Silver Arbitrage Bot: +439k USD with 5k Capital (backtest in 3 years)”
2
Hệ số lợi nhuận
cBot
Indices
DAX BOT FOR INTRADAY TRADING
cBot
Forex
EURUSD
+5
EasyPass ProFirm Wizard
cBot
SL Manager
TP Manager
+4
Fast manual execution + automatic TP/SL management in one powerful cTrader trading panel.

Giá

Kể từ 18/12/2024
2
Lượt bán
4.43K
Cài đặt miễn phí