شعار "E7 BBKG NumSharp Sample"
cBot
231 التنزيلات
الإصدار 1.0، Feb 2025
Windows, Mac, Mobile, Web
صورة "E7 BBKG NumSharp Sample" المحملة
منذ 18/12/2024
2
المبيعات
4.1K
التثبيتات المجانية

كما طلب الكثير منكم، نحن الآن نعمل جاهدين لتوفير أمثلة لبعض أكواد التعلم الآلي والحزم الخاصة بنا.

TensorFlow، PyTorch، Keras، Numpy، Pandas والعديد من حزم .NET الأخرى للبدء داخل cTrader.

مهمتنا هي جعل التعلم الآلي داخل cTrader أسهل للجميع.

صيد موفق!

*** هذا الكود لا يقوم بأي تداول (فقط يطبع البيانات وما إلى ذلك). إنه مجرد كود نموذجي لكيفية بدء إنشاء نماذج الذكاء الاصطناعي الخاصة بك باستخدام حزم التعلم الآلي الخاصة بنا.

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

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()));
            }
            // إنشاء DataFrames
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("إطار بيانات الإدخال: " + inputDataFrame);
            Print("إطار بيانات الهدف: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + 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، بما في ذلك روبوتات التداول والمؤشرات والإضافات، من قبل مطوري الطرف الثالث وإتاحتها لأغراض الوصول المعلوماتي والفني فقط. 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.
شعار "E7 Polynomial Regression Channel"
الأعلى تقييمًا
4.8
(5)
مجاني
مؤشر
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
RSI
Aggressive
automates entries based on the RSX indicator — a smoothed, low-lag variant of the classic RSI.
1.67
عامل الربح
10.25%
أقصى تراجع
cBot
Fixed Lot
VPS Recommended
+3
A high-performance cTrader local trade copier . Copy positions and pending orders between multiple terminals instantly.
cBot
ATR
No Overtrading
+3
Intelligent negotiations and analysis PRO!
21.2%
العائد على الاستثمار
3
عامل الربح
2%
أقصى تراجع
cBot
Forex
NAS100
+5
Session-based trading bot with intelligent trailing stops. Captures Asia range, trades London/NY breakouts
8.86
عامل الربح
5.21%
أقصى تراجع
cBot
Calculates and Shows exact position size as a percentage of your current account balance
cBot
Volume
Key Levels
Export OHLC data from any backtest to CSV. Works on Candles, Renko, Tick, Range. Perfect for external analysis.
cBot
EMA
SL Manager
+5
Fully automated dual-symbol hedging cBot for cTrader.
20.6%
العائد على الاستثمار
8.66
عامل الربح
20%
أقصى تراجع
cBot
AI
SMC
+18
Review and Parameter Guide for the "Moving Average" cBot
cBot
ATR
RSI
+3
Intelligent system, Available any instrument. Profit 12. Drawdown 1%
cBot
ATR
Grid
+4
🌞 Maya Gold Grid ATR is a professional trading robot designed exclusively for XAUUSD (Gold) on the cTrader .🌞
cBot
AI
Grid
+7
AI Trading & Adviser with ChatGPT, Gemini, DeepSeek, Claude
cBot
Prop
Forex
+9
Forex Wizard
cBot
RSI
Forex
+3
Wealthcraft Auto Profit is a smart trading robot with Auto Stop-Loss, Trailing Stop, and maximum profit management
cBot
Channel
SL Manager
+4
cTrader to Telegram trade notifier with custom message formats, risk alerts, and an on-chart dashboard.
cBot
AI
ATR
+8
Breakout scalping with prop-firm grade equity control.
cBot
Volume
Imbalance
+3
VOLUME IMBALANCE STRIP A focused multi-timeframe imbalance visualization tool for cTrader.
cBot
AI
BTCUSD
+2
Crossover Bot es un sistema de trading algorítmico actualmente en operación real, currently in live operation.
منذ 18/12/2024
2
المبيعات
4.1K
التثبيتات المجانية