present
Registe-se e receba 50 $ de desconto na sua primeira compra
Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
E7 BBKG NumSharp Sample
cBot
285 transferências
Versão 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Desde 18/12/2024
2
Vendas
4.47K
Instalações gratuitas

Descrição

Como solicitado por muitos de vocês, agora estamos trabalhando arduamente para fornecer exemplos de alguns de nossos códigos e pacotes de aprendizado de máquina.

TensorFlow, PyTorch, Keras, Numpy, Pandas e muitos outros pacotes .NET para começar dentro do cTrader.

Nossa missão é tornar o Aprendizado de Máquina dentro do cTrader mais fácil para todos.

Boa caça!

*** Este código não realiza nenhuma negociação (ele apenas imprime dados etc). É simplesmente um código de exemplo de como você pode começar a criar seus próprios modelos de IA usando nossos pacotes de Aprendizado de Máquina.

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

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("Versão 1.01", DefaultValue = "Versão 1.01")]
        public string Version { get; set; }

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

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

        [Parameter("Nome do Método", DefaultValue = MethodName.DataSplitPrints)]
        public MethodName Mode { get; set; }
        public enum MethodName
        {
            DataSplitPrints,
            PandasPrints,
            NDArrayPrints
        }
        
        protected override void OnStart()
        {
            // Inicialize quaisquer indicadores
        }

        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($"Erro: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Exceção 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;
        }
        
        /// Impressões de Divisão de Dados do NumSharp
        public void DataSplitPrints()
        {
            // Reformate os dados de entrada para corresponder à forma esperada pelo modelo
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("NDarray de Entrada: " + string.Join(", ", inputData));
            
            // Reformate os dados alvo para corresponder à forma alvo esperada pelo modelo
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("NDarray Alvo: " + string.Join(", ", targetData));
            
            // Divida os dados em conjuntos de treinamento e teste
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% para teste
            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("Dados X_train: " + string.Join(", ", x_train));
            Print("Dados X_test: " + string.Join(", ", x_test));
            Print("Dados Y_train: " + string.Join(", ", y_train));
            Print("Dados Y_test: " + string.Join(", ", y_test));
        }
        
        /// Impressões do PandasNet
        public void PandasPrints()
        {
            // Converta float[,] para 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()));
            }
            // Crie DataFrames
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("DataFrame de Entrada: " + inputDataFrame);
            Print("DataFrame Alvo: " + targetDataFrame);
            
            //Print("DataFrame de Entrada: " + string.Join(", ", inputDataFrame));
            //Print("DataFrame Alvo: " + string.Join(", ", targetDataFrame));
        }
        
        /// Impressões Simples de NDArrays do NumSharp
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Chamando seus dados de entrada float[,]
                float[,] inputData = GetDataSet();

                // Converta para NDArray e reformate para (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Dados NDarray NumSharp de Entrada : " + string.Join(", ", inputNDArray));
                Print("Forma do NDarray NumSharp de Entrada: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Comprimento Esperado do NDarray NumSharp: {expectedLength}");
                Print($"Tamanho do NDarray NumSharp de Entrada: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Incompatibilidade de Comprimento: Comprimento Esperado {expectedLength}, mas obteve Tamanho {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Exceção: " + ex.Message);
                Print("Rastreamento de Pilha: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Exceção Interna: " + innerException.Message);
                    Print("Rastreamento de Pilha da Exceção Interna: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Resumo

Resumo 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 negociação

Avaliações de clientes

0.0
Avaliações: 0
Avaliações de clientes
Ainda não há avaliações para este produto. Já o experimentou? Seja o primeiro a contar a outras pessoas!

Conversa

Perguntas frequentes

AI
Os produtos disponíveis através da cTrader Store, incluindo bots de negociação, indicadores e plugins, são fornecidos por programadores terceiros e são disponibilizados apenas para fins informativos e de acesso técnico. A cTrader Store não é um corretor e não fornece aconselhamento em matéria de investimento, recomendações pessoais ou qualquer garantia de desempenho no futuro.

Mais deste 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.

Também poderá gostar de

cBot
AI
ATR
+8
Breakout scalping with prop-firm grade equity control.
cBot
ATR
Auto-manages SL, TP, and position size to enforce risk discipline. Never enter a trade without a plan again.
cBot
AI
Stocks
+1
Advanced Automated SPX Algorithmic Trading System
4
Fator de lucro
cBot
AI
RSI
+5
H1 and L1 BOT — Pure Price Action Automation - NEW VERSION IN PROGRESS...
1.52
Fator de lucro
cBot
ADX
ATR
+5
Automated XAUUSD structure-break and pullback strategy that waits for confirmed breakouts and retests
53.3%
ROI
1.65
Fator de lucro
cBot
this cbot is customarily designed for intuitive traders. who are looking for efficient way to manage their positions.
cBot
ATR
RSI
+5
📊 EMA CROSS COMPLETE BOT - Professional Trading System
2.1
Fator de lucro
cBot
Supertrend
Super tendance
cBot
Bollinger Bands
Bande de Bollinger à configurer soi-même
cBot
MACD
Forex
+1
Smart Trend cBot - Swing6h
cBot
ATR
Forex
EMA-Crossover-Bot mit ADX-Filter:Trend-Trading mit ATR-basiertem Risikomanagement und Trailing Stop.
cBot
BOS
CHOCH
+5
Ai_SMC Trading Robot v2 – Precision Smart Money Concept Automation
1.4
Fator de lucro
cBot
A risk-managed trading bot that automatically closes all positions when a daily profit target is hit or a maximum daily
cBot
Forex
BTCUSD
+9
cBot : Hand Trade Assistant
cBot
Forex
BTCUSD
+11
CandlePatternBot — Trade classic candlestick signals with bull/bear bias and SL/TP or next-pattern exits.
cBot
AI
ATR
+27
RSI Simple Grid cBot - grid trading strategy with RSI (Relative Strength Index) signals
26.8%
ROI
4.41
Fator de lucro

Preço

Desde 18/12/2024
2
Vendas
4.47K
Instalações gratuitas