Topics
Replies
cAlgoFx
19 Dec 2014, 10:27
RE:
Ian_Drummond said:
Hi all,
I'd like to place events on individual trades in my robot, the code below allows an event to be taken after each individual robot has been open for a certain time X...
I'm trying to convert this so that I can place an event after X pips or X gross profit, etc..... It's proving a real head scratcher, can anyone help? Any input would be greatly appreciated...
DateTime currTime = Time;
// The current time.
int posCount = Positions.Count;
// Total positions.
for (int i = posCount - 1; i >= 0; i--)
{
// Total time elapsed for a trade.
int elapsedMinutes = (int)(currTime.Subtract(Positions[i].EntryTime).TotalMinutes);
if (elapsedMinutes == X )
{
foreach (var position in Positions)
{
int elapsedMinutes = (Server.Time.Day * 24 * 60 + Server.Time.Hour * 60 + Server.Time.Minute) - (position.EntryTime.Day * 24 * 60 + position.EntryTime.Hour * 60 + position.EntryTime.Minute);
if (elapsedMinutes == 1)
{
//Do something//;
}
}
@cAlgoFx
cAlgoFx
18 Jun 2014, 09:45
( Updated at: 21 Dec 2023, 09:20 )
RE:
MRSV said:
Hi
Saw this today, and wonderd if it were a chart bug or not
Found it a little hard to belive that GBPJPY jumped 3000 pips
Check with other brokerages for same issue;it's usually a problem from liquidity provider.Hope your trades were unaffected.
@cAlgoFx
cAlgoFx
06 May 2014, 13:05
RE: RE:
cAlgoFx said:
breakermind said:
Hi,
Is somewhere an example how to write positions history to csv file?
Thanks
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Internals;
using System.IO;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class NewcBot : Robot
{
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
private StreamWriter _Writer;
protected override void OnStart()
{
// Put your initialization logic here
var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
var filePath = Path.Combine(desktopFolder, "MyPositions.csv");
_Writer = File.AppendText(filePath);
_Writer.AutoFlush = true;
foreach (HistoricalTrade trade in History)
{
_Writer.WriteLine(trade.PositionId);
}
}
protected override void OnTick()
{
// Put your core logic here
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
You can write all position attributes to a row with:
_Writer.WriteLine(trade.PositionId + "," + trade.EntryTime + "," + trade.EntryPrice);
@cAlgoFx
cAlgoFx
06 May 2014, 12:51
RE:
breakermind said:
Hi,
Is somewhere an example how to write positions history to csv file?
Thanks
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Internals;
using System.IO;
namespace cAlgo
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class NewcBot : Robot
{
[Parameter(DefaultValue = 0.0)]
public double Parameter { get; set; }
private StreamWriter _Writer;
protected override void OnStart()
{
// Put your initialization logic here
var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
var filePath = Path.Combine(desktopFolder, "MyPositions.csv");
_Writer = File.AppendText(filePath);
_Writer.AutoFlush = true;
foreach (HistoricalTrade trade in History)
{
_Writer.WriteLine(trade.PositionId);
}
}
protected override void OnTick()
{
// Put your core logic here
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
@cAlgoFx
cAlgoFx
26 Apr 2014, 09:32
( Updated at: 21 Dec 2023, 09:20 )
RE: RE: RE:
alifarooq said:
breakermind said:
Hi,
I do not know just what to put as many small items instead of one large for long period. always comes out better, and do not need so often to make a decision which way. the same result can be achieved by one position.
Besides insert an image without code is like for me to make any sense.
On the other hand, if you score corresponds to not have to brag about:]
But always backtest everything looks good only in the real world there is no second chance : P (calgo, connection or robot can always suspend at one position always safer)Bye.
my latest work.
Hello,
You forgot to include your broker's commissions.Keep working.
Happy hunting
@cAlgoFx
cAlgoFx
05 Apr 2014, 09:42
RE:
cAlgoFx said:
Use these linq statements for lines 54 && 55;
var longProfit = Positions.Where(pos => pos.Label == label && pos.SymbolCode == Symbol.Code && pos.TradeType == TradeType.Buy).Sum(pos => pos.GrossProfit);
var shortProfit = Positions.Where(pos => pos.Label == label && pos.SymbolCode == Symbol.Code && pos.TradeType == TradeType.Sell).Sum(pos => pos.GrossProfit);Should get you sorted.
Happy hunting
Don't forget pos.Label==LABEL.
@cAlgoFx
cAlgoFx
05 Apr 2014, 09:32
Use these linq statements for lines 54 && 55;
var longProfit = Positions.Where(pos => pos.Label == label && pos.SymbolCode == Symbol.Code && pos.TradeType == TradeType.Buy).Sum(pos => pos.GrossProfit);
var shortProfit = Positions.Where(pos => pos.Label == label && pos.SymbolCode == Symbol.Code && pos.TradeType == TradeType.Sell).Sum(pos => pos.GrossProfit);
Should get you sorted.
Happy hunting
@cAlgoFx
cAlgoFx
03 Feb 2014, 19:49
( Updated at: 21 Dec 2023, 09:20 )
Jedi_Lat
A demo version of our live trading robot is available on the cAlgo Robots section of our website.All necessary settings are automated so you only have
select the right currency pair(UsdJpy and XauUsd only) and Timeframe(5Min) before you start the robot.
We welcome feedback's as they will be very helpful.
Happy hunting.
@cAlgoFx
cAlgoFx
06 Jan 2014, 14:40
RE: RE:
The new version is currently undergoing extensive Live testing,will be available soon to our clients.
regards
Niyo_Soul said:
cAlgoFx said:
Hello Traders,
Our flagship Robot JEDISCALPER is now available on our website for your test drive.Please use on EURJPY pair.
Get it on www.calgofx.com.
Happy hunting.
Pls advise where to find this bot.
@cAlgoFx
cAlgoFx
01 Jan 2014, 12:13
The new year
Hello everyone,
We welcome the new year with open arms and a great expectation of success in our various endeavours especially trading.
In reflection, alongside the challenges we faced earlier in delivering service, the previous year has seen us explore a plethora
of possibilities with the ctrader/calgo platforms while creating ultimate black boxes for ourselves and our clients.
Also, the past year has seen good algorithms put to test in the ever intriguing and sophisticated forex market to expose their
inherent weaknesses and afford us an opportunity to leverage the strengths for greater success.
This year, we will strive to deliver great service and be in the forefront of developing the best algorithms for the ctrader platform.
Also, we will make our live trading bots more available to our clients at no cost; which will make a proper addition to their trading arsenal.
We encourage the perusal of our robots performance by our clients; it helps us improve when we receive your remarks and
commendations.
Thank you,2014 is going to be a good year.
Happy hunting
@cAlgoFx
cAlgoFx
27 Dec 2013, 11:09
RE: RE:
Please send your request to support@calgofx.com or contact us through the consultants section of this website.
Thanks
GoldnOil said:
cAlgoFx said:
Our coding service is free for our FxPro clients only or starts at £70 per robot.
On establishing an understanding of clients strategy,each robot will take an average of 2 days to complete.
Please be concise with your strategy and needs; include pictures if possible.
Happy hunting
A simple Buy and Sell Robot
Name : SK Pips Buy Sell Robot - Dec'13
Concept :
This would be simple robot that "opens a position" of Buy or Sell depending on certain conditions.
User Inputs :
(1) "Select Item" = Gold, Silver or Currencies or Oil
(2) "Start Price" = 1190 (when this price is crossed, the robot will trigger. i.e. it starts
(3) "Open Buy" = +200 pips (when a certain Pips as defined are reached, then an BUY position is opened, and a 'Current Pip' is reset to zero again)
(4) "Delay Buy Time" = 60 sec (the time robots waits, before opening a Buy position and sees the price is still above +200 pips or as defined by user in # (3).
(5) "Open Sell" = -150 pips (when a certain Pips as defined are reached, then a SELL position is opened, a 'Current Pip' is reset to zero again)
(6) "Delay Sell Time" = 60 sec (the time robots waits, before opening a SELL position and sees the price is still above +200 pips or as defined by user in # (5), then only it opens the Sell Position.
(7) "Numbers of Buy" = 5 (max. numbers of buys to open)
(8) "Numbers of Sell" = 3 (max. numbers of sells to open)
(9) "Buy Size" = 10 oz (the size of the position to be opened)
(10) "Sell Size" = 5 oz (the size of the position to be opened)
(11) "Stop Equity Profit" = +USD 100 (if this increase is reached in the original equity, the Robots close all positions).
(12) "Stop Equity Loss" = -USD 20 (if this decrease is reached in the original equity, the Robots close all positions).
(13) "Warning" = 500% margin (to flag a margin on screen, through flashing and sound that margin is lower, then the defined user limit.
(14) "After Close All" = repeat or stop (if all transactions has been closed, then should the Robot start again or stop and wait for user)
Some constants and values :
(a) Master Pips : it records the the overall Pips status, when the Robot started.
(b) Current Pip : it is reset to 'zero', when ever a Position is opened and Robot always checks it value before opening a position
(c) Total Buy Count = records the number of buy position has been opened so far.
(d) Total Sell Count = records the number of buy position has been opened so far.
The Theme :
Robot activates/starts when certain price as mentioned is reached.
Now it watches the pips as defined by the user.
When the price increases by that certain pips as mentioned by the user, it starts monitoring the time as mentioned by the user, and if after that time has passed and the PRICE is still above that certain pips mentioned by the user, IT OPENS the position, resets the 'current pips' back to zero and monitor the price again. It opens position on the 'current pips' value and not on 'master pips' value.
It only opens DEFINED number of BUYS & SELLs by the user. And when equity has reached a certain defined target, it closes all the positions and start again or wait for the user.
It has some warning for the user to take control, and disengage the robot.
(tell me how many days, and what will you charge me? I can pay by western union, but on personal name and not company name).
@cAlgoFx
cAlgoFx
29 Oct 2013, 15:57
//Robot by cAlgoFx//
///////////////////
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Requests;
using cAlgo.Indicators;
using System.Linq;
namespace cAlgo.Robots
{
[Robot()]
public class EMA2 : Robot
{
[Parameter(DefaultValue = 20000, MinValue = 10000)]
public int Volume { get; set; }
[Parameter("Code", DefaultValue = 555, MinValue = 555)]
public int code { get; set; }
private Position position;
private MovingAverage _ema2;
protected override void OnStart()
{
_ema2 = Indicators.MovingAverage(MarketSeries.Close, 2, MovingAverageType.Exponential);
}
protected override void OnBar()
{
var count_pos = Account.Positions.Count(position => position.Label == code.ToString() && position.SymbolCode == Symbol.Code);
bool buy = MarketSeries.Close.IsRising() && MarketSeries.Close.LastValue >= _ema2.Result.LastValue;
bool sell = MarketSeries.Close.IsFalling() && MarketSeries.Close.LastValue <= _ema2.Result.LastValue;
if (count_pos < 1 && Symbol.Spread < 5)
{
if (buy)
{
var request = new MarketOrderRequest(TradeType.Buy, Volume)
{
Label = code.ToString(),
SlippagePips = 5,
StopLossPips = 20,
TakeProfitPips = 20
};
Trade.Send(request);
}
else if (sell)
{
var request = new MarketOrderRequest(TradeType.Sell, Volume)
{
Label = code.ToString(),
SlippagePips = 5,
StopLossPips = 20,
TakeProfitPips = 20
};
Trade.Send(request);
}
}
}
}
}
@cAlgoFx
cAlgoFx
28 Oct 2013, 12:38
Service is back
Our coding service is up and running again thanks to our new programmer.Also,we have successfully converted our most reliable robots
to execute On-Bar instead of the usual On-Tick and have seen better results since.
Our live trading robot is currently available only to professional traders and can be found on our site calgofx.com.
Happy hunting
@cAlgoFx
cAlgoFx
28 May 2015, 23:22
RE:
MZen said:
We cannot promote any brokerage but advise you choose a broker based on reputation and liquidity.
@cAlgoFx