Topics
Forum Topics not found
Replies
amusleh
20 Jun 2022, 09:49
Hi,
You have to contact the software developer and report them this issue, this error happens if the number of Open API requests per second exceeded the limitation, you can find more detail at: https://help.ctrader.com/open-api/proxies-endpoints/#limitations
@amusleh
amusleh
20 Jun 2022, 09:24
Hi,
You can use synchronized crosshair indicator: Synchronized Crosshair Indicator | Algorithmic Forex Trading | cTrader Community
@amusleh
amusleh
20 Jun 2022, 09:22
( Updated at: 20 Jun 2022, 09:23 )
Hi,
You just have to iterate over a data series points with a loop and find the minimum or maximum values.
DateSeries itself has minimum and maximum extension methods:
Minimum Method - cTrader Automate API
Maximum Method - cTrader Automate API
You can also use a for loop or Linq.
@amusleh
amusleh
20 Jun 2022, 09:18
Hi,
You have to check your account smarginLevelThreshold , and you can change the threshold.
Here you can find more detail: Messages - cTrader Open API
@amusleh
amusleh
17 Jun 2022, 11:00
Hi,
Historical price data are created from live price data, they are not different at all.
The issue you faced is a bug, it's not because the historical data is generated from different price data.
We were able to reproduce this issue and it will be fixed on next release of cTrader web.
@amusleh
amusleh
17 Jun 2022, 10:58
RE: RE: RE: Any Australian brokers yet?
ctid4797769 said:
amusleh said:
ctid2514471 said:
Are any Australian brokers offering Desktop 4.2 as yet?
The Australian brokers just say "We offer cTrader" - But they don't specify which version.The improvements here sound awesome, as a few of the improvements address issues that made me give up on my algorithmic trading ideas.
Hi,
All cTrader brokers will be updated to latest version eventually, we are rolling out version 4.2 slowly for all brokers.
Do we know who will be the first and a more specific when? There are key features we have been waiting for so I think everybody want to move :-)
Hi,
We can't give you any ETA, we already released version 4.2 for some brokers, it will be released for other brokers in near future.
@amusleh
amusleh
17 Jun 2022, 10:56
Hi,
All technical indicators last value will keep changing until it closes, so for tow hour stochastic you have to wait two hours for the last value to close and then use it, otherwise it can keep changing based on bar price changes.
It's not a bug nor a problem of cTrader, it's same across all platforms and it's how technical indicators work, and yes they are lagging.
@amusleh
amusleh
17 Jun 2022, 10:53
Hi,
You can pass another time frame Bars to ADX indicator:
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class ADXOtherTimeFrame : Robot
{
private DirectionalMovementSystem _adx;
private Bars _otherTimeFrameBars;
[Parameter("Other Time Frame")]
public TimeFrame OtherTimeFrame { get; set; }
[Parameter("Periods")]
public int Periods { get; set; }
protected override void OnStart()
{
_otherTimeFrameBars = MarketData.GetBars(OtherTimeFrame);
_adx = Indicators.DirectionalMovementSystem(_otherTimeFrameBars, Periods)
}
}
}
@amusleh
amusleh
17 Jun 2022, 10:47
Hi,
A position comment or label can be null, so you have to check them before dereferencing them otherwise you will get null reference exception.
You should your code to:
private void Positions_Opened(PositionOpenedEventArgs obj)
{
BeginInvokeOnMainThread(() =>
{
var psn = obj.Position;
Print(GlobalSymbolName + "::Event Positions Opened....");
if (psn.SymbolName.Equals(GlobalSymbolName, StringComparison.Ordinal) && psn.TradeType == TradeType.Buy && !string.IsNullOrWhiteSpace(psn.Comment) && psn.Comment.Contains("AO", StringComparison.Ordinal))
{
Print(GlobalSymbolName + "Buy Opened Position opened id====" + psn.Id);
// GlobalBuyPositionsIds.Add(obj.Position.Id);
// GlobalBuyPositionsIds.TrimExcess();
// Print(SymbolName + "GlobalBuyPositionsidList=" + GlobalBuyPositionsIds[0]);
}
if (psn.SymbolName.Equals(GlobalSymbolName, StringComparison.Ordinal) && psn.TradeType == TradeType.Sell && !string.IsNullOrWhiteSpace(psn.Comment) && psn.Comment.Contains("AO", StringComparison.Ordinal))
{
Print(GlobalSymbolName + "Sell Opened Position opened id====" + psn.Id);
// GlobalSellPositionsIds.Add(obj.Position.Id);
// GlobalSellPositionsIds.TrimExcess();
// Print(SymbolName + "GlobalSellPositionsidList=" + GlobalSellPositionsIds[0]);
}
}
);
}
@amusleh
amusleh
17 Jun 2022, 10:25
Hi,
Can you tell what do you mean by overall Pips? cTrader Pips column shows the amount of Pips for your Position which you can get via Pips property of a Position.
To calculate it programmatically you can subtract the current price from Position entry price:
private double GetPositionPips(Position position)
{
var symbol = Symbols.GetSymbol(position.SymbolName);
return Math.Round((position.TradeType == TradeType.Buy ? symbol.Bid - position.EntryPrice : position.EntryPrice - symbol.Ask) / symbol.PipSize, 1);
}
@amusleh
amusleh
16 Jun 2022, 10:08
Hi,
Your indicator code has a bug, you access the Last(1) which means there should be at least two bars inside Bars collection two access the last second one, and if it's the first bar then it throws argument out of range exception.
You should check IsLastBar of Index == 0, try this:
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class DailyPriceLines : Indicator
{
private Bars _bars;
[Parameter("High", DefaultValue = true)]
public bool High { get; set; }
[Parameter("Low", DefaultValue = true)]
public bool Low { get; set; }
[Parameter("Open", DefaultValue = true)]
public bool Open { get; set; }
[Parameter("Close", DefaultValue = true)]
public bool Close { get; set; }
[Parameter("High Color", DefaultValue = "Red")]
public string HighColor { get; set; }
[Parameter("Low Color", DefaultValue = "Lime")]
public string LowColor { get; set; }
[Parameter("Open Color", DefaultValue = "Transparent")]
public string OpenColor { get; set; }
[Parameter("Close Color", DefaultValue = "Transparent")]
public string CloseColor { get; set; }
protected override void Initialize()
{
_bars = MarketData.GetBars(TimeFrame.Daily);
}
public override void Calculate(int index)
{
// This or index == 0 will fix the issue
if (!IsLastBar) return;
if (High)
Chart.DrawHorizontalLine("Daily Heigh", _bars.HighPrices.Last(1), HighColor, 1, LineStyle.Dots);
if (Low)
Chart.DrawHorizontalLine("Daily Low", _bars.LowPrices.Last(1), LowColor, 1, LineStyle.Dots);
if (Open)
Chart.DrawHorizontalLine("Daily Open", _bars.OpenPrices.Last(1), OpenColor, 1, LineStyle.Dots);
if (Close)
Chart.DrawHorizontalLine("Daily Close", _bars.ClosePrices.Last(1), CloseColor, 1, LineStyle.Dots);
}
}
}
@amusleh
amusleh
20 Jun 2022, 09:53
Hi,
Try this:
@amusleh