Topics
Forum Topics not found
Replies
cAlgo_Fanatic
11 Apr 2013, 09:29
Yes there are plans for implementing custom indicators on cTrader Web version.
@cAlgo_Fanatic
cAlgo_Fanatic
10 Apr 2013, 14:55
So, for instance if Target3 = 50100 and TrailDistance = 200
Start: equity = 50000
Trigger: equity = 50100
Trail: equity = 50300
Trail: equity = 50500
Retrace: equity = 50300
If the above is correct please, try this code:
protected override void OnTick() { if (!isTriggered) { if( Account.Equity >= Target3) { isTriggered = true; trailingEquity = Account.Equity; Print("Triggered at {0}", Account.Equity); } } else { if (Account.Equity - trailingEquity >= TrailDistance) { trailingEquity = Account.Equity; Print("Trailing Equity {0}", trailingEquity); } else if (Account.Equity - trailingEquity <= -TrailDistance) { Print("Retraced equity = {0}", Account.Equity); Trade.Close(position); } } }
@cAlgo_Fanatic
cAlgo_Fanatic
10 Apr 2013, 12:52
It will be implemented in the future. We cannot give a time estimate at the moment.
@cAlgo_Fanatic
cAlgo_Fanatic
10 Apr 2013, 10:59
It is not possible at the moment to change the color scheme. We are working on a solution for integration with Visual Studio, though.
@cAlgo_Fanatic
cAlgo_Fanatic
10 Apr 2013, 10:46
Yes, it is possible to define the X-Y coordinates in the DrawText method.
Please see the syntax in the API Reference: DrawText.
@cAlgo_Fanatic
cAlgo_Fanatic
09 Apr 2013, 17:47
It will be available for cTrader as well in a future release.
@cAlgo_Fanatic
cAlgo_Fanatic
09 Apr 2013, 10:54
Hi,
It is not possible yet to highlight the background or shade an area on the chart. It will be implemented in the future.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 18:02
Depending on which is the AverageTrueRange indicator that you downloaded (you need to check that code) you may need to replace Result (in this indicator ) with either atr or ATR.
You need to check the name of the Output IndicatorDataSeries property.
i.e.
[Output("Average True Range", Color = Colors.Blue)] public IndicatorDataSeries ATR { get; set; }
Or change the name of the AverageTrueRange indicator Output property to Result and rebuild it.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 17:16
This is implemented for cTrader Web and it will be available on the next release. It will be available on cTrader windows as well, soon.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 12:57
Hello,
int, double, string, DataSeries, MovingAverageType. More types will be supported in the future.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 11:00
( Updated at: 21 Dec 2023, 09:20 )
You can do this in cTrader Web by adding a check mark next to a saved template.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 10:48
Is this what you need? If you need help understanding the code please let us know. We are here to help you learn cAlgo in order to build powerful indicators and robots.
//#reference: AverageTrueRange.algo using System; using cAlgo.API; using cAlgo.API.Indicators; namespace cAlgo.Indicators { [Indicator(IsOverlay = true)] public class FibGrid7Chart : Indicator { private AverageTrueRange _averageTrueRange; private ExponentialMovingAverage _exponentialMovingAverage; [Parameter(DefaultValue = 55)] public int PeriodEma { get; set; } [Parameter(DefaultValue = 21)] public int PeriodAtr { get; set; } [Output("Upper Band 1", Color = Colors.DarkCyan)] public IndicatorDataSeries UpperBand1 { get; set; } [Output("Upper Band 2", Color = Colors.DarkCyan)] public IndicatorDataSeries UpperBand2 { get; set; } [Output("Upper Band 3", Color = Colors.DarkCyan)] public IndicatorDataSeries UpperBand3 { get; set; } [Output("Upper Band 4", Color = Colors.DarkCyan)] public IndicatorDataSeries UpperBand4 { get; set; } [Output("Lower Band 1", Color = Colors.DarkGreen)] public IndicatorDataSeries LowerBand1 { get; set; } [Output("Lower Band 2", Color = Colors.DarkGreen)] public IndicatorDataSeries LowerBand2 { get; set; } [Output("Lower Band 3", Color = Colors.DarkGreen)] public IndicatorDataSeries LowerBand3 { get; set; } [Output("Lower Band 4", Color = Colors.DarkGreen)] public IndicatorDataSeries LowerBand4 { get; set; } [Output("EMA", Color = Colors.Blue)] public IndicatorDataSeries Ema { get; set; } protected override void Initialize() { _averageTrueRange = Indicators.GetIndicator<AverageTrueRange>(PeriodAtr); _exponentialMovingAverage = Indicators.ExponentialMovingAverage(MarketSeries.Close, PeriodEma); } public override void Calculate(int index) { if (!IsRealTime) return; for (int i = index - 10; i <= index; i++) { double ema = _exponentialMovingAverage.Result[index]; double atr = _averageTrueRange.Result[index]; UpperBand1[i] = ema + 1.62*atr; UpperBand2[i] = ema + 2.62*atr; UpperBand3[i] = ema + 4.23*atr; UpperBand4[i] = ema + 1*atr; LowerBand1[i] = ema - 1.62*atr; LowerBand2[i] = ema - 2.62*atr; LowerBand3[i] = ema - 4.23*atr; LowerBand4[i] = ema - 1*atr; Ema[i] = ema; } for (int i = 0; i < index - 10; i++) { UpperBand1[i] = double.NaN; UpperBand2[i] = double.NaN; UpperBand3[i] = double.NaN; UpperBand4[i] = double.NaN; LowerBand1[i] = double.NaN; LowerBand2[i] = double.NaN; LowerBand3[i] = double.NaN; LowerBand4[i] = double.NaN; Ema[i] = double.NaN; } int xPos = index + 1; double yPos = UpperBand1[index]; string text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj1", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Lime); yPos = UpperBand2[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj2", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Yellow); yPos = UpperBand3[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj3", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.White); yPos = UpperBand4[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj4", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red); yPos = LowerBand1[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj5", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Lime); yPos = LowerBand2[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj6", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Yellow); yPos = LowerBand3[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj7", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.White); yPos = LowerBand4[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj8", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Red); yPos = Ema[index]; text = String.Format("{0}", Math.Round(yPos, Symbol.Digits)); ChartObjects.DrawText("obj9", text, xPos, yPos, VerticalAlignment.Top, HorizontalAlignment.Left, Colors.Blue); } } }
Consider uploading this as well as the previous indicator to the Indicators section as a courtesy to the rest of the developers community.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 10:16
User time will be added to cTrader Web in the next release.
@cAlgo_Fanatic
cAlgo_Fanatic
08 Apr 2013, 10:08
There is no plan at the moment to change the skin of the platform. You may only change the chart colors.
@cAlgo_Fanatic
cAlgo_Fanatic
05 Apr 2013, 09:46
I understand what you mean but this is not an error. This is the way it is supposed to be. For as long as you understand how it works you can use it properly. Moreover, you can design your own cutom indicators as you like.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Apr 2013, 16:04
Those variables need to be declared in the outer scope:
for instance:
namespace cAlgo.Robots { [Robot] public class NewRobot : Robot { private Position position; private bool targetlevel1; private bool targetlevel2; [Parameter] public double Target1 { get; set; } [Parameter] public double Stopout1 { get; set; } [Parameter] public double Target2 { get; set; } [Parameter] public double Stopout2 { get; set; } protected override void OnStart() { Trade.CreateBuyMarketOrder(Symbol, 10000); } protected override void OnTick() { if (Account.Equity >= Target1) targetlevel1 = true; if (Account.Equity >= Target2) targetlevel2 = true; if (targetlevel2 && Account.Equity <= Stopout2) Trade.Close(position); else if (targetlevel1 && Account.Equity <= Stopout1) Trade.Close(position); } protected override void OnPositionOpened(Position openedPosition) { position = openedPosition; } protected override void OnPositionClosed(Position closedPosition) { Stop(); } } }
@cAlgo_Fanatic
cAlgo_Fanatic
04 Apr 2013, 14:17
But then you are assigning a value at index which should be the value at the previous index. In other words, you are shifting back 1 bar.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Apr 2013, 14:08
To find the 5% of the Account balance it is Account.Balance * 0.05.
One lot is 100000, so to trade one lot you will set the volume to 100000.
@cAlgo_Fanatic
cAlgo_Fanatic
04 Apr 2013, 11:14
Hello,
This gives you the maximum allowed trading volume given the account equity.
It rounds to 10000. So, if the calculation result is 4936423 it would round it to 4930000.
Please clarify what you mean by the "equivalent volume for a lot size = 5"
@cAlgo_Fanatic
cAlgo_Fanatic
11 Apr 2013, 09:51
At the moment window coordinates are not supported. It may be implemented in the future.
Only time (X) - price(Y) and Static Positions.
It seems that StaticPosition.TopLeft should serve your purpose of having the balance displayed at a visible place on the chart.
@cAlgo_Fanatic