E7 BBKG NumSharp Sample
cBot
262 descargas
Versión 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Desde 18/12/2024
2
Ventas
4.26K
Instalaciones gratis

Descripción

Como muchos de ustedes solicitaron, ahora estamos trabajando arduamente para proporcionar ejemplos de algunos de nuestros códigos y paquetes de aprendizaje automático.

TensorFlow, PyTorch, Keras, Numpy, Pandas y muchos más paquetes .NET para comenzar dentro de cTrader.

Nuestra misión es hacer que el aprendizaje automático dentro de cTrader sea más fácil para todos.

¡Buena caza!

*** Este código no realiza operaciones (solo imprime datos, etc.). Es simplemente un código de ejemplo de cómo puedes comenzar a crear tus propios modelos de IA usando nuestros paquetes de aprendizaje automático.

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

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ón 1.01", DefaultValue = "Versión 1.01")]
        public string Version { get; set; }

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

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

        [Parameter("Nombre del Método", DefaultValue = MethodName.DataSplitPrints)]
        public MethodName Mode { get; set; }
        public enum MethodName
        {
            DataSplitPrints,
            PandasPrints,
            NDArrayPrints
        }
        
        protected override void OnStart()
        {
            // Inicializar cualquier indicador
        }

        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($"Error: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Excepción Interna: {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;
        }
        
        /// Impresiones de división de datos de NumSharp
        public void DataSplitPrints()
        {
            // Remodelar los datos de entrada para que coincidan con la forma esperada por el modelo
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("NDarray de entrada: " + string.Join(", ", inputData));
            
            // Remodelar los datos objetivo para que coincidan con la forma objetivo esperada por el modelo
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("NDarray objetivo: " + string.Join(", ", targetData));
            
            // Dividir los datos en conjuntos de entrenamiento y prueba
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% para pruebas
            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("Datos X_train: " + string.Join(", ", x_train));
            Print("Datos X_test: " + string.Join(", ", x_test));
            Print("Datos Y_train: " + string.Join(", ", y_train));
            Print("Datos Y_test: " + string.Join(", ", y_test));
        }
        
        /// Impresiones de PandasNet
        public void PandasPrints()
        {
            // Convertir float[,] a 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()));
            }
            
            // Crear DataFrames
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("DataFrame de entrada: " + inputDataFrame);
            Print("DataFrame objetivo: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Impresiones simples de NDArray de NumSharp
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Llamando a tus datos de entrada float[,]
                float[,] inputData = GetDataSet();

                // Convertir a NDArray y remodelar a (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Datos de NDarray NumSharp de entrada : " + string.Join(", ", inputNDArray));
                Print("Forma de NDarray NumSharp de entrada: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Longitud esperada de NDarray NumSharp: {expectedLength}");
                Print($"Tamaño de NDarray NumSharp de entrada: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Desajuste de longitud: longitud esperada {expectedLength}, pero se obtuvo tamaño {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Excepción: " + ex.Message);
                Print("Rastro de pila: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Excepción interna: " + innerException.Message);
                    Print("Rastro de pila de excepción interna: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Resumen

Resumen de IA
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.
Perfil de operaciones

Valoraciones de clientes

0.0
Valoraciones: 0
Valoraciones de clientes
Este producto todavía no se ha valorado. ¿Ya lo ha probado? Sea el primero en informar a otros.

Conversación

Preguntas frecuentes

AI
Los productos disponibles a través de cTrader Store, incluidos bots, indicadores y plugins para operar, son proporcionados por desarrolladores de terceros y están disponibles únicamente con fines informativos y de acceso técnico. cTrader Store no es un bróker, por lo que no proporciona asesoramiento de inversión, recomendaciones personales ni ninguna garantía de rentabilidad futura.

Más de este autor

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

Puede interesarle

cBot
Forex
Crypto
+3
This is a cBot that will detect trendlines on the chart and open trades when the price interacts with them.
cBot
RSI
MACD
+3
N.B.: Results with an initial invested capital of 100 euros.
cBot
Forex
BTCUSD
+4
OneClick SL/TP Setter — Smart Trade Management Made Simple
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
Factor de beneficio
cBot
ADX
ATR
+5
Ai_GoldScalperPro XAU M15 – Premium Scalping Robot for cTrader
7.9%
ROI
1.92
Factor de beneficio
cBot
Channel
SL Manager
+4
cTrader to Telegram trade notifier with custom message formats, risk alerts, and an on-chart dashboard.
cBot
AI
ATR
+27
A smart trailing-stop tool that protects profits and tightens risk automatically for all your manual trades.
cBot
Break Even
Conservative
+5
FREE backtest-only. Reproduce Guardian's +115.9% in your own cTrader - no grid, no martingale. REAL INSTITUTIONAL EDGE
1.55
Factor de beneficio
cBot
AI
Forex
+4
Trend Following Strategy with adjustment Risk Management PLEASE ENJOY!!
10.9%
ROI
3.2
Factor de beneficio
cBot
ATR
EMA
+5
Momentum driven, Compounding. Volatility adaptive EMA BOLLINGER ATR base Strategy
93.4%
ROI
1.31
Factor de beneficio
cBot
Key Levels
Spread Filter
+3
MATRIX INFINITY, See Beyond the Market.
22.3%
ROI
31
Factor de beneficio
cBot
AI
ATR
+27
TrustGuard - Simple, Smart Account Protection for cTrader
cBot
AI
ATR
+7
MR KRABS XAU 🦀🟡 — smart gold grid trading with ATR spacing, tight risk, and basket take-profit. 🎯
cBot
// XAU/USD 1H TIMEFRAME // 5 YEARS BACKTEST, PROFIT 2100 USD, DRAWDOWN MAX 195 USD 
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
Factor de beneficio
cBot
RSI
Aggressive
automates entries based on the RSX indicator — a smoothed, low-lag variant of the classic RSI.
1.67
Factor de beneficio
cBot
Forex
Robô Forex para cTrader: opera no M5 com precisão, disciplina e estratégias inteligentes.
cBot
Grid
Forex
+2
Resolver Algo Bot,Sophisticated, Perfect algorithm ! Daily ROI 5 to 24%.

Precio

Desde 18/12/2024
2
Ventas
4.26K
Instalaciones gratis