fzlogic's avatar
fzlogic
fzlogic's avatar

Info

Username:fzlogic
Name:fzlogic
Member since: 06 Aug 2012

Favorite symbols:

EURUSD, GBPUSD, EURJPY, AUDUSD, GBPJPY, USDCAD

About

None

Signature

None

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);                
            }

@Indicators Timing or Kwan for cTrader?:  02 Dec 2013, 15:36


Why not upload this to the indicators?

@Tick volume:  28 Nov 2013, 17:24


Tick volume is number of trades.

@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?

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Aroon Oscilator
  0
  0
  3326
free  21 Jun 2013
The difference between Aroon Up and Aroon Down in a histogram display. The Aroon Oscillator is the difference between Aroon-Up and Aroon-Down. These two indicators are usually plotted together for easy comparison, but chartists can also view the difference of these two indicators with the Aroon Oscillator. This indicator fluctuates between -100 and +100 with zero as the middle line. A bullish trend bias is present when the oscillator is positive, while a bearish trend bias exists when the oscillator is negative. Chartists can also expand the bull-bear threshold to identify stronger signals. [http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:aroon_oscillator]  
Countdown Timer Display
  10
  5
  6299
free  25 Jan 2013
Display of countdown to the next bar on the chart. W1 and M1 Timeframes are not supported.
Traders Dynamic Index
  2
  0
  10011
free  22 Jan 2013
A combination of Relative Strength Index, Bollinger Bands and Moving Averages. Strategy: Buy: The Price line is above the Signal line and above the middle Bollinger Band line. Sell: The Signal line is above the Price line and  middle Bollinger Band line. The Bollinger Bands show the strength and direction of the trend.  
BBandStopLine
  3
  5
  4250
free  07 Sep 2012
Bollinger Bands Stop Line. Use this indicator to enter and exit trades.  If price moves above the upper stop line enter long and below the bottom one enter a short trade. Then the opposite band is used as trailing stop loss.  
free  06 Aug 2012
The FDI ranges between 1.0 and 2.0. FDI approaches 1.0 when prices tend to move in a one-dimensional straight line. Conversely, the more closely prices look like a two-dimensional plane, the closer the FDI moves to 2.0. A trend causes the FDI to move down, and we can expect the trend to end when the FDI reaches the 1.35 level. The FDI does not indicate if the trend will reverse sharply, or if prices will begin to range, but that prices should reverse to perform like a fractal again soon.  FDI will move up if the market is not trending. When the FDI reaches 1.55, then a new trend is expected to start. The FDI does not indicate which way prices will break, only that a break should be coming soon.    
free  06 Aug 2012
SMI Indicator is used to predict the trend prevailing in the market i.e. either bullish or bearish. The trend is bearish if its SMI Output is below 40. Conversely, an SMI Output of above 40 indicates a bullish trend. In SMI, when the current closing price is greater than the Midpoint of High/Low Range, the outcome is above zero. Similarly, when the Current Close is less than the Midpoint of High/Low Range, than SMI is below zero. SMI uses a wide range that can vary from a negative value of -100 to a positive value of +100. In order to smooth the results of SMI, a Moving Average is determined, a.k.a. Stochastic %D.  
free  06 Aug 2012
A coherent unification model for trend indicators and oscillators is to technical analysis what a unification model of the micro-cosmos and the macro-cosmos is to physics. Although both models may still be far from being constructed, there is nonetheless a way of using trend indicators and oscillators to derive virtually instantaneous signals.      
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.