Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
cBot
243 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.18K
Instalações gratuitas

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;
                }
            }
        }
    }
}

Perfil de negociação
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!
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
EMA
SL Manager
+5
Fully automated dual-symbol hedging cBot for cTrader.
20.6%
ROI
8.66
Fator de lucro
cBot
Partial Close
Prop Firm Fit
+5
Trade Management with pre program desire scaling, lot increase, TP placement, Trilling and $ value stop for loss/gain
cBot
Fixed Risk %
Risk/Reward
+3
Total passive trading control. One click Stop Loss and Take Profit. Breakeven and Goal line. Set it. Protect it. Profit.
cBot
XAUUSD
Martingale
IBC Advanced Strategy - IBC高级策略,基于马丁策略的优化版本,添加止损配置
cBot
Aggressive
Key Levels
+1
Grid key Level fast Clickers for XAUUSD only
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
Fator de lucro
cBot
XAUUSD
Scalping
Precision Scalper,XAUUSD ,Averages that functions like a multidimensional radar:
cBot
Grid
Forex
+11
Semi bot will manage your position by moving stoploss and cover loss with 3 martingale style
cBot
XAUUSD
Commodities
Gold-Silver Pair Trading Strategy (free version)
cBot
ATR
Forex
+3
Trade fearlessly: auto-adjusts stops, manages risk, and locks profits with precision. Free for early users🚀 now -80%
cBot
Forex
Crypto
+4
Creates buy limit orders automatically when the market drops.
cBot
RSI
Aggressive
automates entries based on the RSX indicator — a smoothed, low-lag variant of the classic RSI.
1.67
Fator de lucro
cBot
ATR
SL Manager
+3
Este cBot está diseñado para operar rupturas de rango en BTCUSD con una logica simple
49.6%
ROI
1.44
Fator de lucro
cBot
AI
ATR
+5
No guessing — just confirmed breakouts, smart risk management, and disciplined execution. Less noise. More direction.
28.5%
ROI
4.44
Fator de lucro
cBot
AI
ATR
+9
Gold Predict AI – Advanced Predictive Trading for XAUUSD (M15)
cBot
RSI
Forex
+2
N.B.: Results with an initial invested capital of 100 euros.
cBot
AI Trading
Drawdown Guard
+2
Intelligent Automated Trading (Gold, Forex, commodities)
1.97
Fator de lucro
Desde 18/12/2024
2
Vendas
4.18K
Instalações gratuitas