Logo di "E7 BBKG NumSharp Sample"
cBot
228 download
Versione 1.0, Feb 2025
Windows, Mac, Mobile, Web
Immagine caricata di "E7 BBKG NumSharp Sample"
Da 18/12/2024
2
Vendite
4.08K
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
ATR
Forex
+2
Auto-Breakeven Bot w/ ATR & dual triggers. Works 100% with Risk Reward Guardian. Was Free for early users now -80%
cBot
ATR
Auto-manages SL, TP, and position size to enforce risk discipline. Never enter a trade without a plan again.
cBot
Forex
BTCUSD
+13
SUPPORT AND RESISTANCE STRATEGY. Master the Market’s Turning Points with Surgical Accuracy. SEE THE FULL BACKTEST. 📈
cBot
Key Levels
SL Manager
+4
Multi-symbol dashboard with 3 fixed charts, dynamic position slots ranked by profit, Ratio analysis, MZ phase detection
cBot
Grid
EURUSD
+1
Renko Chart EURUSD SWINGTRADER PROFITABLE SINCE 2014 # STARTCAPITAL 1200,- EURO
cBot
Volume
Key Levels
Export OHLC data from any backtest to CSV. Works on Candles, Renko, Tick, Range. Perfect for external analysis.
cBot
XAUUSD
Engulfing Pattern cBot Pro: Smart candlestick trading with filters, risk control & daily protection.
231.4%
ROI
1.32
Fattore di profitto
12.87%
Drawdown max
cBot
Versatile Adaptive System, for Scalper, Long trader, HFT
cBot
Perfectly optimized to trade AUDUSD. Over 85% win rate
cBot
Signal
Supertrend
Bot is based on Price Action strategy to open & manage orders. It is effective capital management and high profitability
cBot
Pulse Tick Reactor: AI-powered trading bot delivering precision entries, adaptive risk control, and consistent profits.
cBot
ATR
XAUUSD
+2
Long-only trend-following cBot for XAUUSD using EMA cross entries, ATR-based risk management, and pyramiding into strong
18.6%
ROI
1.59
Fattore di profitto
76.45%
Drawdown max
cBot
📄 Trading_stop Plus DEMO 🧪 DEMO VERSION – LIMITED TO 48 HOURS This is the demo version of Trading_stop Plus. It works
cBot
Prop
Forex
+5
Close 50%, 80% or Custom % , Close Full position and Move Stop to Breakeven buttons plus a floating Profit/loss counter
cBot
Prop
Forex
+3
QuantumGuard - EUR/USD - More than 1000% profit per year
cBot
EMA
SL Manager
+5
Fully automated dual-symbol hedging cBot for cTrader.
20.6%
ROI
8.66
Fattore di profitto
20%
Drawdown max
cBot
Key Levels
SL Manager
+4
RISK REWARD VISUALIZER Part of the MACRO ZERO Suite Visualize your active positions, pending orders, and cl
Da 18/12/2024
2
Vendite
4.08K
Installazioni gratuite