Topics
Forum Topics not found
Replies
cAlgo_Fanatic
19 Sep 2013, 15:46
( Updated at: 21 Dec 2023, 09:20 )
Correlation Coefficient
The correlation coefficient compares how currency pairs have moved in relation to each other.
The correlation coefficient formula is:
using System; using cAlgo.API; using cAlgo.API.Internals; namespace cAlgo.Indicators { [Levels(-1, -0.5, 0, 0.5, 1)] [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, ScalePrecision = 2)] public class CorrelationCoefficient : Indicator { private MarketSeries series2; private Symbol symbol2; [Parameter(DefaultValue = "EURUSD")] public string Symbol2 { get; set; } [Parameter(DefaultValue = 22)] public int Period { get; set; } [Output("Correlation Coefficient", Color = Colors.Yellow)] public IndicatorDataSeries Result { get; set; } protected override void Initialize() { symbol2 = MarketData.GetSymbol(Symbol2); series2 = MarketData.GetSeries(symbol2, TimeFrame); } public override void Calculate(int index) { if (index < Period) return; double sumX = 0, sumY = 0, sumXY = 0, sumX2 = 0, sumY2 = 0; double x, y, x2, y2; int index2 = GetIndexByDate(series2, MarketSeries.OpenTime[index]); if (index2 == -1) return; for (int i = 0; i < Period; i++) { x = MarketSeries.Close[index - i]; y = series2.Close[index2 - i]; x2 = x * x; y2 = y * y; sumX += x; sumY += y; sumXY += x * y; sumX2 += x2; sumY2 += y2; } Result[index] = (Period * (sumXY) - sumX * sumY) / Math.Sqrt((Period * sumX2 - sumX * sumX) * (Period * sumY2 - sumY * sumY)); } private int GetIndexByDate(MarketSeries series, DateTime time) { for (int i = series.Close.Count - 1; i >= 0; i--) { if (time == series.OpenTime[i]) return i; } return -1; } } }
@cAlgo_Fanatic
cAlgo_Fanatic
19 Sep 2013, 15:29
Indicator Example 2
Multiple symbol information displayed on the chart.
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; namespace cAlgo.Indicators { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC)] public class MultiSymbolMarketInfo : Indicator { private Symbol symbol1; private Symbol symbol2; private Symbol symbol3; [Parameter(DefaultValue = "EURGBP")] public string Symbol1 { get; set; } [Parameter(DefaultValue = "GBPUSD")] public string Symbol2 { get; set; } [Parameter(DefaultValue = "EURUSD")] public string Symbol3 { get; set; } protected override void Initialize() { symbol1 = MarketData.GetSymbol(Symbol1); symbol2 = MarketData.GetSymbol(Symbol2); symbol3 = MarketData.GetSymbol(Symbol3); } public override void Calculate(int index) { if (!IsLastBar) return; var text = FormatSymbol(symbol1) + "\n" + FormatSymbol(symbol2) + "\n" + FormatSymbol(symbol3); ChartObjects.DrawText("symbol1", text, StaticPosition.TopLeft, Colors.Lime); } private string FormatSymbol(Symbol symbol) { var spread = Math.Round(symbol.Spread / symbol.PipSize, 1); return string.Format("{0}\t Ask: {1}\t Bid: {2}\t Spread: {3}", symbol.Code, symbol.Ask, symbol.Bid, spread); } } }
@cAlgo_Fanatic
cAlgo_Fanatic
19 Sep 2013, 10:54
In order to expedite our investigation of this issue we need you to send us the following information to engage@spotware.com
1. Run "dxdiag" command and click Save All Information. Send us the DxDiag.txt file.
2. Record a video while putting some objects on the chart (like lines, rectangles, circles, text, etc.)
3. Record a video while re-sizing the chart, re-sizing the application window and changing chart modes.
We appreciate your help in this matter.
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 12:52
It will be possible soon. We plan to introduce the new trading API in the near future.
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 11:59
Please see: Multi-symbol robots and indicators & Multi-timeframe robots/indicators
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 11:59
Please see: Multi-symbol robots and indicators & Multi-timeframe robots/indicators
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 11:58
Please see: Multi-symbol robots and indicators & Multi-timeframe robots/indicators
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 11:58
( Updated at: 23 Jan 2024, 13:16 )
Please see: [Multi-symbol robots and indicators] & Multi-timeframe robots/indicators
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 11:57
Please see: Multi-symbol robots and indicators & Multi-timeframe robots/indicators
@cAlgo_Fanatic
cAlgo_Fanatic
17 Sep 2013, 11:24
Please visit this page for updated information on Timeframes:
Multi-timeframe robots/indicators
@cAlgo_Fanatic
cAlgo_Fanatic
16 Sep 2013, 17:04
Hello,
We are looking into this issue. In order to expedite our investigation we would like to request you to send us some information if possible to engage@spotware.com
1. Run "dxdiag" command and click Save All Information. Send us the DxDiag.txt file. (Please see run command if you are not familiar with this)
2. Record a video while putting some objects on the chart (like lines, rectangles, circles, text, etc.)
3. Record a video while re-sizing the chart, re-sizing the application window and changing chart modes.
(For recording video see: http://windows.microsoft.com/en-us/windows-8/camera-app-faq)
We appreciate your help in this matter.
@cAlgo_Fanatic
cAlgo_Fanatic
16 Sep 2013, 12:35
( Updated at: 15 Jan 2024, 14:51 )
Hello,
Thank you for the suggestion. We are currently working on improving the documentation on cAlgo.
For the time being you can find examples for the above requests here:
how open order and close order or sl,tp
Market Order Request
Create Market Order
Close
Full List of Trade Requests - Create Market Order Requests, Pending Orders
Trade Interface - Create & Send to Server Market Order Requests, Pending Orders
AccountEquity()
Equity
Full List of Account Interface
MarketInfo()
Symbol Interface
Symbol()
NormalizeDouble()
Math.Round(double value, int digits)
OrderSend()
Note: The above is only used in combination with Requests. It is not necessary if Trade Interface methods are used.
GetLastError()
OnError() & [ErrorCode]
Point
See also PipSize
OrdersTotal()
Account.Positions.Count & Account.PendingOrder.Count
See also: Lists
OrderSelect()
Not Applicable.
See these examples:
OnPositionOpened
/api/position example with foreach loop.
In general see all methods under Robot
For all below see Position Interface & Pending Order Interface
OrderMagicNumber()
Position Label & Pending Order Label
OrderProfit()
OrderOpenPrice()
OrderClose()
OrderTicket()
OrderLots()
Position Volume & Pending Order Volume
OrderSymbol()
Position.Symbol & Pending Order Symbol
OrderType()
Position TradeType
Pending Order TradeType
@cAlgo_Fanatic
cAlgo_Fanatic
16 Sep 2013, 09:59
Hello,
150k EURUSD is not 150k USD in value. It is 150k EUR in value. Therefore, 65 / million x 150k EUR is approximately 85 USD / million.
@cAlgo_Fanatic
cAlgo_Fanatic
13 Sep 2013, 10:32
RE:
kricka said:
Hi,
It seems the moment one mention a broker on the forum you'll get removed by the moderator! It would be nice if a thread with rules is started by the moderator regarding what is permitted by members and what is not, would be a great help for members posting.
Thanks..
Please avoid any broker discussions, they are prohibited on cTDN.
@cAlgo_Fanatic
cAlgo_Fanatic
12 Sep 2013, 17:58
Multi-timeframe for indicators and robots has been released: Please see /forum/whats-new/1463
@cAlgo_Fanatic
cAlgo_Fanatic
12 Sep 2013, 16:53
RE:
Lgon said:
Hello Support,
In the advanced stop loss feature it's not possible to trail a stop with a trail higher than 500 pips. When you're trading gold (e.g. xauusd) you should be able to use larger trails.
Waitin for your comments
We understand 500 pips is not enough for gold and we will try to update this soon in order to accept higher values.
@cAlgo_Fanatic
cAlgo_Fanatic
12 Sep 2013, 16:43
RE: RE:
matnoga said:
admin said:
Hello,
Partial close of positions is not yet available in the cAlgo API but it will be implemented in the future.
Have you already implemented Partial Close of Positions in cAlgo API?
If no, when we can expect that? This is one of the basic feature, which is needed in most of trading strategies, so this update should have high priority.
It is not available yet but it is in the list of high priorities and we will try to release it soon.
@cAlgo_Fanatic
cAlgo_Fanatic
12 Sep 2013, 16:35
RE:
cicondo said:
Hey @all,
I'm looking for developing robots based on different time frames.
The main execution of the robot will be executed on a 5min time frame, but some indicators or rules
should be calculated on a longer time frame (1h e.g.) .Is there any solution for that? I couldn't found some stuff around that.
Please advice....
Thx a lot :-)
Please see /forum/whats-new/1463
@cAlgo_Fanatic
cAlgo_Fanatic
23 Sep 2013, 11:49
This is a bug which will be fixed in the next release.
@cAlgo_Fanatic