present
Registrati e ricevi uno sconto da $50 sul tuo primo acquisto
Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
E7 BBKG NumSharp Sample
cBot
276 download
Versione 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Da 18/12/2024
2
Vendite
4.36K
Installazioni gratuite

Descrizione

Come richiesto da molti di voi, ora stiamo lavorando duramente per fornire esempi di alcuni dei nostri codici e pacchetti di machine learning.

TensorFlow, PyTorch, Keras, Numpy, Pandas e molti altri pacchetti .NET per iniziare all'interno di cTrader.

La nostra missione è rendere il Machine Learning all'interno di cTrader più facile per tutti.

Buona caccia!

*** Questo codice non esegue alcuna operazione di trading (stampa solo dati ecc.). È semplicemente un codice di esempio su come puoi iniziare a creare i tuoi modelli AI utilizzando i nostri pacchetti di Machine Learning.

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

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

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

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

        [Parameter("Method Name", DefaultValue = MethodName.DataSplitPrints)]
        public MethodName Mode { get; set; }
        public enum MethodName
        {
            DataSplitPrints,
            PandasPrints,
            NDArrayPrints
        }
        
        protected override void OnStart()
        {
            // Inizializza eventuali indicatori
        }

        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($"Errore: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Eccezione 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;
        }
        
        /// Stampa NumSharp Data Split
        public void DataSplitPrints()
        {
            // Rimodella i dati di input per corrispondere alla forma di input prevista dal modello
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("NDarray di input: " + string.Join(", ", inputData));
            
            // Rimodella i dati target per corrispondere alla forma target prevista dal modello
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("NDarray target: " + string.Join(", ", targetData));
            
            // Dividi i dati in set di addestramento e di test
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% per il test
            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("Dati X_train: " + string.Join(", ", x_train));
            Print("Dati X_test: " + string.Join(", ", x_test));
            Print("Dati Y_train: " + string.Join(", ", y_train));
            Print("Dati Y_test: " + string.Join(", ", y_test));
        }
        
        /// Stampa PandasNet
        public void PandasPrints()
        {
            // Converti float[,] in 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()));
            }
            
            // Crea DataFrame
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("DataFrame di input: " + inputDataFrame);
            Print("DataFrame target: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Semplici stampe NumSharp NDArrays
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Chiamata ai tuoi dati di input float[,]
                float[,] inputData = GetDataSet();

                // Converti in NDArray e rimodella in (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Dati NDarray NumSharp di input : " + string.Join(", ", inputNDArray));
                Print("Forma NDarray NumSharp di input: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Lunghezza NDarray NumSharp prevista: {expectedLength}");
                Print($"Dimensione NDarray NumSharp di input: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Disallineamento lunghezza: Lunghezza prevista {expectedLength}, ma dimensione ottenuta {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Eccezione: " + ex.Message);
                Print("StackTrace: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Eccezione Interna: " + innerException.Message);
                    Print("StackTrace Eccezione Interna: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Riepilogo

Riepilogo 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.
Profilo di trading

Recensioni dei clienti

0.0
Recensioni: 0
Recensioni dei clienti
Questo prodotto non ha ancora ricevuto recensioni. L'hai già provato? Fallo sapere agli altri per primo!

Discussioni

Domande frequenti

AI
I prodotti disponibili tramite cTrader Store, inclusi bot di trading, indicatori e plugin, sono forniti da sviluppatori terzi e resi disponibili esclusivamente a scopo informativo e di accesso tecnico. cTrader Store non è un broker e non fornisce consulenze in materia di investimento, raccomandazioni individualizzate o garanzie di risultati futuri.

Altro da questo autore

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

Potrebbe interessarti anche

cBot
AI
MACD
+5
World First AI Trading now with Fibonacci Strategy Please ENJOY!! Adjust to suit your own strategy and risk management
9%
ROI
3.9
Fattore di profitto
cBot
ATR
Indices
🚀N.B.: Results with an initial invested capital of 100 euros.
cBot
EMA
RSI
+5
EURUSD M30 trend-pullback cBot with ATR exits and strict daily/weekly risk controls.
1.83
Fattore di profitto
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
Forex
EURUSD
+5
EMBER is a breakout robot designed around one of the most respected price action patterns in trading.
cBot
RSI
MACD
+2
Chart Patterns Algo Bot
cBot
AI
ATR
+27
The Prop-Ready Bot The Definitive Automaton for Challenges 🛡️ V2.0
cBot
RSI
Indices
This bot is made of Fibonacci, EMA and RSI.
cBot
ATR
Forex
EMA-Crossover-Bot mit ADX-Filter:Trend-Trading mit ATR-basiertem Risikomanagement und Trailing Stop.
cBot
Forex
BTCUSD
+13
Automatically manages Stop Loss and Take Profit using Support & Resistance levels, with intelligent trailing stop protec
cBot
check my other bots for better profts.
cBot
Forex
EURUSD
+3
BtxScalper Final Trial Day15
cBot
SL Manager
Break Even
+4
FRACTAL STOP LOSS BOT AND RISK MANAGER
cBot
Volume
Equity Stop
+5
M-Algo EURUSD M1 PRO is a recovery/grid cBot for EURUSD M1 with 4 sizing modes and advanced risk controls.
1.67
Fattore di profitto
cBot
Fixed Lot
Key Levels
+5
Copy signals to cTrader with auto execution, advanced risk management, and stealth mode.
cBot
NajihFx Demo and Backtesting Only
cBot
AI
Forex
+4
A Trend Master AI, Suitable for more advance pro trader with fully customisation and risk control PLEASE ENJOY!!
10.9%
ROI
4
Fattore di profitto
cBot
ATR
RSI
+17
The Swiss Army Knife cBot is a multi-tool trading robot that combines 10 of the most popular technical indicators

Prezzo

Da 18/12/2024
2
Vendite
4.36K
Installazioni gratuite