شعار "E7 BBKG NumSharp Sample"
cBot
230 التنزيلات
الإصدار 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
Channel
SL Manager
+4
cTrader to Telegram trade notifier with custom message formats, risk alerts, and an on-chart dashboard.
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%
العائد على الاستثمار
2.92
عامل الربح
37%
أقصى تراجع
cBot
RSI
Indices
This bot is made of Fibonacci, EMA and RSI.
cBot
AI
ATR
+8
ORB Smart Money Bot for XAUUSD is a sophisticated algorithmic trading system specifically optimized for Gold (XAUUSD).
cBot
AI
ATR
+5
No guessing — just confirmed breakouts, smart risk management, and disciplined execution. Less noise. More direction.
28.5%
العائد على الاستثمار
4.44
عامل الربح
10.41%
أقصى تراجع
cBot
Forex
Automate Fibonacci trading with this cTrader cBot—advanced risk management, alerts, and seamless order execution.
cBot
Key Levels
SL Manager
+4
RISK REWARD VISUALIZER Part of the MACRO ZERO Suite Visualize your active positions, pending orders, and cl
cBot
Prop
Forex
+3
QuantumGuard - EUR/USD - More than 1000% profit per year
cBot
ATR
Conservative
+1
UNO GOLDEN PHOENIX — XAUUSD Grid Basket cBot
7.28
عامل الربح
0.05%
أقصى تراجع
cBot
Forex
Crypto
+6
Allows you to speed up chart annotation by letting you create drawing tools via Hot Keys.
cBot
Volume
Imbalance
+3
VOLUME IMBALANCE STRIP A focused multi-timeframe imbalance visualization tool for cTrader.
cBot
Forex
Crypto
+5
Smart position sizing, visual SL/TP lines, risk-based lot calculation, RR display, margin & lot limits, and hotkey trade
شعار "SmartTradeOnHoursBreak - XAUUSD"
الأعلى تقييمًا
4.5
(9)
مجاني
cBot
ATR
XAUUSD
+5
SmartBuyOn4HBreak – Precision Trading for Gold with Patience-Powered Profit.
63%
العائد على الاستثمار
9.53
عامل الربح
9.5%
أقصى تراجع
cBot
Prop
Forex
+2
Aggressive Gold Bot: BB+MACD strategy. Smart ATR-based risk management. Professional on-chart trading dashboard
1.32
عامل الربح
12.98%
أقصى تراجع
cBot
ATR
Grid
+11
Automated cTrader robot combining grid strategy, volatility-based TP, and risk protection
cBot
Key Levels
SL Manager
+4
Multi-symbol dashboard with 3 fixed charts, dynamic position slots ranked by profit, Ratio analysis, MZ phase detection
cBot
Prop
Forex
+2
Ultimate Trade Panel - a powerful, on-chart trading tool designed for precision and efficiency.
0.01
عامل الربح
0%
أقصى تراجع
cBot
ATR
XAUUSD
+2
Long-only trend-following cBot for XAUUSD using EMA cross entries, ATR-based risk management, and pyramiding into strong
18.6%
العائد على الاستثمار
1.59
عامل الربح
76.45%
أقصى تراجع
منذ 18/12/2024
2
المبيعات
4.1K
التثبيتات المجانية