present
Zarejestruj się i otrzymaj 50 $ zniżki na pierwszy zakup
Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
E7 BBKG NumSharp Sample
cBot
292 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.54K
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.
Logo „E7 BBKG Indicator”
Najwyżej oceniane
4.5
(4)
$25
/
$50
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
This strategy is based on the Zone Recovery strategy and utilizes hedging for trade management.
cBot
Equity Stop
ECN-friendly
+5
A precision grid-scalper for Gold (XAUUSD). Designed for stable markets with built-in profit locking and strict risk con
36.79
Współczynnik zysku
cBot
AI
AI is detecting and determine and seize the opportunities to Open a Positions and follow the current Market Trend.
cBot
Forex
BTCUSD
+6
GOLD HUNTER TRIAL DAY15
cBot
Trading_stop Plus 🧾 General Description Trading_stop Plus is the complete, enhanced version of the original Trading_sto
cBot
Forex
Crypto
+2
Smart automated trading. Our bot works 24/7 to grow your capital while you relax. Effortless, intelligent, and secure.
cBot
SL Manager
Break Even
+5
Swing trading bot using body-based range breakout, volume fusion, and structured risk management for clean entries.
17%
ROI
2.74
Współczynnik zysku
cBot
Break Even
Risk/Reward
+3
Plan gold trades with basket risk sizing, up to three targets, breakeven and trailing protection.
cBot
Key Levels
One-click Trading
FREE XAUUSD Level-Based Trading cBot
cBot
RSI
Forex
+2
N.B.: Results with an initial invested capital of 100 euros.
cBot
Prop
Forex
+5
**Quantum King : – Precision Trading for Forex{GBPUSD, EURUSD}, Gold & Oil** The **Quantum King**
cBot
Prop
Forex
+11
Risk On Trade Lite | Auto Position Size Calculator for cTrader | Risk & Reward Tool | Auto Lot Size Calculator
cBot
AI
ATR
+27
Review and User Guide: PROP Account Guardian Pro cBot 🛡️
cBot
SL Manager
TP Manager
+2
cBot de Risk Control para cTrader que calcula el lotaje según el riesgo y coloca automáticamente Stop Loss y Take Profit
cBot
Pin Bar
Fibonacci
+5
Semi-automatic cBot: multi-timeframe reversal detection, Fibonacci/Classic pivots, PROTECT via hedging.
1.36
Współczynnik zysku
cBot
ADX
BOS
+5
QUANT ENGINE Decision pipeline: price action, Fibonacci, fractal VWAP, order flow, market structure (BOS/CHoCH).
10.2%
ROI
4
Współczynnik zysku
cBot
Signal
Bollinger
This cBot uses a combination of Heikin Ashi and Bollinger Bands strategies.

Cena

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