"E7 BBKG NumSharp Sample" ๋กœ๊ณ 
cBot
196 ๋‹ค์šด๋กœ๋“œ
๋ฒ„์ „ 1.0, Feb 2025
Windows, Mac, Mobile, Web
"E7 BBKG NumSharp Sample" ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€
๊ฐ€์ž…์ผ 18/12/2024
2
ํŒ๋งค
3.83K
๋ฌด๋ฃŒ ์„ค์น˜

As requested by many of you, we are now working hard to provide examples of some of our machine learning code and packages.

TensorFlow, PyTorch, Keras, Numpy, Pandas and many more .NET packages to get going inside of cTrader.

Our mission is to make Machine Learning inside cTrader easier for everyone.

Happy hunting!

*** This code does not trade anything (it only prints out data etc). It is simply sample code of how you can start creating your own AI models using our Machine Learning packages.

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

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()
        {
            // Initialize any indicators
        }

        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($"Error: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Print($"Inner Exception: {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 Data Split Prints
        public void DataSplitPrints()
        {
            // Reshape input data to match the model's expected input shape
            //var inputShape = new Shape(-1, BarsRequired, 5);
            NDArray inputData = np.array<float>(GetDataSet());
            Print("Input NDarray: " + string.Join(", ", inputData));
            
            // Reshape target data to match the target shape expected by the model
            //var targetShape = new Shape(-1, 5);
            NDArray targetData = np.array<float>(GetTargetDataSet());
            Print("Target NDarray: " + string.Join(", ", targetData));
            
            // Split data into training and test sets
            int testSize = (int)(0.2 * inputData.shape[0]); // 20% for testing
            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 data: " + string.Join(", ", x_train));
            Print("X_test data: " + string.Join(", ", x_test));
            Print("Y_train data: " + string.Join(", ", y_train));
            Print("Y_test data: " + string.Join(", ", y_test));
        }
        
        /// PandasNet Prints
        public void PandasPrints()
        {
            // Convert float[,] to 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()));
            }
            
            // Create DataFrames
            DataFrame inputDataFrame = new DataFrame(inputSeriesList);
            DataFrame targetDataFrame = new DataFrame(targetSeriesList);
            
            Print("Input DataFrame: " + inputDataFrame);
            Print("Target DataFrame: " + targetDataFrame);
            
            //Print("Input DataFrame: " + string.Join(", ", inputDataFrame));
            //Print("Target DataFrame: " + string.Join(", ", targetDataFrame));
        }
        
        /// Simple NumSharp NDArrays Prints
        public void NDArrayPrints()
        {
            if (Bars.ClosePrices.Count < BarsRequired)
                return;

            try
            {
                // Calling your Input Data float[,]
                float[,] inputData = GetDataSet();

                // Convert to NDArray and reshape to (BarsRequired, 5)
                NDArray inputNDArray = np.array(inputData);   // NumSharp
                Print("Input NumSharp NDarray Data : " + string.Join(", ", inputNDArray));
                Print("Input NumSharp NDarray Shape: " + string.Join(", ", inputNDArray.shape));
                
                int expectedLength = BarsRequired * 5;
                Print($"Expected NumSharp NDarray Length: {expectedLength}");
                Print($"Input NumSharp NDarray Size: {inputNDArray.size}");

                if (inputNDArray.size != expectedLength)
                {
                    Print($"Length MisMatch: Expected Length {expectedLength}, but got Size {inputNDArray.size}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Print("Exception: " + ex.Message);
                Print("StackTrace: " + ex.StackTrace);

                Exception innerException = ex.InnerException;
                while (innerException != null)
                {
                    Print("Inner Exception: " + innerException.Message);
                    Print("Inner Exception StackTrace: " + innerException.StackTrace);
                    innerException = innerException.InnerException;
                }
            }
        }
    }
}

ํŠธ๋ ˆ์ด๋”ฉ ํ”„๋กœํ•„
0.0
๋ฆฌ๋ทฐ: 0
๊ณ ๊ฐ ๋ฆฌ๋ทฐ
์ด ์ƒํ’ˆ์— ๋Œ€ํ•œ ๋ฆฌ๋ทฐ๊ฐ€ ์•„์ง ์—†์Šต๋‹ˆ๋‹ค. ์ด๋ฏธ ์‚ฌ์šฉํ•ด ๋ณด์…จ๋‚˜์š”? ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ๊ฐ€์žฅ ๋จผ์ € ์†Œ๊ฐœํ•ด ์ฃผ์„ธ์š”!
AI
ํŠธ๋ ˆ์ด๋”ฉ ๋ด‡, ์ง€ํ‘œ, ํ”Œ๋Ÿฌ๊ทธ์ธ ๋“ฑ cTrader Store์—์„œ ์ œ๊ณต๋˜๋Š” ์ƒํ’ˆ์€ ์ œ3์ž ๊ฐœ๋ฐœ์ž์— ์˜ํ•ด ์ œ๊ณต๋˜๋ฉฐ, ์ด๋Š” ๋‹จ์ˆœํžˆ ์ •๋ณด ๋ฐ ๊ธฐ์ˆ ์  ์ ‘๊ทผ์„ ๋ชฉ์ ์œผ๋กœ ์ œ๊ณต๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. cTrader Store๋Š” ์ค‘๊ฐœ์ธ์ด ์•„๋‹ˆ๋ฉฐ, ํˆฌ์ž ์กฐ์–ธ, ๊ฐœ์ธ๋ณ„ ์ถ”์ฒœ ๋˜๋Š” ํ–ฅํ›„ ์„ฑ๊ณผ์— ๋Œ€ํ•œ ์–ด๋– ํ•œ ๋ณด์žฅ๋„ ์ œ๊ณตํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์ด ์ž‘์„ฑ์ž์˜ ์ƒํ’ˆ ๋” ๋ณด๊ธฐ

"E7 Volume Profile" ๋กœ๊ณ 
์ตœ๊ณ  ํ‰์ 
4.6
(3)
๋ฌด๋ฃŒ
์ง€ํ‘œ
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" ๋กœ๊ณ 
์ตœ๊ณ  ํ‰์ 
5.0
(2)
๋ฌด๋ฃŒ
์ง€ํ‘œ
E7 Harmonic Structures Basic.
์ง€ํ‘œ
E7 Correlation Dashboard.
"E7 Indicators Free Overlays" ๋กœ๊ณ 
์ตœ๊ณ  ํ‰์ 
5.0
(2)
๋ฌด๋ฃŒ
์ง€ํ‘œ
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
EURUSD
NZDUSD
+1
NZDUSD M10 # 14% PER MONTH # FREE BACKTEST UNTIL 16.01.2025
cBot
Grid
Prop
+16
Multi-group pullback entry bot: unlimited setups, enter on retracement after breakout. Ctrl+Click to add.
cBot
Grid
Forex
+9
The demo version of Scalping bot https://ctrader.com/products/257
cBot
Grid
Forex
+11
Full/semi-automated trading assistant with smart time grid, recovery & trailing logic. Demo works in backtesting only.
cBot
ATR
Grid
+4
๐ŸŒž Maya Gold Grid ATR is a professional trading robot designed exclusively for XAUUSD (Gold) on the cTrader .๐ŸŒž
cBot
MACD
Signal
+2
PTFX Supertrend: Advanced cBot for precision trading, with customisable settings, and trend filters for maximum profits!
cBot
Prop
Forex
+6
PropFirm Forex trader
cBot
MACD
Forex
+1
Forex Trend Following Strategy
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
RSI
MACD
+11
ShadowPulse is a modern automated trading bot designed for swing trading on the M15 timeframe!
cBot
AI
SMC
+17
Automated ICT-based Fibonacci trading bot designed for precision entries during key market killzones.
cBot
BTCUSD
Crypto
Transform Small Investments Into Bitcoin Success : It's not too late to make money with Bitcoin
cBot
๐Ÿ”ฅ "Ride the Big Moves. Recover the Bad Ones. Repeat." Turn Trends into Profit & Losses into Comebacks โ€” Automatically!
๊ฐ€์ž…์ผ 18/12/2024
2
ํŒ๋งค
3.83K
๋ฌด๋ฃŒ ์„ค์น˜