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
306 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.66K
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

AI summary
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
Forex
Automate Fibonacci trading with this cTrader cBot—advanced risk management, alerts, and seamless order execution.
cBot
Prop
Forex
+11
Risk On Trade Lite | Auto Position Size Calculator for cTrader | Risk & Reward Tool | Auto Lot Size Calculator
cBot
XAUUSD
Commodities
Dragon GOLD EA uses trade gold with good profit, the minimum balance is 3000$ with lot size 0.01, SELL on demo account.
cBot
Prop
Forex
+5
Quantum Queen Ctrader Cbot
cBot
XAUUSD
Bollinger
+1
Sfrutta il breakout delle bande di bollinger.
cBot
Perfectly optimized to trade EURUSD achieving high risk reward. Win rate of over 85%
cBot
Forex
Crypto
+2
The cTrader Risk & Reward management tool can easily help you to set the risk vs reward values
cBot
Break & Retest
Drawdown Guard
+2
✨Petra Oil Breakout - Session Box Precision for WTI & Brent. Up to +136% in 30 Days✨
136%
ROI
4.35
Współczynnik zysku
cBot
RSI
Forex
+5
Low drawdown RSI Forex Bot for EURUSD & GBPJPY. Starts from $20 with projected 50%+
40.7%
ROI
50
Współczynnik zysku
cBot
Prop
Forex
+2
Lock your risk before you click Buy or Sell. Entering a trade without clearly defined risk!
cBot
Fixed Lot
Equity Stop
+5
Copy trades between cTrader accounts on one PC or VPS. Symbol names mapped across brokers for you. Three-step setup.
cBot
EMA
Balanced
+2
Pharaoh Bot Back tested for 6 years tick data
1.64
Współczynnik zysku
cBot
Grid
Crypto
+5
this is private product.
10.2%
ROI
1.8
Współczynnik zysku
cBot
Forex
NAS100
+5
Session-based trading bot with intelligent trailing stops. Captures Asia range, trades London/NY breakouts
8.86
Współczynnik zysku
cBot
AI Trading
Risk/Reward
+1
UFO Risk Manager is an advanced cTrader cBot designed for precise trade management, instant break-even, smart recovery..
8.2%
ROI
1
Współczynnik zysku
cBot
Signal
Martingale
This cBot uses Three White Soldiers, Three Black Crows patterns with ADX filtering and a Martingale strategy for trades.
cBot
EMA
TP Manager
+5
Multi-asset trend-following cBot for Forex, crypto, gold, indices, and more, with configurable risk management.
1.36
Współczynnik zysku
cBot
ATR
Prop
+4
🚀 HTF Power 3 (PO3) – Automated ICT AMD Strategy
70.2%
ROI
1.31
Współczynnik zysku

Cena

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