„E7 BBKG NumSharp Sample“-Logo
cBot
214 downloads
Version 1.0, Feb 2025
Windows, Mac, Mobile, Web
In „E7 BBKG NumSharp Sample“ hochgeladenes Bild
Seit 18/12/2024
2
Verkäufe
3.98K
Kostenlose Installationen

Wie von vielen von Ihnen gewünscht, arbeiten wir nun intensiv daran, Beispiele für einige unserer Machine-Learning-Codes und -Pakete bereitzustellen.

TensorFlow, PyTorch, Keras, Numpy, Pandas und viele weitere .NET-Pakete, um in cTrader loszulegen.

Unsere Mission ist es, Machine Learning in cTrader für alle einfacher zu machen.

Viel Erfolg bei der Suche!

*** Dieser Code handelt nichts (er gibt nur Daten usw. aus). Es ist einfach Beispielcode, wie Sie mit unseren Machine-Learning-Paketen eigene KI-Modelle erstellen können.

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

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("Quelle")]
        public DataSeries Source { get; set; }

        [Parameter("Benötigte Balken", DefaultValue = 50, MinValue = 1, MaxValue = 10000, Step = 1)]
        public int BarsRequired { get; set; }

        [Parameter("Methodenname", DefaultValue = MethodName.DataSplitPrints)]
        public MethodName Mode { get; set; }
        public enum MethodName
        {
            DataSplitPrints,
            PandasPrints,
            NDArrayPrints
        }
        
        protected override void OnStart()
        {
            // Initialisiere alle Indikatoren
        }

        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($"Fehler: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Innere Ausnahme: {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;
        }
        
        /// NumSharp Datenaufteilung Ausgaben
        public void DataSplitPrints()
        {
            // Formatiere Eingabedaten um, damit sie der erwarteten Eingabeform des Modells entsprechen
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("Eingabe NDarray: " + string.Join(", ", inputData));
            
            // Formatiere Ziel-Daten um, damit sie der vom Modell erwarteten Ziel-Form entsprechen
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("Ziel NDarray: " + string.Join(", ", targetData));
            
            // Teile Daten in Trainings- und Testsets auf
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% für Tests
            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("X_train Daten: " + string.Join(", ", x_train));
            Print("X_test Daten: " + string.Join(", ", x_test));
            Print("Y_train Daten: " + string.Join(", ", y_train));
            Print("Y_test Daten: " + string.Join(", ", y_test));
        }
        
        /// PandasNet Ausgaben
        public void PandasPrints()
        {
            // Konvertiere float[,] zu 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()));
            }
            
            // Erstelle DataFrames
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("Eingabe DataFrame: " + inputDataFrame);
            Print("Ziel DataFrame: " + targetDataFrame);
            
            //Print("Eingabe DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Ziel DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Einfache NumSharp NDArray-Ausgaben
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Aufruf Ihrer Eingabedaten float[,]
                float[,] inputData = GetDataSet();

                // Konvertiere zu NDArray und forme um zu (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Eingabe NumSharp NDarray Daten : " + string.Join(", ", inputNDArray));
                Print("Eingabe NumSharp NDarray Form: " + string.Join(", ", inputNDArray.shape));
                
                int erwarteteLänge = BarsRequired * 5;
                Print($"Erwartete NumSharp NDarray Länge: {erwarteteLänge}");
                Print($"Eingabe NumSharp NDarray Größe: {inputNDArray.size}");

                if (inputNDArray.size != erwarteteLänge)
                {
                    Print($"Längenabweichung: Erwartete Länge {erwarteteLänge}, aber Größe {inputNDArray.size} erhalten");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Ausnahme: " + ex.Message);
                Print("StackTrace: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Innere Ausnahme: " + innerException.Message);
                    Print("StackTrace der inneren Ausnahme: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Handelsprofil
0.0
Bewertungen: 0
Kundenbewertungen
Bisher gibt es keine Bewertungen für dieses Produkt. Haben Sie es schon ausprobiert? Dann können Sie die erste Person sein, die andere darüber informiert!
AI
Über den cTrader Store verfügbare Produkte, einschließlich Handelsbots, Indikatoren und Plugins, werden von externen Entwicklern bereitgestellt und nur zu Informations- und technischen Zugriffszwecken verfügbar gemacht. cTrader Store ist kein Broker und erbringt keine Anlageberatung, persönlichen Empfehlungen oder eine Garantie für zukünftige Performance.

Mehr von diesem Autor

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

Das könnte Sie auch noch interessieren

cBot
MACD
Signal
+3
Dominate gold markets with Supertrend Gold – Backtested with +962% ROI!
cBot
Forex
Scalping
Free Trial - Ultimate Scalper for EUR/GBP - win rate 99,60% - ROI 2325% in 20 months
cBot
ATR
RSI
+3
Intelligent system, Available any instrument. Profit 12. Drawdown 1%
cBot
Prop
Forex
+2
Lock your risk before you click Buy or Sell. Entering a trade without clearly defined risk!
cBot
Forex
EURUSD
+3
BtxScalper Final Trial Day15
cBot
Prop
Forex
+11
🦖 T-Rex Risk Guardian - your personal T-Rex that protects your account 🦖
cBot
XAUUSD
Commodities
Your 24/7 Golden Trading Sentinel. Precision Engineered for Gold Traders . ENJOY !!
cBot
SMA
Ichimoku
+3
Cut the Noise. Catch the Trend
50.1%
Rendite
1.96
Gewinnfaktor
53.88%
Maximaler Rückgang
cBot
ADX
EMA
+5
Momentum-focused trading system for DJ30 / Dow Jones 30 / US30, designed for controlled exposure and high-quality direct
12.8%
Rendite
5.27
Gewinnfaktor
6.12%
Maximaler Rückgang
cBot
EMA
Volume
+5
Sniper Entry Bot – Advanced EMA Crossover Trading Robot for cTrader
677%
Rendite
2.52
Gewinnfaktor
11.53%
Maximaler Rückgang
cBot
AI
XAUUSD
+4
Gold Pulse Pro – An automated trading system for gold (XAUUSD) precisely engineered and powered by advanced algorithms
cBot
Forex
BTCUSD
+11
CandlePatternBot — Trade classic candlestick signals with bull/bear bias and SL/TP or next-pattern exits.
cBot
RSI
EURUSD
+2
Performance Status: Prop Firm Challenge Passed (The5ers)
2
Gewinnfaktor
8%
Maximaler Rückgang
cBot
Forex
NAS100
+5
Session-based trading bot with intelligent trailing stops. Captures Asia range, trades London/NY breakouts
8.86
Gewinnfaktor
5.21%
Maximaler Rückgang
cBot
Prop Firm Fit
Risk Dashboard
+1
Advanced prop firm risk protection and automation suite for cTrader traders.
cBot
CHOCH
SL Manager
+1
Trade with clarity. Protect your capital. Let Risk Manager enforce the rules.
0%
Maximaler Rückgang
cBot
ADX
EMA
+5
Apex CFX - NAS100 Control is a structured automated trading cBot designed for NAS100 / Nasdaq 100, using EMA alignment,
15%
Rendite
5.1
Gewinnfaktor
12%
Maximaler Rückgang
Seit 18/12/2024
2
Verkäufe
3.98K
Kostenlose Installationen