E7 BBKG NumSharp Sample
cBot
259 i̇ndirmeler
Sürüm 1.0, Feb 2025
Windows, Mac, Mobile, Web
Trading product for E7 BBKG NumSharp Sample cBot AI, image 2
Başlangıç 18/12/2024
2
Satışlar
4.25K
Ücretsiz yüklemeler

Açıklama

Birçoğunuzun talebi üzerine, şimdi makine öğrenimi kodlarımızdan ve paketlerimizden bazı örnekler sunmak için yoğun bir şekilde çalışıyoruz.

TensorFlow, PyTorch, Keras, Numpy, Pandas ve cTrader içinde kullanmaya başlamak için daha birçok .NET paketi.

Misyonumuz, cTrader içinde Makine Öğrenimini herkes için daha kolay hale getirmektir.

İyi avlar!

*** Bu kod herhangi bir işlem yapmaz (sadece veri yazdırır vb.). Makine Öğrenimi paketlerimizi kullanarak kendi AI modellerinizi nasıl oluşturabileceğinize dair basit bir örnek koddur.

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

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()
        {
            // Herhangi bir göstergeleri başlat
        }

        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($"Hata: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"İç Hata: {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 Veri Bölme Yazdırmaları
        public void DataSplitPrints()
        {
            // Modelin beklediği giriş şekline uyacak şekilde giriş verisini yeniden şekillendir
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("Giriş NDarray: " + string.Join(", ", inputData));
            
            // Modelin beklediği hedef şekline uyacak şekilde hedef verisini yeniden şekillendir
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("Hedef NDarray: " + string.Join(", ", targetData));
            
            // Veriyi eğitim ve test setlerine ayır
            int testSize = (int)(0.2 * inputData.shape[0]); // Test için %20
            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 verisi: " + string.Join(", ", x_train));
            Print("X_test verisi: " + string.Join(", ", x_test));
            Print("Y_train verisi: " + string.Join(", ", y_train));
            Print("Y_test verisi: " + string.Join(", ", y_test));
        }
        
        /// PandasNet Yazdırmaları
        public void PandasPrints()
        {
            // float[,] tipini List<Series> tipine dönüştür
            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()));
            }
            
            // DataFrame'ler oluştur
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("Giriş DataFrame: " + inputDataFrame);
            Print("Hedef DataFrame: " + targetDataFrame);
            
            //Print("Giriş DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Hedef DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Basit NumSharp NDArrays Yazdırmaları
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Giriş Verinizi çağırma float[,]
                float[,] inputData = GetDataSet();

                // NDArray'a dönüştür ve (BarsRequired, 5) şekline getir
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Giriş NumSharp NDarray Verisi : " + string.Join(", ", inputNDArray));
                Print("Giriş NumSharp NDarray Şekli: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Beklenen NumSharp NDarray Uzunluğu: {expectedLength}");
                Print($"Giriş NumSharp NDarray Boyutu: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Uzunluk Uyumsuzluğu: Beklenen Uzunluk {expectedLength}, ancak Boyut {inputNDArray.size} olarak alındı");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("İstisna: " + ex.Message);
                Print("Yığın İzleme: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("İç İstisna: " + innerException.Message);
                    Print("İç İstisna Yığın İzleme: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

Özet

YZ özeti
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.
İşlem profili

Müşteri değerlendirmeleri

0.0
Değerlendirmeler: 0
Müşteri değerlendirmeleri
Bu ürün için henüz bir değerlendirme yok. Ürünü denediniz mi? O zaman ona dair görüşlerini paylaşan ilk kişi olun!

Tartışma

SSS

AI
cTrader Store üzerinden erişilebilen işlem botları, göstergeler ve eklentiler gibi ürünler, üçüncü taraf sağlayıcılar tarafından sağlanır ve yalnızca bilgilendirme ve teknik erişim amaçlarıyla sunulur. cTrader Store bir broker değildir ve yatırım tavsiyesi, kişisel öneriler vermez veya gelecekteki performansı garanti etmez.

Bu oluşturanın diğer ürünleri

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

Şunları da beğenebilirsiniz

cBot
AI
ATR
+26
Review and User Guide: PROP Account Guardian Pro cBot 🛡️
cBot
Forex
Crypto
+4
Creates buy limit orders automatically when the market drops.
cBot
Trade fearlessly: auto-adjusts stops, manages risk, and locks profits with precision
cBot
Auto-detects bullish/bearish engulfing patterns with fixed take profit and stop loss for powerful, simple trading.
cBot
ATR
Grid
+11
Automated cTrader robot combining grid strategy, volatility-based TP, and risk protection
cBot
Prop
Forex
+3
FTMO Guardian. Auto-calculates lots by Risk $. Rejects errors & trades w/o SL. Protect your Prop Account
cBot
Grid
Forex
+11
Semi bot will manage your position by moving stoploss and cover loss with 3 martingale style
cBot
EMA
Balanced
+5
Sniper Entry Bot – Advanced EMA Crossover Trading Robot for cTrader
677%
ROI
2.5
Kâr faktörü
cBot
XAUUSD
Martingale
IBC Advanced Strategy - IBC高级策略,基于马丁策略的优化版本,添加止损配置
cBot
Grid
Prop
+1
This strategy is tailored for Prop Firm accounts, featuring automated risk management to prevent breaching loss limits.
cBot
Prop
Forex
+5
**Quantum King : – Precision Trading for Forex{GBPUSD, EURUSD}, Gold & Oil** The **Quantum King**
cBot
Grid
EURUSD
+2
EURUSD RE5 PROFITABLE SINCE 2014 # MINIMUMN STARTCAPITAL 150,- EURO
cBot
Break Even
Risk/Reward
+5
Automatic position sizing, smart pending orders, loss limits, and one-click trade execution for cTrader.
cBot
Aggressive
Break Even
+1
This is a 2nd Version of "MycBots" swing trading + scalping strategy for XAUUSD and other Symbols.
37%
ROI
1.85
Kâr faktörü
cBot
ATR
EMA
+5
Momentum driven, Compounding. Volatility adaptive EMA BOLLINGER ATR base Strategy
93.4%
ROI
1.31
Kâr faktörü
cBot
Conservative
Grid Recovery
Ziggy, an advanced algorithm designed to maximize efficiency and simplify profit control.
cBot
ADX
ATR
+5
Ai_GoldScalperPro XAU M15 – Premium Scalping Robot for cTrader
7.9%
ROI
1.92
Kâr faktörü

Fiyat

Başlangıç 18/12/2024
2
Satışlar
4.25K
Ücretsiz yüklemeler