「E7 BBKG NumSharp Sample」ロゴ
cBot
228 ダウンロード数
バージョン 1.0、Feb 2025
Windows、Mac, Mobile, Web
「E7 BBKG NumSharp Sample」アップロード画像
登録日 18/12/2024
2
販売
4.07K
無料インストール

多くの方からのご要望により、現在、当社の機械学習コードやパッケージのいくつかの例を提供するために懸命に取り組んでいます。

TensorFlow、PyTorch、Keras、Numpy、Pandas、そして多くの.NETパッケージをcTrader内で利用開始できます。

私たちの使命は、cTrader内での機械学習を誰にとってもより簡単にすることです。

ハッピー・ハンティング!

*** このコードは何も取引しません(データを出力するだけです)。これは、当社の機械学習パッケージを使用して独自のAIモデルを作成し始める方法のサンプルコードに過ぎません。

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

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()
        {
            // インジケーターを初期化します
        }

        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($"エラー: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"内部例外: {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 データ分割プリント
        public void DataSplitPrints()
        {
            // モデルの期待する入力形状に合わせて入力データをリシェイプ
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("入力NDarray: " + string.Join(", ", inputData));
            
            // モデルが期待するターゲット形状に合わせてターゲットデータをリシェイプ
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("ターゲットNDarray: " + string.Join(", ", targetData));
            
            // データをトレーニングセットとテストセットに分割
            int testSize = (int)(0.2 * inputData.shape[0]); // テスト用に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 データ: " + string.Join(", ", x_train));
            Print("X_test データ: " + string.Join(", ", x_test));
            Print("Y_train データ: " + string.Join(", ", y_train));
            Print("Y_test データ: " + string.Join(", ", y_test));
        }
        
        /// PandasNet プリント
        public void PandasPrints()
        {
            // float[,] を 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()));
            }
            // DataFrameを作成
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("入力DataFrame: " + inputDataFrame);
            Print("ターゲットDataFrame: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// シンプルなNumSharp NDArraysプリント
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // 入力データ float[,] を呼び出す
                float[,] inputData = GetDataSet();

                // NDArrayに変換し (BarsRequired, 5) にリシェイプ
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("入力NumSharp NDarrayデータ : " + string.Join(", ", inputNDArray));
                Print("入力NumSharp NDarray形状: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"期待されるNumSharp NDarrayの長さ: {expectedLength}");
                Print($"入力NumSharp NDarrayのサイズ: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"長さ不一致: 期待長さ {expectedLength}、しかしサイズは {inputNDArray.size} でした");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("例外: " + ex.Message);
                Print("スタックトレース: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("内部例外: " + innerException.Message);
                    Print("内部例外スタックトレース: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

取引プロフィール
0.0
レビュー: 0
カスタマーレビュー
この商品にはまだレビューがありません。お使いになったことがある方は、ぜひレビューをお願いします。
AI
cTrader Storeで入手可能な取引ボット、インジケーター、プラグインなどの商品は、第三者の開発者が提供するものであり、情報と技術の取得のみを目的としてご利用いただけます。cTrader Storeはブローカーではなく、投資助言や個人的な推奨を行うことも、将来のパフォーマンスを保証することもありません。

この作成者の他の商品

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

これも好きかも

cBot
AI
ATR
+27
Major Update: Advanced Prop Firm Risk Management is Here! 🚀Trial Version 7 days
cBot
Channel
SL Manager
+4
cTrader to Telegram trade notifier with custom message formats, risk alerts, and an on-chart dashboard.
cBot
ADX
ATR
+4
Trend-following bot using Ichimoku, ADX and ATR; trades strong trends with strict risk filters.
1.51
プロフィットファクター
39.61%
最大ドローダウン
cBot
ATR
RSI
+5
Shift from “Price Chasing” to “Price Trapping” using Limit Orders and a Volatility-Based Calculation System
cBot
ADX
EMA
+5
Apex CFX - NAS100 Control is a structured automated trading cBot designed for NAS100 / Nasdaq 100, using EMA alignment,
15%
ROI
5.1
プロフィットファクター
12%
最大ドローダウン
cBot
MACD
Forex
+5
CRT Trading_bot
100%
ROI
2.13
プロフィットファクター
23.59%
最大ドローダウン
cBot
RSI
Grid
+5
This production version of Dragon Money Forex Pro
cBot
Prop
Forex
+5
Quantum Queen Ctrader Cbot
cBot
Signal
Indices
DAX INTRADAY BOT Free Test until 15/11/2025
cBot
Volume
Key Levels
Export OHLC data from any backtest to CSV. Works on Candles, Renko, Tick, Range. Perfect for external analysis.
cBot
Automatiza tus operaciones con esta estrategia de cruce de medias móviles exponenciales (EMAs). EMA Crossover Pro.
cBot
RSI
Aggressive
automates entries based on the RSX indicator — a smoothed, low-lag variant of the classic RSI.
1.67
プロフィットファクター
10.25%
最大ドローダウン
cBot
AI
NAS100
+3
DeMark Volume Pro Multi-Style Suite
19.24
プロフィットファクター
4.55%
最大ドローダウン
cBot
Fixed Lot
VPS Recommended
+3
A high-performance cTrader local trade copier . Copy positions and pending orders between multiple terminals instantly.
cBot
ATR
NAS100
+5
A trading robot designed for traders who want precision for high-volatility markets (XAUUSD, US500, US100, WTI, others.)
cBot
Der MultiStrategyScalpingBot ist ein automatisierter Handelsroboter für die cAlgo-Plattform.
cBot
ATR
Grid
+3
“University-Built Gold–Silver Arbitrage Bot: +439k USD with 5k Capital (backtest in 3 years)”
2
プロフィットファクター
20%
最大ドローダウン
登録日 18/12/2024
2
販売
4.07K
無料インストール