Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
cBot
239 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.16K
Installazioni gratuite

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

Profilo di trading
0.0
Recensioni: 0
Recensioni dei clienti
Questo prodotto non ha ancora ricevuto recensioni. L'hai già provato? Fallo sapere agli altri per primo!
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
Grid
XAUUSD
+2
🔥 Grid Classic – A Simple Yet Powerful Grid System
cBot
Forex
XAUUSD
GALAXY XAUUSD SCALPER Trial DAY 15
cBot
Breakout
Powerfull and Optimized strategy based on the "Opening Range Breakout" on the 15 min chart.
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
Fattore di profitto
cBot
Forex
NAS100
+5
Session-based trading bot with intelligent trailing stops. Captures Asia range, trades London/NY breakouts
8.86
Fattore di profitto
cBot
Forex
BTCUSD
+5
Intelligent negotiations and analysis!
47.3%
ROI
3
Fattore di profitto
cBot
// XAU/USD 1H TIMEFRAME // 5 YEARS BACKTEST, PROFIT 2100 USD, DRAWDOWN MAX 195 USD 
cBot
GBPUSD
Indices
fixed bug
cBot
AI
BTCUSD
+2
Crossover Bot es un sistema de trading algorítmico actualmente en operación real, currently in live operation.
cBot
// EUR/USD 4H TIMEFRAME // 5 YEARS BACKTEST, PROFIT 176 USD, MAX DRAWDOWN 55 USD
cBot
ATR
RSI
+23
🚀 N.B.: Results with an initial invested capital of 100 euros.🚀 📌 Tested on US2000 with Accurate Prices
cBot
Fixed Lot
VPS Recommended
+3
A high-performance cTrader local trade copier . Copy positions and pending orders between multiple terminals instantly.
cBot
Trade with confidence—control risk accurately and manage orders with speed and clarity.
cBot
Prop Firm Fit
Stop Loss (SL) Manager
+1
HTS Strategy Tester - Advanced Multi-Timeframe Trend & Pullback Trading System H1/m1 & H4/m5 WWS 33/144 Start from 100$
90.1%
ROI
2.92
Fattore di profitto
cBot
Volume
Balanced
+5
An automated utility featuring global drawdown control, basket trailing profit tracking, and custom session filters.
16.4%
ROI
1.55
Fattore di profitto
cBot
ATR
Auto-manages SL, TP, and position size to enforce risk discipline. Never enter a trade without a plan again.
cBot
Grid Recovery
Advanced Grid Trading System with Institutional Trend Detection
17.3%
ROI
2.72
Fattore di profitto
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
Da 18/12/2024
2
Vendite
4.16K
Installazioni gratuite