
fzlogic

Info
Username: | fzlogic |
Name: | fzlogic |
Member since: | 06 Aug 2012 |
Favorite symbols:
About
Signature
Last Forum Posts
@Risk on all open positions: 22 Jan 2014, 17:39
Isn't that the sum of all positions net profit?
kricka said:
Hi,
I'm just after to print the amount at risk based on all opened positions. So counting total volume, stop loss and pip value on all opened positions might do the trick.
Any suggestion for a code to achieve this?
Thanks..
@Alternative to the missing event "OnPendingOrderDeleted"?: 21 Jan 2014, 12:27
using System; using System.Linq; using cAlgo.API; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC)] public class NewRobot : Robot { private int _counter; [Parameter(DefaultValue = 5000)] public int Volume { get; set; } [Parameter(DefaultValue = 1)] public int expMinutes { get; set; } protected override void OnTick() { if (_counter < 2) { PlaceStopOrder(TradeType.Sell, Symbol, Volume, Symbol.Ask - Symbol.PipSize * 10, "Lable", 10, 10, Server.Time.AddMinutes(expMinutes)); _counter++; Print(_counter); } else { var pendingOrder = PendingOrders.FirstOrDefault(order => order.Label == "Lable"); if (pendingOrder == null) { Position position = Positions.Find("Lable"); if (position == null) { _counter = 0; Print("order expired counter = {0}", _counter); } } } } } }
@How do I close my position?: 16 Jan 2014, 12:58
I think with QuickTrade disabled you can only right click on the position and close
@Closed by robot or manually: 30 Dec 2013, 12:51
OnPositionsClosed will be triggered before PositionClosedByRobot and the result will be that flag_robot_close will not serve the intended purpose.
Try setting the flag_robot_close to true before calling ClosePositionAsync.
if (myPosition != null && breakeven_flag && distance_1) { flag_robot_close = true; ClosePositionAsync(myPosition, PositionClosedByRobot); }
@equivalent indicator command in cAlgo (MT4 istochastic): 28 Nov 2013, 17:15
main is the percentK (green line) and signal is the percentD (red line).
StochasticOscillator stochOsc; protected override void OnStart() { stochOsc = Indicators.StochasticOscillator(9, 3, 9, MovingAverageType.Simple); } protected override void OnTick() { if (stochOsc.PercentK.LastValue > stochOsc.PercentD.LastValue) { // } }
@Debug cAlgo Robot in Visual Stuio: 18 Nov 2013, 15:30
fzlogic said:
hichem said:
pparpas said:I am in the process of finding the best possible automated platform that covers my needs. By using cAlgo, is there any way to debug robots by using Visual Studio? I have made many trials using Visual Studio and trying to attach the debugger to calgo process with no luck.
Debugging a robot in Visual Studio is possible. But you should compile the robot to a .dll file with Visual Studio. Then you should reference the generated .dll in cAlgo and after executing the robot in cAlgo you should attach VS debugger.
Hi Hichem,
Thanks for the useful tip. I create a robot that is derived from the class of the referenced dll, I manage to debug by calling base.OnStart and base.OnTick but I am using indicators for the calculations and their values are always zero.
More specifically, I am trying to debug Artificial Intelligence robot found here: /algos/robots/show/46
So this is the code of the robot that is referencing Artificial Intelligence:
//#reference: ..\..\..\Visual Studio 2010\Projects\AI\AI\bin\Debug\AI.dll // ------------------------------------------------------------------------------- // // /algos/robots/show/46 // // ------------------------------------------------------------------------------- using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC)] public class AI : ArtificialIntelligence { private MacdHistogram macd; protected override void OnStart() { // Put your initialization logic here macd = Indicators.MacdHistogram(21, 20, 3); base.OnStart(); } protected override void OnTick() { // Put your core logic here Print(macd.Histogram.LastValue); base.OnTick(); } } }
I made the macd public in the base class and initialized it in the derived class and now I have values for it. I don't know if this is a good way to do this.
public class AI : ArtificialIntelligence { private MacdHistogram mcd; protected override void OnStart() { mcd = Indicators.MacdHistogram(21, 20, 3); base.macd = mcd; }
@Debug cAlgo Robot in Visual Stuio: 18 Nov 2013, 15:08
hichem said:
pparpas said:I am in the process of finding the best possible automated platform that covers my needs. By using cAlgo, is there any way to debug robots by using Visual Studio? I have made many trials using Visual Studio and trying to attach the debugger to calgo process with no luck.
Debugging a robot in Visual Studio is possible. But you should compile the robot to a .dll file with Visual Studio. Then you should reference the generated .dll in cAlgo and after executing the robot in cAlgo you should attach VS debugger.
Hi Hichem,
Thanks for the useful tip. I create a robot that is derived from the class of the referenced dll, I manage to debug by calling base.OnStart and base.OnTick but I am using indicators for the calculations and their values are always zero.
More specifically, I am trying to debug Artificial Intelligence robot found here: /algos/robots/show/46
So this is the code of the robot that is referencing Artificial Intelligence:
//#reference: ..\..\..\Visual Studio 2010\Projects\AI\AI\bin\Debug\AI.dll // ------------------------------------------------------------------------------- // // /algos/robots/show/46 // // ------------------------------------------------------------------------------- using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot(TimeZone = TimeZones.UTC)] public class AI : ArtificialIntelligence { private MacdHistogram macd; protected override void OnStart() { // Put your initialization logic here macd = Indicators.MacdHistogram(21, 20, 3); base.OnStart(); } protected override void OnTick() { // Put your core logic here Print(macd.Histogram.LastValue); base.OnTick(); } } }
@Convert String to Symbol - Error CS0118: 'cAlgo.API.Internals.Algo.Symbol' is a 'property' but is used like a 'type': 13 Nov 2013, 15:20
It looks like you're putting the code in the wrong place. Can you provide more code?