Trading product for E7 BBKG NumSharp Sample cBot AI, image 1
cBot
240 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.16K
Bezpłatne instalacje

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;
                }
            }
        }
    }
}

Profil handlowy
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!
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
Grid
This strategy opens trades when Fair Value Gaps are filled, using grid management and an equity SL for risk control.
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
Volume
Balanced
+5
An automated utility featuring global drawdown control, basket trailing profit tracking, and custom session filters.
16.4%
ROI
1.55
Współczynnik zysku
cBot
ATR
EMA
+2
🌞 Smart Anchor Grid Engine for XAUUSD up to +230% in 30 Days🌞
218.1%
ROI
27
Współczynnik zysku
cBot
AI
RSI
+4
Please Try and ENJOY !!! Try default setting before making any changes Please!!
cBot
Prop
Forex
+2
Lock your risk before you click Buy or Sell. Entering a trade without clearly defined risk!
cBot
ATR
RSI
+4
UltimateAI Trading Robot – Smart Trend & Momentum Trader for cTrader
60.1%
ROI
1.37
Współczynnik zysku
cBot
ATR
No Overtrading
+3
Intelligent negotiations and analysis Voice-based price action !Limited time offer!
21.2%
ROI
3
Współczynnik zysku
cBot
Prop
Forex
+11
Risk On Trade Lite | Auto Position Size Calculator for cTrader | Risk & Reward Tool | Auto Lot Size Calculator
cBot
AI
Stocks
+1
Advanced Automated SPX Algorithmic Trading System
4
Współczynnik zysku
cBot
RSI
Forex
+13
A robust trend-following cBot
cBot
Volume
Imbalance
+3
VOLUME IMBALANCE STRIP A focused multi-timeframe imbalance visualization tool for cTrader.
cBot
Fixed Risk %
Risk/Reward
+3
Total passive trading control. One click Stop Loss and Take Profit. Breakeven and Goal line. Set it. Protect it. Profit.
cBot
ATR
Forex
+3
Trade fearlessly: auto-adjusts stops, manages risk, and locks profits with precision. Free for early users🚀 now -80%
cBot
Prop
Forex
+11
A Fintech-Engineered Investment Opportunity in Algorithmic Gold Trading
cBot
Conservative
Grid Recovery
Ziggy, an advanced algorithm designed to maximize efficiency and simplify profit control.
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
A risk-managed trading bot that automatically closes all positions when a daily profit target is hit or a maximum daily
Od 18/12/2024
2
Sprzedaż
4.16K
Bezpłatne instalacje