"E7 BBKG NumSharp Sample" 로고
cBot
228 다운로드
버전 1.0, Feb 2025
Windows, Mac, Mobile, Web
"E7 BBKG NumSharp Sample" 업로드된 이미지
가입일 18/12/2024
2
판매
4.08K
무료 설치

많은 분들의 요청에 따라, 이제 저희는 기계 학습 코드와 패키지의 예제를 제공하기 위해 열심히 작업하고 있습니다.

TensorFlow, PyTorch, Keras, Numpy, Pandas 및 cTrader 내에서 사용할 수 있는 다양한 .NET 패키지들.

저희의 목표는 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 inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("입력 데이터프레임: " + inputDataFrame);
            Print("대상 데이터프레임: " + targetDataFrame);
            
            //Print("입력 데이터프레임: " + string.Join(", ", inputDataFrame));
            //Print("대상 데이터프레임: " + string.Join(", ", targetDataFrame));
        }
        
        /// 간단한 NumSharp NDArray 출력
        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에서 제공되는 상품은 제3자 개발자에 의해 제공되며, 이는 단순히 정보 및 기술적 접근을 목적으로 제공된 것입니다. 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.

좋아하실 만한 다른 항목

cBot
AI
Forex
+4
A Trend Master AI, Suitable for more advance pro trader with fully customisation and risk control PLEASE ENJOY!!
10.9%
ROI
4
손익비
23%
최대 낙폭
cBot
AI
ATR
+27
Review and User Guide: PROP Account Guardian Pro cBot 🛡️
cBot
Perfectly optimized to trade EURUSD achieving high risk reward. Win rate of over 85%
cBot
Grid
Forex
+11
Semi bot will manage your position by moving stoploss and cover loss with 3 martingale style
cBot
Forex
Crypto
+5
Smart position sizing, visual SL/TP lines, risk-based lot calculation, RR display, margin & lot limits, and hotkey trade
cBot
RSI
Aggressive
automates entries based on the RSX indicator — a smoothed, low-lag variant of the classic RSI.
1.67
손익비
10.25%
최대 낙폭
cBot
ATR
Forex
+4
Automate SL & Trailing for manual trades. Independent Buy/Sell logic. Chandelier Exit & ATR support.
cBot
Prop Firm Fit
Stop Loss (SL) Manager
+1
HTS Strategy Tester - Advanced Multi-Timeframe Trend & Pullback Trading System H1/m1 & H4/m5 WWS 33/144 Start from 100$
90.1%
ROI
2.92
손익비
37%
최대 낙폭
cBot
EMA
SL Manager
+5
Fully automated dual-symbol hedging cBot for cTrader.
20.6%
ROI
8.66
손익비
20%
최대 낙폭
cBot
AI
Grid
+4
Where Algorithmic Precision Meets Gold’s Volatility. AI-Powered Gold Trading Algorithm for cTrader.
cBot
ATR
AI Trading
+2
OiL Strategy based on current geopolitical volatility opportunities. This Algo capitalizes on the directional side.
30.2%
ROI
1.57
손익비
5.12%
최대 낙폭
cBot
AI
Forex
+2
Sophisticated GRADIENTE algorithm , performance 11% per day drawdown 4%
cBot
RSI
This bot implements the well-known 2-period RSI strategy, enhanced by a powerful filter comprised of two exponential mov
cBot
ADX
ATR
+5
Analyze quarterly cycles and weekly seasonality patterns across multiple instruments with historical bias data
cBot
Trade with confidence—control risk accurately and manage orders with speed and clarity.
cBot
BTCUSD
EURUSD
+8
Renko Strategy Free Trial
cBot
AI
ATR
+5
Ai_ScalperPro Max is a sophisticated automated trading robot designed specifically for gold (XAUUSD) trading
100%
ROI
2.44
손익비
25.93%
최대 낙폭
cBot
Channel
SL Manager
+4
cTrader to Telegram trade notifier with custom message formats, risk alerts, and an on-chart dashboard.
가입일 18/12/2024
2
판매
4.08K
무료 설치