Replies

cjdduarte
16 Apr 2015, 16:24

RE:

/api/reference/positionclosedeventargs

/api/guides/trading_api#el8

 

Kevin said:

Hey all, I asked this previously but had no response.

My robot places a market order and limit order at the same time when certain conditions are met, both with the same T/P value. Is there any way to cancel the limit order once the market order takes profit?

 


@cjdduarte

cjdduarte
14 Apr 2015, 00:38

RE:

replace "IsOverlay = false" to "IsOverlay = true"

 

domi77 said:

hello
how to put the indicator in the main window and not in a new possible or we must build it?
if so how?
Here are the indicator that interests me
cordially
excuse me I do not speak English I use google translate I'm French

/algos/indicators/show/381

 


@cjdduarte

cjdduarte
13 Apr 2015, 18:53

RE:

Copied from another forum: ". You can not calculate an angle because the chart does not have a fixed scale Change the vertical or horizontal scale and the angle changes"

Someone with a different opinion?

 

Forex19 said:

Hi, 
I wanted to ask if there is an indicator measuring the slope of a trend or if it's somehow possible.

 


@cjdduarte

cjdduarte
08 Apr 2015, 23:11

publicar el código


@cjdduarte

cjdduarte
05 Apr 2015, 00:57

RE:
There is still the possibility of implementing ?

 

admin said:

Hello,

It is in the list for future implentations. 

Regards.

 


@cjdduarte

cjdduarte
01 Apr 2015, 19:36

What I want, that's here.
Not yet implemented.

 

http://vote.spotware.com/forums/229166-ideas-and-suggestions-for-ctrader-and-calgo/suggestions/5686611-auto-start


@cjdduarte

cjdduarte
27 Mar 2015, 18:29

News about this?


@cjdduarte

cjdduarte
26 Mar 2015, 05:01

RE:

there is something equivalent to otimization?
IsOtimization?

Spotware said:

You can exclude some code from backtesting and optimization:

if (!IsBacktesting)
{
   //do something only if it is NOT backtesting
}

 

 


@cjdduarte

cjdduarte
24 Mar 2015, 13:31

I found that the problem was in the custom indicator.


@cjdduarte

cjdduarte
24 Mar 2015, 02:46

RE:

able to implement this code?
Really needed it

 

zofoyobis said:

I am trying to use this feature to create Heikin-Ashi indicator with custom timeframe as below. The value of haClose in the HeikinAshiClose series looks correct but I am always getting NaN for haOpen. I am not sure if something like below is supported?

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TFHeikinAshiIndicator : Indicator
    {
        [Parameter("Heikin-Ashi Timeframe")]
        public TimeFrame HeikinAshiTimeframe { get; set; }

        [Output("Open", Color = Colors.DarkSlateBlue)]
        public IndicatorDataSeries HeikinAshiOpen { get; set; }

        [Output("Close", Color = Colors.SlateBlue)]
        public IndicatorDataSeries HeikinAshiClose { get; set; }

        private MarketSeries heikinAshiSeries;

        protected override void Initialize()
        {
            heikinAshiSeries = MarketData.GetSeries(HeikinAshiTimeframe);
        }

        public override void Calculate(int index)
        {
            int heikinAshiSeriesIndex = GetIndexByDate(heikinAshiSeries, MarketSeries.OpenTime[index]);

            double open = heikinAshiSeries.Open[heikinAshiSeriesIndex];
            double high = heikinAshiSeries.High[heikinAshiSeriesIndex];
            double low = heikinAshiSeries.Low[heikinAshiSeriesIndex];
            double close = heikinAshiSeries.Close[heikinAshiSeriesIndex];

            double haClose = (open + high + low + close) / 4;
            double haOpen;
            if (heikinAshiSeriesIndex != -1)
                haOpen = (HeikinAshiOpen[heikinAshiSeriesIndex - 1] + HeikinAshiClose[heikinAshiSeriesIndex - 1]) / 2;
            else
                haOpen = (open + close) / 2;

            ChartObjects.DrawText("ha", string.Format("heikinAshiSeriesIndex={0} haOpen={1}, haClose={2}", heikinAshiSeriesIndex, haOpen, haClose), StaticPosition.TopLeft, Colors.Red);

            HeikinAshiOpen[heikinAshiSeriesIndex] = haOpen;
            HeikinAshiClose[heikinAshiSeriesIndex] = haClose;
        }

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

 

 


@cjdduarte

cjdduarte
23 Mar 2015, 05:42

RE: RE:

It Works.
Sometimes complicate the simple.
Tanks!

tradermatrix said:

cjdduarte said:

I have 2 robots. An optimized only to buy and the other just optimized to sell.
How are robots with different parameters, eventually happens the two buy / sell at the same time.

How do I get both to recognize and when a sell another wait to buy and vice versa?

did you try to give the same label your two robots ?

 

 


@cjdduarte

cjdduarte
18 Mar 2015, 16:21

RE:

Corrected?

 

Spotware said:

Thank you for reporting this. We will investigate and fix it as soon as possible.

 


@cjdduarte

cjdduarte
17 Mar 2015, 13:49

RE:

Interestingly, had not read this topic.
I will try to do what you asked.

 

ABR170173 said:

Hi,

Does someone could to glue all these codes together correctly? (Base Zig Zag code, 1st post correction and next 4th post correction to 1st post)

I've tried to do it by myself but my C# is definitely too weak at this level.

Many thanks

 


@cjdduarte

cjdduarte
28 Feb 2015, 05:16

// MultiCharts Custom Criteria: Pessimistic Return on Margin (PROM) by Robert Pardo

// Change the value below to your account size
var AccountSize = 10000;

/* The code below can be left untouched  */

// check for errors / wrong values
if (AccountSize < 1 || StrategyPerformance.WinningTrades == 0 ||
    StrategyPerformance.LosingTrades == 0) {
    return 0;
}

var sqrtWins = Math.sqrt(StrategyPerformance.WinningTrades);
var sqrtLosses = Math.sqrt(StrategyPerformance.LosingTrades);

return ( ((StrategyPerformance.AvgWinningTrade * (StrategyPerformance.WinningTrades - sqrtWins) ) -
    ( -StrategyPerformance.AvgLosingTrade * (StrategyPerformance.LosingTrades + sqrtLosses) )) /
    AccountSize) * 100;

 


@cjdduarte

cjdduarte
28 Feb 2015, 05:16

RE:

Thanks for the info. Looking more about it, I found this code.
I will implement it as a test.

modarkat said:

There are other interesting functions you can implement in GetFitness:

http://tradinggame.com.au/introduction-to-backtesting-metrics-part-2/

My favorite one is PROM.

 

 


@cjdduarte

cjdduarte
26 Feb 2015, 18:40

I contacted the support of FxPro and was told that probably next week, will update.


@cjdduarte

cjdduarte
26 Feb 2015, 16:00

Code?


@cjdduarte

cjdduarte
26 Feb 2015, 13:40 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE: RE:

If you put an IF condition to your criteria and it returns 1 if true and 0 if false and put it as a multiplying factor, should work.

davidp13 said:

Hi, any comment or suggestion on the question below? Thanks

davidp13 said:

Spotware said:

Custom optimzation criterion has been added:

If Custom criterion is chosen you need to override GetFitness method in your cBot and provide a fitness values based on GetFitnessArgs. The higher fitness the value, the better.

Example 1:

protected override double GetFitness(GetFitnessArgs args)
{
        return args.WinningTrades / args.LosingTrades;//maximize count of winning trades and minimize count of losing trades
}

Example 2: 

protected override double GetFitness(GetFitnessArgs args)
{
        return Math.Pow(args.WinningTrades, 2) / args.LosingTrades;//count of winning trades is more important than count of losing trades
}

 

Hi. This is a very cool function and I would like to specify my own customer criteria. You do have the standard criteria to minimize Equity Drawdown, but I would like to specify the Max drawdown allowed. For example I want all outcomes for an equity drawdown of larger than 25% to be excluded in the results. Can you please help me with this?

Thank you in advance.

 

 


@cjdduarte

cjdduarte
26 Feb 2015, 13:30

protected override double GetFitness(GetFitnessArgs args)
        {
            //maximize count of winning trades and minimize count of losing trades
            return (Math.Pow(args.NetProfit, 3) * Math.Pow(args.WinningTrades, 2) * (TakeProfit/StopLoss)) / (Math.Pow(args.MaxEquityDrawdownPercentages, 2) * TakeProfit * StopLoss * args.MaxEquityDrawdown);
            //return (args.NetProfit * args.WinningTrades) / (args.MaxEquityDrawdownPercentages * StopLoss);
        }

 


@cjdduarte

cjdduarte
26 Feb 2015, 13:30

Always found problems in optimization keep Takprofit greater than the stoploss and still have a consistent gain. The modification below by dividing the (takeprofit / stoploss), he seeks the best results tend to keep esssa major / minor relationship. And put the end to keep both (if possible) lower, as in my case use in M15.

It Works ...


@cjdduarte