Skip to content

Update .cs files with new versions (+comments) #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 139 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
10fc9e5
Update Accelerator Oscillator Sample.cs
sergikos7 Mar 27, 2025
2f7e310
Update Accumulative Swing Index Sample.cs
sergikos7 Mar 27, 2025
e45547d
Update Add Indicator Sample.cs
sergikos7 Mar 27, 2025
759ea6f
Update AddToChart Sample.cs
sergikos7 Mar 27, 2025
4cc97a7
Update AlgoRegistry Sample.cs
sergikos7 Mar 27, 2025
55ac7c5
Update Alligator Sample.cs
sergikos7 Mar 27, 2025
4f2baed
Update Aroon Sample.cs
sergikos7 Mar 27, 2025
ebe4c4c
Update Average Directional Movement Index Rating Sample.cs
sergikos7 Mar 27, 2025
20d9827
Update Average True Range Sample.cs
sergikos7 Mar 27, 2025
8fdcf10
Update Awesome Oscillator Sample.cs
sergikos7 Mar 27, 2025
0776709
Update BarClosed Example.cs
sergikos7 Mar 27, 2025
01106e1
Update BarOpened Example.cs
sergikos7 Mar 27, 2025
ce747d3
Update BarsHistoryLoadedEventArgs Sample.cs
sergikos7 Mar 27, 2025
11e67ae
Update Bollinger Bands Sample.cs
sergikos7 Mar 27, 2025
ac81be5
Update Center Of Gravity Sample.cs
sergikos7 Mar 27, 2025
55b4eec
Update Chaikin Money Flow Sample.cs
sergikos7 Mar 27, 2025
e9a51ad
Update Chaikin Volatility Sample.cs
sergikos7 Mar 27, 2025
f8108bf
Update ChartId Sample.cs
sergikos7 Mar 27, 2025
f9f286d
Update ChartIndicators Sample.cs
sergikos7 Mar 27, 2025
6539701
Update Close All On Market Close Sample.cs
sergikos7 Mar 27, 2025
a7c8fa8
Update Commodity Channel Index Sample.cs
sergikos7 Mar 27, 2025
fe3d4b3
Update Compilation Robot.cs
sergikos7 Mar 27, 2025
ecd4d84
Update Custom Fitness Functions.cs
sergikos7 Mar 27, 2025
5eb4523
Update CustomHandlers Example.cs
sergikos7 Mar 27, 2025
3804430
Update Cyber Cycle Sample.cs
sergikos7 Mar 27, 2025
630f104
Update Detrended Price Oscillator Sample.cs
sergikos7 Mar 27, 2025
692b22d
Update Directional Movement System Sample.cs
sergikos7 Mar 27, 2025
3381e4d
Update Discord Message Example.cs
sergikos7 Mar 27, 2025
7c07133
Update Donchian Channel Sample.cs
sergikos7 Mar 27, 2025
7a4d8e6
Update Ease Of Movement Sample.cs
sergikos7 Mar 27, 2025
42cf5c3
Update Error Sample.cs
sergikos7 Mar 27, 2025
09031da
Update Exponential Moving Average Sample.cs
sergikos7 Mar 27, 2025
aefe6b1
Update Fractal Chaos Bands Sample.cs
sergikos7 Mar 27, 2025
998b73f
Update Fractals Sample.cs
sergikos7 Mar 27, 2025
5138b5a
Update GetFitnessArgs Sample.cs
sergikos7 Mar 27, 2025
4d3734e
Update Grid.cs
sergikos7 Mar 27, 2025
0a00506
Update High Minus Low Sample.cs
sergikos7 Mar 27, 2025
02e1804
Update Historical Volatility Sample.cs
sergikos7 Mar 27, 2025
34a74bb
Update Hull Moving Average Sample.cs
sergikos7 Mar 27, 2025
9a4b87b
Update Ichimoku Kinko Hyo Sample.cs
sergikos7 Mar 27, 2025
29adef8
Update IndicatorTitles Sample.cs
sergikos7 Mar 27, 2025
bf64ca2
Update Keltner Channels Sample.cs
sergikos7 Mar 27, 2025
0d5a8f9
Update Linear Regression Forecast Sample.cs
sergikos7 Mar 27, 2025
04611cf
Update Linear Regression Intercept Sample.cs
sergikos7 Mar 27, 2025
4b9ca04
Update Linear Regression R Squared Sample.cs
sergikos7 Mar 27, 2025
b7d897b
Update Linear Regression Slope Sample.cs
sergikos7 Mar 27, 2025
e816c08
Update Macd Cross Over Sample.cs
sergikos7 Mar 27, 2025
6e48f9a
Update Macd Histogram Sample.cs
sergikos7 Mar 27, 2025
cc02832
Update Mass Index Sample.cs
sergikos7 Mar 27, 2025
3fc1a99
Update Median Price Sample.cs
sergikos7 Mar 27, 2025
35c301e
Update Momentum Oscillator Sample.cs
sergikos7 Mar 27, 2025
5f4f559
Update Money Flow Index Sample.cs
sergikos7 Mar 27, 2025
8e2ef7f
Update Moving Average Sample.cs
sergikos7 Mar 27, 2025
b2ae6dd
Update On Balance Volume Sample.cs
sergikos7 Mar 27, 2025
5a3497c
Update Parabolic SAR Sample.cs
sergikos7 Mar 27, 2025
5a988f5
Update Partial Close Sample.cs
sergikos7 Mar 27, 2025
2d3e769
Update Patterns Strategy Sample.cs
sergikos7 Mar 27, 2025
5165a0f
Update Pending Order Cancelation Sample.cs
sergikos7 Mar 27, 2025
c7159e0
Update Pending Order Events.cs
sergikos7 Mar 27, 2025
46eeb4e
Update Pending Order Modification Sample.cs
sergikos7 Mar 27, 2025
ab00172
Update Pending Order Placing Sample.cs
sergikos7 Mar 27, 2025
06c2c14
Update PendingOrderCancellationReason Sample.cs
sergikos7 Mar 27, 2025
c5749a4
Update PendingOrders Sample.cs
sergikos7 Mar 27, 2025
b9fd3be
Update Polynomial Regression Channels Sample.cs
sergikos7 Mar 27, 2025
1eb60d7
Update Position Bars Passed Sample.cs
sergikos7 Mar 27, 2025
a5ee0d1
Update Position Closing Sample.cs
sergikos7 Mar 27, 2025
68002d6
Update Position Events Sample.cs
sergikos7 Mar 27, 2025
dcd7961
Update Position Execution Sample.cs
sergikos7 Mar 27, 2025
a5d8905
Update Position Modification Sample.cs
sergikos7 Mar 27, 2025
ba42f94
Update PositionCloseReason Sample.cs
sergikos7 Mar 27, 2025
07a5a0c
Update PositionCurrentPrice Sample.cs
sergikos7 Mar 27, 2025
36c7ef1
Update PositionModifiedEventArgs Sample.cs
sergikos7 Mar 27, 2025
748852f
Update Price Oscillator Sample.cs
sergikos7 Mar 27, 2025
8a580a3
Update Price ROC Sample.cs
sergikos7 Mar 27, 2025
746d5ba
Update Price Volume Trend Sample.cs
sergikos7 Mar 27, 2025
d1d1b4d
Update RSI Reversal Strategy Sample.cs
sergikos7 Mar 27, 2025
8704dbb
Update Rainbow Oscillator Sample.cs
sergikos7 Mar 27, 2025
6d17ee0
Update Range Strategy Example.cs
sergikos7 Mar 27, 2025
eb9bc13
Update RefreshData Sample.cs
sergikos7 Mar 27, 2025
1715321
Update Relative Strength Index Sample.cs
sergikos7 Mar 27, 2025
4526350
Update Simple Moving Average Sample.cs
sergikos7 Mar 27, 2025
1cf84ca
Update Standard Deviation Sample.cs
sergikos7 Mar 27, 2025
a2c3266
Update Start cBot Sample.cs
sergikos7 Mar 27, 2025
bb071dd
Update Stochastic Oscillator Sample.cs
sergikos7 Mar 27, 2025
0477173
Update StopTriggerMethod Sample.cs
sergikos7 Mar 27, 2025
f7a46d3
Update Supertrend Sample.cs
sergikos7 Mar 27, 2025
aba9611
Update Swing Index Sample.cs
sergikos7 Mar 27, 2025
28532b6
Update Time Series Moving Average Sample.cs
sergikos7 Mar 27, 2025
249eead
Update Timer Sample.cs
sergikos7 Mar 27, 2025
7897e00
Update Trade Volume Index Sample.cs
sergikos7 Mar 27, 2025
954382a
Update TradeOperation Sample.cs
sergikos7 Mar 27, 2025
363c10e
Update TradeResult Sample.cs
sergikos7 Mar 27, 2025
4622fe4
Update TradeType Sample.cs
sergikos7 Mar 27, 2025
ae8cab4
Update Triangular Moving Average Sample.cs
sergikos7 Mar 27, 2025
75ed089
Update Trix Sample.cs
sergikos7 Mar 27, 2025
864810e
Update True Range Sample.cs
sergikos7 Mar 27, 2025
3d10ee1
Update Typical Price Sample.cs
sergikos7 Mar 27, 2025
a952ae3
Update Ultimate Oscillator Sample.cs
sergikos7 Mar 27, 2025
6044d41
Update Vertical Horizontal Filter Sample.cs
sergikos7 Mar 27, 2025
e4d134b
Update Vidya Sample.cs
sergikos7 Mar 27, 2025
e352e02
Update Volume Index Sample.cs
sergikos7 Mar 27, 2025
ad35800
Update Volume Oscillator Sample.cs
sergikos7 Mar 27, 2025
5198eeb
Update Volume ROC Sample.cs
sergikos7 Mar 27, 2025
679e9a4
Update Web Sockets Sample.cs
sergikos7 Mar 27, 2025
3ca4433
Update Weighted Close Sample.cs
sergikos7 Mar 27, 2025
b156e67
Update Weighted Moving Average Sample.cs
sergikos7 Mar 27, 2025
4d8c583
Update Welles Wilder Smoothing Sample.cs
sergikos7 Mar 27, 2025
a5df645
Update Williams Accumulation Distribution Sample.cs
sergikos7 Mar 27, 2025
5fd35c0
Update WilliamsPctR Sample.cs
sergikos7 Mar 27, 2025
aeaf06b
Update ASP Section Example.cs
sergikos7 Mar 27, 2025
14da2bf
Update ActiveFrameChanged Sample.cs
sergikos7 Mar 27, 2025
74865b2
Update AlgoStatsControl.cs
sergikos7 Mar 27, 2025
b4d2bc9
Update AlgoStatsControl.cs
sergikos7 Mar 27, 2025
820dca8
Update AlgoRegistry Sample.cs
sergikos7 Mar 27, 2025
d708738
Update AlgoStatsControl.cs
sergikos7 Mar 27, 2025
089181e
Update All placements.cs
sergikos7 Mar 27, 2025
9af3808
Update BacktestingInPlugins Sample.cs
sergikos7 Mar 27, 2025
58fefa5
Update ChartId Sample.cs
sergikos7 Mar 27, 2025
fbc322e
Update ChartIndicators Sample.cs
sergikos7 Mar 27, 2025
d010b5e
Update ChartIndicatorsControl.cs
sergikos7 Mar 27, 2025
1035669
Update ChartRobots Sample.cs
sergikos7 Mar 27, 2025
2f58bc8
Update ChartRobotsControl.cs
sergikos7 Mar 27, 2025
3c41a9b
Update Commands Sample.cs
sergikos7 Mar 27, 2025
5d0ff51
Update CoordinatesConversion Sample.cs
sergikos7 Mar 27, 2025
d187c9c
Update Custom Frame Sample.cs
sergikos7 Mar 27, 2025
ae98d9c
Update Custom Toolbar Button.cs
sergikos7 Mar 27, 2025
ea1ae9e
Update Custom Window Plugin.cs
sergikos7 Mar 27, 2025
c7b0336
Update IndicatorTitles Sample.cs
sergikos7 Mar 27, 2025
f761218
Update Interactive WebView.cs
sergikos7 Mar 27, 2025
d43a698
Update My ASP Example.cs
sergikos7 Mar 27, 2025
96f2fe5
Update My Custom Frame Example.cs
sergikos7 Mar 27, 2025
7bcea03
Update Order by Margin.cs
sergikos7 Mar 27, 2025
ddb769e
Update PositionCurrentPrice Sample.cs
sergikos7 Mar 27, 2025
8fed6fc
Update Previous Bar Info.cs
sergikos7 Mar 27, 2025
3f47409
Update SmoothMouseMove Sample.cs
sergikos7 Mar 27, 2025
af615ee
Update SymbolStatsControl.cs
sergikos7 Mar 27, 2025
1615685
Update TradeControl.cs
sergikos7 Mar 27, 2025
90ce929
Update TradeWatch Tab Sample.cs
sergikos7 Mar 27, 2025
a0417c7
Update WebSocket Sample.cs
sergikos7 Mar 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update CustomHandlers Example.cs
  • Loading branch information
sergikos7 authored Mar 27, 2025
commit 5eb45237ce27847e624f764e348a595ddcd754dc
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// -------------------------------------------------------------------------------------------------
//
// This code is a cTrader Algo API example.
//
// This cBot is intended to be used as a sample and does not guarantee any particular outcome or
// profit of any kind. Use it at your own risk.
//
// This sample cBot listens to bar opening events and performs trade operations based on
// simple bullish and bearish reversal patterns.
//
// -------------------------------------------------------------------------------------------------


using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -9,30 +22,35 @@

namespace cAlgo.Robots
{
// Define the cBot attributes, such as access rights.
[Robot(AccessRights = AccessRights.None)]
public class CustomHandlersExample : Robot
{

// This method is called once at the start of the cBot's execution.
protected override void OnStart()
{
Bars.BarOpened += BullishReversal;
Bars.BarOpened += BearishReversal;
Bars.BarOpened += BullishReversal; // Add event handler for detecting bullish reversals.
Bars.BarOpened += BearishReversal; // Adds event handler for detecting bearish reversals.
}


// Handler method to check and execute trades for a bullish reversal.
private void BullishReversal(BarOpenedEventArgs args)
{
// Checks for a bullish reversal condition based on previous bar closes.
if (Bars.LastBar.Open > Bars.Last(1).Close && Bars.LastBar.Open > Bars.Last(2).Close)
{
ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, null, 10, 50);
ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, null, 10, 50); // Places a buy market order if the bullish reversal condition is met.
}
}


// Handler method to check and execute trades for a bearish reversal.
private void BearishReversal(BarOpenedEventArgs args)
{
// Checks for a bearish reversal condition based on previous bar closes.
if (Bars.LastBar.Open < Bars.Last(1).Close && Bars.LastBar.Open < Bars.Last(2).Close)
{
ExecuteMarketOrder(TradeType.Sell, SymbolName, 10000, null, 10, 50);
ExecuteMarketOrder(TradeType.Sell, SymbolName, 10000, null, 10, 50); // Places a sell market order if the bearish reversal condition is met.
}
}

Expand Down