
Topics
Replies
modarkat
05 Aug 2014, 11:33
The following link could help you:
http://msdn.microsoft.com/en-us/library/system.windows.clipboard(v=vs.100).aspx
@modarkat
modarkat
05 Aug 2014, 09:06
The following article could help:
http://www.dreamincode.net/forums/topic/34745-creating-your-own-rss-reader-in-c%23/
@modarkat
modarkat
17 Jul 2014, 09:44
here you go:
int GetBarsAgo(Position position) { for (var i = MarketSeries.OpenTime.Count - 1; i >= 0; i--) { if (position.EntryTime > MarketSeries.OpenTime[i]) return MarketSeries.OpenTime.Count - 1 - i; } return -1; } protected override void OnTick() { var barsAgo = GetBarsAgo(position); if (barsAgo > 5) { ClosePosition(position); } }
@modarkat
modarkat
16 Jun 2014, 16:52
This link could help you:
http://www.codeproject.com/Articles/383138/BadImageFormatException-x-i-x
@modarkat
modarkat
10 Jun 2014, 12:21
RE: Extracting data from ctrader to cvs. file
czeslaw said:
Spotware said:
Yes, we plan to implement Visual Backtesting in the near future.
Hi I wonder how to extract file with historical data in order to write in cvs. file containing: date, time, maximum, minimum, open and close. Thank you for your support.
You can use this cBot:
/algos/cbots/show/495
@modarkat
modarkat
30 May 2014, 09:38
Calculating Volume based on fixed risk and stop loss
private long GetVolume(double risk, int stopLossPips) { var moneyToInvestInDepositCurrency = Account.Balance * risk; var moneyToInvestInQuoteCurrency = moneyToInvestInDepositCurrency / (Symbol.PipValue / Symbol.PipSize); var volume = moneyToInvestInQuoteCurrency / (stopLossPips * Symbol.PipSize); var normalizedVolume = Symbol.NormalizeVolume(volume); return normalizedVolume; }
example of usage with risk 25% and SL 10 pips
var risk = 0.25; var stopLossPips = 10; var volume = GetVolume(risk, stopLossPips); ExecuteMarketOrder(TradeType.Buy, Symbol, volume, null, stopLossPips, null);
@modarkat
modarkat
29 May 2014, 16:11
RE:
rkokerti said:
Dear Developers,
As you previously said "Even if trading is not possible platform can receive new prices which could produce new bar." OK I accept that, I do not understand why, but it's not important...
Therefore, I need to open the half of the positions by manually. In this case very difficult to set the proper SL/TP levels and set the position sizing.
So, please help me to handle this problem with a sample code.
Thanks in advance!
You can try the following snippet
while (true) { ExecuteMarketOrder(TradeType.Buy, Symbol, Symbol.VolumeMin); if (LastResult.IsSuccessful) { break; } else { Thread.Sleep(1000); } }
@modarkat
modarkat
27 May 2014, 09:20
There are two ways to do that.
First of all you can convert moving average value to pips distance from a spot price.
Another way is to execute market order without TP and then modify TP as an absolute value.
ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, label, StopLossPips, null); if (LastResult.IsSuccessful) { ModifyPosition(LastResult.Position, LastResult.Position.StopLoss, mAverage); }
@modarkat
modarkat
22 Apr 2014, 09:59
Yes, it is possible. Look at code of this indicator: News - DailyFx Economic Calendar.
@modarkat
modarkat
31 Mar 2014, 10:25
cAlgo.API.Color is equalent to System.Drawing.Color:
http://safeery2k.files.wordpress.com/2013/06/system-drawing-knowncolor.png
@modarkat
modarkat
14 Aug 2014, 11:48
http://en.wikipedia.org/wiki/Ask_price
@modarkat