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
ADX
EMA
+5
Apex CFX - NAS100 Control is a structured automated trading cBot designed for NAS100 / Nasdaq 100, using EMA alignment,
15%
ROI
5.1
Fator de lucro
cBot
Conservative
Grid Recovery
Ziggy, an advanced algorithm designed to maximize efficiency and simplify profit control.
cBot
ATR
EMA
+5
Momentum driven, Compounding. Volatility adaptive EMA BOLLINGER ATR base Strategy
93.4%
ROI
1.31
Fator de lucro
cBot
XAUUSD
Engulfing Pattern cBot Pro: Smart candlestick trading with filters, risk control & daily protection.
231.4%
ROI
1.32
Fator de lucro
cBot
BTCUSD
Automated cTrader bot with webhook support, trade management, take-profit levels, and Telegram notifications
cBot
// EUR/USD 4H TIMEFRAME // 5 YEARS BACKTEST, PROFIT 176 USD, MAX DRAWDOWN 55 USD
cBot
ATR
Forex
EMA-Crossover-Bot mit ADX-Filter:Trend-Trading mit ATR-basiertem Risikomanagement und Trailing Stop.
cBot
Prop
Forex
+4
cBot designed to assist traders in managing position risk effectively.
cBot
Forex
NAS100
+5
Session-based trading bot with intelligent trailing stops. Captures Asia range, trades London/NY breakouts
8.86
Fator de lucro
cBot
RSI
Forex
+2
N.B.: Results with an initial invested capital of 100 euros.
cBot
AI
ATR
+27
TRIAL 7 DAYS ONLY DEMO ACCOUNT Review and User Guide: PROP Account Guardian Pro cBot 🛡️
4
Fator de lucro
cBot
Grid Recovery
TheBestBotForXAUUSDSuperProfits DEMO
19.6%
ROI
50
Fator de lucro
cBot
XAUUSD
Commodities
Gold Sclaper V2 Demo – The Initial Release of the Intelligent Trading Bot
cBot
Grid Recovery
UltraGrid PRO DEMO Portfolio Advanced Trend-Following Grid System
1003.9%
ROI
1.22
Fator de lucro
cBot
AI
ATR
+13
Multi-indicator scalping bot with concurrent trade management, and adaptive risk controls for professional forex trading
cBot
AI Trading
Drawdown Guard
+2
Intelligent Automated Trading (Gold, Forex, commodities)
1.97
Fator de lucro
cBot
MACD
Commodities
This bot can automatically generate buy and sell orders based on three specific Fixed bugs.
Desde 18/12/2024
2
Vendas
4.18K
Instalações gratuitas