E7 BBKG NumSharp Sample
cBot
257 pobrania
Wersja 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Od 18/12/2024
2
Sprzedaż
4.24K
Bezpłatne instalacje

Opis

Na prośbę wielu z Was, obecnie intensywnie pracujemy nad dostarczeniem przykładów niektórych naszych kodów i pakietów do uczenia maszynowego.

TensorFlow, PyTorch, Keras, Numpy, Pandas i wiele innych pakietów .NET, aby zacząć pracę w środowisku cTrader.

Naszą misją jest ułatwienie korzystania z uczenia maszynowego w cTrader dla każdego.

Powodzenia!

*** Ten kod nie dokonuje żadnych transakcji (tylko wypisuje dane itp.). To po prostu przykładowy kod pokazujący, jak można zacząć tworzyć własne modele AI korzystając z naszych pakietów do uczenia maszynowego.

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

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()
        {
            // Inicjalizacja wskaźników
        }

        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($"Błąd: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Wewnętrzny wyjątek: {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 Data Split Prints
        public void DataSplitPrints()
        {
            // Przekształć dane wejściowe, aby dopasować kształt oczekiwany przez model
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("Input NDarray: " + string.Join(", ", inputData));
            
            // Przekształć dane docelowe, aby dopasować kształt oczekiwany przez model
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("Target NDarray: " + string.Join(", ", targetData));
            
            // Podziel dane na zestawy treningowe i testowe
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% na testy
            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("Dane X_train: " + string.Join(", ", x_train));
            Print("Dane X_test: " + string.Join(", ", x_test));
            Print("Dane Y_train: " + string.Join(", ", y_train));
            Print("Dane Y_test: " + string.Join(", ", y_test));
        }
        
        /// Wydruki PandasNet
        public void PandasPrints()
        {
            // Konwersja float[,] na 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()));
            }
            // Utwórz DataFrame'y
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("Input DataFrame: " + inputDataFrame);
            Print("Target DataFrame: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Proste wydruki NumSharp NDArrays
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Wywołanie Twoich danych wejściowych float[,]
                float[,] inputData = GetDataSet();

                // Konwersja do NDArray i przekształcenie do (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Dane wejściowe NumSharp NDarray: " + string.Join(", ", inputNDArray));
                Print("Kształt NumSharp NDarray danych wejściowych: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Oczekiwana długość NumSharp NDarray: {expectedLength}");
                Print($"Rozmiar NumSharp NDarray danych wejściowych: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Niezgodność długości: oczekiwana długość {expectedLength}, ale otrzymano rozmiar {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Wyjątek: " + ex.Message);
                Print("Ślad stosu: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Wewnętrzny wyjątek: " + innerException.Message);
                    Print("Ślad stosu wewnętrznego wyjątku: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Podsumowanie

Podsumowanie 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.
Profil handlowy

Opinie klientów

0.0
Opinie: 0
Opinie klientów
Ten produkt nie ma jeszcze opinii. Wypróbowałeś(-aś) go już? Bądź pierwszy(-a) i powiedz o tym innym!

Dyskusja

Częste pytania

AI
Produkty dostępne za pośrednictwem cTrader Store, w tym boty handlowe, wskaźniki i wtyczki, dostarczane są przez deweloperów zewnętrznych i udostępniane wyłącznie w celach informacyjnych oraz w celu zapewnienia dostępu technicznego. cTrader Store nie jest brokerem i nie zapewnia doradztwa inwestycyjnego, nie udziela spersonalizowanych rekomendacji ani nie gwarantuje przyszłych wyników.

Więcej od tego autora

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

Możesz także polubić

cBot
RSI
N.B.: Results with an initial invested capital of 100 euros.
cBot
Forex
Crypto
+5
Smart position sizing, visual SL/TP lines, risk-based lot calculation, RR display, margin & lot limits, and hotkey trade
cBot
Key Levels
Spread Filter
+3
MATRIX INFINITY, See Beyond the Market.
22.3%
ROI
31
Współczynnik zysku
cBot
Forex
EURUSD
+6
Scalping All Forex Trial Day15
cBot
RSI
MACD
+3
N.B.: Results with an initial invested capital of 100 euros.
cBot
Signal
Martingale
This cBot uses Three White Soldiers, Three Black Crows patterns with ADX filtering and a Martingale strategy for trades.
cBot
Grid
Forex
+11
Semi bot will manage your position by moving stoploss and cover loss with 3 martingale style
cBot
SMC
Prop
+12
Risk On Trade | Auto Position Size Calculator | Risk & Reward Tool | Auto Lot Size Calculator
cBot
MACD
BTCUSD
+3
Combina los indicadores Índice Direccional Promedio (ADX) y Convergencia/Divergencia de Medias Móviles (MACD).
457%
ROI
1.2
Współczynnik zysku
cBot
ATR
Forex
+3
Trade fearlessly: auto-adjusts stops, manages risk, and locks profits with precision. Free for early users🚀 now -80%
cBot
ADX
ATR
+5
Ai_GoldScalperPro XAU M15 – Premium Scalping Robot for cTrader
7.9%
ROI
1.92
Współczynnik zysku
cBot
Forex
BTCUSD
+4
OneClick SL/TP Setter — Smart Trade Management Made Simple
cBot
RSI‑driven scalper for the most volatile asset classes.
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
Współczynnik zysku
cBot
BTCUSD
Automated cTrader bot with webhook support, trade management, take-profit levels, and Telegram notifications
cBot
Trailing Stop
Break & Retest
+4
Smart Trade H4 Breakout Matrix (lower trader, higher accuracy)
3.73
Współczynnik zysku
cBot
Fibonacci
Fixed Lot
+5
Trading dashboard for fast order execution, position management, risk controls and automatic Fibonacci levels.
1.52
Współczynnik zysku
cBot
Prop
Forex
+11
Manage trades visually! Secure profits with Auto Partials & Trailing Shield. Works on all cTrader markets.
35.2%
ROI
4
Współczynnik zysku

Cena

Od 18/12/2024
2
Sprzedaż
4.24K
Bezpłatne instalacje