waym77
waym77's avatar

Info

Username:waym77
Name:waym77
Member since: 22 Jul 2021

About

None

Signature

None

Last Forum Posts

@cTrader API angle method:  23 Sep 2022, 08:51


Hi,

I am looking to add a feature of angle measurement to an indicator and was wondering if the cTrader API has such a method?

I see that trendlines have this feature:

Does this exist in the API? If not, is there an easy method I can create myself to calculate this?

@18000% backtesting bot doesn't perform good on live trading:  23 Sep 2022, 08:48


Real-world market conditions are always different from backtests. I once created a bot based on the stochastic oscillator with a similar style of TP (1-5 pips) that gave me a 150,000% increase over a 10-year backtest. It then proceeded to lose money instantly. 

In reality, you should only backtest a bot to see if it works as intended (creating positions when conditions are met). I would suggest forward testing via demo as a more viable way to test this, as most brokers' demo accounts simulate current liquidity scenarios.

@Indicator that draws horizontal lines on the high/low:  31 Aug 2022, 17:46


Hi,

I am trying to make an indicator that draws horizontal lines on the high/low for the specified number of days. Can anyone assist?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class DailySR : Indicator
    {
        [Parameter("Period", Group = "Default", DefaultValue = 5, MinValue = 1)]
        public int Period { get; set; }
        
        Bars _bars;
        double[] min, max;

        protected override void Initialize()
        {
            _bars = MarketData.GetBars(TimeFrame.Daily);
        }

        public override void Calculate(int index)
        {
            for (int i = 0; i < Period; i++)
            {
                min[i] = _bars.LowPrices.Last(i++);
                max[i] = _bars.HighPrices.Last(i++);
                Chart.DrawHorizontalLine("Upline_" + i++.ToString(), max[i], Color.White, 1, LineStyle.DotsRare);
                Chart.DrawHorizontalLine("Downline_" + i++.ToString(), min[i], Color.White, 1, LineStyle.DotsRare);
            }
        }
    }
}

Thanks,

@Minimum number of bars since moving average crossover:  21 Jul 2022, 16:55


Hi,

I created an indicator that counts the bars since a triple EMA crossover, it needs to reach the minimum count before signaling entries.

The count stays stuck at 1 though. Any advice?

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        ExponentialMovingAverage _fast, _medium, _slow;

        double _trend_min_length;

        protected override void Initialize()
        {
            _slow = Indicators.ExponentialMovingAverage(Bars.ClosePrices, 12);
            _medium = Indicators.ExponentialMovingAverage(Bars.ClosePrices, 26);
            _fast = Indicators.ExponentialMovingAverage(Bars.ClosePrices, 50);

            _trend_min_length = 5;
        }

        public override void Calculate(int index)
        {
            int _bull_count = 0;
            int _bear_count = 0;

            if (_fast.Result.LastValue > _medium.Result.LastValue && _medium.Result.LastValue > _slow.Result.LastValue)
            {
                _bear_count = 0;
                _bull_count++;
                Print("Bull Count #{0}: {1}", index, _bull_count);
            }

            if (_fast.Result.LastValue < _medium.Result.LastValue && _medium.Result.LastValue < _slow.Result.LastValue)
            {
                _bull_count = 0;
                _bear_count++;
                Print("Bear Count #{0}: {1}", index, _bear_count);
            }

            if (_bull_count >= _trend_min_length)
            {
                Print("Is Bullish, Can Look For Buys");
            }

            if (_bear_count >= _trend_min_length)
            {
                Print("Is Bearish, Can Look For Sells");
            }
        }
    }
}

@cTrader Fill or Kill Orders:  14 Jul 2022, 09:04


PanagiotisCharalampous said:

Hi waym77,

No, cTrader does not support FOK orders at the moment.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi,

Thanks for the response. Are FoK orders on Spotware's timeline at the moment?

@cTrader Fill or Kill Orders:  13 Jul 2022, 17:03


Hi,

I have a simple question regarding cTrader limit orders.

Are Limit Orders Fill or Kill by default? If not, is there an option to set it as such?

I would like to avoid partial fills as much as possible.

@Question about order types and execution speed:  13 Jul 2022, 12:54


Hi,

I have a question regarding cTrader copy and the relationship between Provider and Copier accounts.

If all else is equal (leverage and balance) between the Provider and Copier, are order equal as well?

What I mean by this is:

a) if the Provider places a limit order at a set price, does the Copier also place a limit order, or does the Copier create a market order as soon as the limit is filled for the Provider

b) how does execution speed look between Provider and Copier? Is it asynchronous in the case of multiple Copiers?

Thanks

@Draw ahead of current index:  06 Jul 2022, 08:56


PanagiotisCharalampous said:

Hi waym77,

You can't use Bars.OpenTimes because it does not contain the time you want. You need to set the actual time you need.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi, 

Thanks, would you mind providing me with an example related to the DrawText? Wouldn't the time specified be needed to be adjusted for each timeframe?

I'm unfamiliar with DateTime, as I've only ever used Bars.OpenTimes for Chart Objects until now.

@Draw ahead of current index:  05 Jul 2022, 14:25


PanagiotisCharalampous said:

Hi waym77,

There is nothing special about this. You just need to use the starting and ending time you need.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hi Panagiotis, 

Thanks for the reply.

That I do understand, regarding X being related to OpenTimes.Last. My confusion is more in the sense of how to draw ahead of LastValue?

For instance:

Chart.DrawText("Object", "Sample", Bars.OpenTimes.Last(?), Bars.HighPrices.LastValue, Color.White);

The (?) is where my confusion is.

Thanks,

@Draw ahead of current index:  04 Jul 2022, 14:01


Hi,

I would like an indicator to draw text values ahead of index time, e.g. this rectangle:

Please advise API guide for this?

Thanks.

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.

No uploaded.

Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.