Topics
Replies

firemyst
12 Jan 2020, 17:36

RE: RE:

firemyst said:

PanagiotisCharalampous said:

Hi firemyst,

Because this part of the code was not executed. The indicator is initialized only after it has been added on the chart. If you need the parameter to show a value, you need to put a default value.

Best Regards,

Panagiotis 

Join us on Telegram

 

I'm confused@Panagiotis, because I do add it to the chart as I said in the comments in the code. Let me repeat them here:

//Unexpected behavior in cTrader?
//Add this indicator to any chart. 
//Leave the parameter blank. It should "set" the value to "Hello" in the Initialize method. 
//Call up the parameter window again for this indicator
//the value "Hello" isn't displayed even though it has been set.
//Why not?

After it's added to the chart, if you call up the indicator to view the properties, it's blank.

Hence why the cTrader window says, "Modify indicator" instead of "Add indicator" (when it's first being addedto the chart).

 

Any updates @Panagiotis? Have you been able to reproduce the issue with the code I've provided above?

 


@firemyst

firemyst
07 Jan 2020, 11:02

RE:

PanagiotisCharalampous said:

Hi firemyst,

Because this part of the code was not executed. The indicator is initialized only after it has been added on the chart. If you need the parameter to show a value, you need to put a default value.

Best Regards,

Panagiotis 

Join us on Telegram

 

I'm confused@Panagiotis, because I do add it to the chart as I said in the comments in the code. Let me repeat them here:

//Unexpected behavior in cTrader?
//Add this indicator to any chart. 
//Leave the parameter blank. It should "set" the value to "Hello" in the Initialize method. 
//Call up the parameter window again for this indicator
//the value "Hello" isn't displayed even though it has been set.
//Why not?

After it's added to the chart, if you call up the indicator to view the properties, it's blank.

Hence why the cTrader window says, "Modify indicator" instead of "Add indicator" (when it's first being addedto the chart).


@firemyst

firemyst
07 Jan 2020, 10:59

RE: RE:

PanagiotisCharalampous said:

firemyst said:

@Panagiotis / Spotware:

Does this answer still hold true?

I want to retrieve historical spread data in indicator and bot code, and I can't seem to find a way to get historical spread values, or (at the very least) historical bid/ask prices on each historical candle close

Is there a way to do this?

Thank you.

Hi firemyst,

To find the historical spread just check the difference the historical bid/ask prices when running backtesting using tick data.

Best Regards,

Panagiotis 

Join us on Telegram

 

 

Sorry for the confusion -- I meant is it possible to get this data programmatically? Eg, in cbot code what can I do to get the historical data in real time if it's possible? For example, if I'm on the H1 timeframe, and currently at the 11am candle, if I want to obtain the spread in the cbot code at the close of the 8am candle, how would I do it?

Thank you.


@firemyst

firemyst
05 Jan 2020, 07:58

@Panagiotis / Spotware:

Does this answer still hold true?

I want to retrieve historical spread data in indicator and bot code, and I can't seem to find a way to get historical spread values, or (at the very least) historical bid/ask prices on each historical candle close

Is there a way to do this?

Thank you.


@firemyst

firemyst
02 Jan 2020, 05:22

RE: RE: precision if stopLoss or takeProfit is specified in pips

thomas.abele said:

PanagiotisCharalampous said:

Hi FireMyst,

Backtesting is a simulation of the trading on your machine. It does not communicate with the server and it does not account for all possible parameretes of a cBot's runtime. The specific error is sent by the server where the checks are a bit more strict. I would advise you to test your cBots on a demo account as well before moving to a live trading account.

Best Regards,

Panagiotis 

Hi Panagiotis,

I saw for most Symbols the precision for stopLoss or takeProfit specified in pips is 1 digit. But for e.g. XAUUSD it is 0 digits.

Is there a way to find out programatically what the precision is?

Kind Regards,

Thomas

 

@Thomas:

Is Symbol.Digits what you're looking for? https://ctrader.com/api/reference/internals/symbol


@firemyst

firemyst
19 Dec 2019, 08:40

RE:

PanagiotisCharalampous said:

Hi FireMyst,

As far as I know it is the close price which is considering only the bid price.

Best Regards,

Panagiotis 

Join us on Telegram

 

Thanks @Panagiotis.

Any chance your team is going to include this popular indicator in an upcoming release of cTrader?


@firemyst

firemyst
16 Dec 2019, 10:56

RE:

PanagiotisCharalampous said:

Hi zedodia,

Do you have specific steps that will allow us to reproduce this problem?

Best Regards,

Panagiotis

HI @Panagiotis:

I haven't seen any updates on this, so have sent you an email with a video attached on another way to reproduce the issue.

The email has "https://ctrader.com/forum/ctrader-support/22249?page=1" in the subject.


@firemyst

firemyst
10 Dec 2019, 14:54

RE:

PanagiotisCharalampous said:

Hi firemyst,

I have checked this is the past and it seems to be an issue with the way the values are calculated for each bar in the real time and what happens when some ticks are missed. I haven't tried to solve it but I would try to recalculate the value of each closed bar when the bar changes and the OHLC data for the previous bar is finalized. 

Best Regards,

Panagiotis 

Join us on Telegram

Thanks @Panagiotis.

That gives me a good starting point.


@firemyst

firemyst
10 Dec 2019, 14:38

RE:

PanagiotisCharalampous said:

Hi firemyst,

Supertrend is a custom indicator and if you are using the one available in the forum, it has a lot of defects. This is one of them.

Best Regards,

Panagiotis 

Join us on Telegram

 

If I post the code would you be able to have a quick look and see what the problem is? I'd like to know how I can alter the code to overcome this defect. Or at least what's causing it and why it happens.


@firemyst

firemyst
05 Dec 2019, 06:31

RE:

gowens.c@gmail.com said:

Also to note: they allowed US citizens to use cTrader, Spotware did, until about 3 or 4months ago. Why?

 

I want someone from Spotware to answer my question

Out of curiosity, did you ever receive a response? I don't see any in this thread, but that's not to say they didn't message you separately. I know a few people in the USA who would like to use cTrader.

Thanks :-)


@firemyst

firemyst
05 Dec 2019, 02:11 ( Updated at: 21 Dec 2023, 09:21 )

RE:

PanagiotisCharalampous said:

Hi FireMyst,

https://ctrader.com/forum/ctrader-support/22129 Yes

https://ctrader.com/forum/ctrader-support/21482 No

https://ctrader.com/forum/ctrader-support/21540 No 

https://ctrader.com/forum/calgo-support/21534 No

Please join our Telegram group where we report such updates e.g. 

Best Regards,

Panagiotis 

Join us on Telegram

 

HI @Panagiotis:

Thank you for the updates. I think you need to at least update thread 22129 then to indicate to everyone it has been resolved :-)

As for Telegram - we have the forums - how hard is it to create a separate forum and/or a read-only thread and include the updates there? Users should not have to download another application and join yet another Spotware group in that application to now find out the latest updates.

Or is Spotware going to put a Directory on their website that tells users what they should do and where they should go to get certain information?

  •  Spotware.com -> product information, sales information, download actual products
  •  Facebook -> latest sales/marketing promotions
  •  cTrader.com -> forums and latest API announcements
  •  Telegram -> latest change release logs

etc etc etc.

Getting a bit ridiculous don't you think?

How many 3rd party applications, services, and systems does Spotware want us to sign up to in order to use and get information on their products?

 

 

 

 


@firemyst

firemyst
04 Dec 2019, 11:19

RE:

PanagiotisCharalampous said:

Hi FireMyst,

At the moment there is no release notes for minor updates. We try to update the relevant threads when fixes are released and also report the changes in our Telegram group.

Best Regards,

Panagiotis 

Join us on Telegram

 

No worries.

Have any of these been fixed yet?

http://ctrader.com/forum/ctrader-support/22129

https://ctrader.com/forum/ctrader-support/21482

https://ctrader.com/forum/ctrader-support/21540

 

https://ctrader.com/forum/calgo-support/21534 

(if your response, " That is not so clear, currently in that case `TradeResult.IsSuccessful = true; TradeResult.ErrorCode = null`. In future versions it will be more clear, `ErrorCode` won't be null. " has been implemented yet?)

 

Thank you.


@firemyst

firemyst
04 Dec 2019, 02:50

RE: RE:

alphabet_asa said:

PanagiotisCharalampous said:

Hi alphabet_asa,

PipValue will give you the value of a pip in your account's currency. If your account currency is the same with the quote currency then PipValue and PipSize will match.

Best Regards,

Panagiotis

Thank you for the reply! If that's the case then how do I get the currency's exchange rate?

HI @alphabet_asa:

Unless I'm missing something, isn't that what the Forex quote (Symbol.Bid, Symbol.Ask) is showing?

For example, if you're looking at the AUDUSD forex pair, and the price quoted is 0.68, then the exchange rate is 1 AUD = $0.68 USD.

Similarly, if you're looking at USDAUD, and the price quoted is $1.46, then the exchange rate is 1 USD = $1.46 AUD.

If you're looking at a foreign market index, then lookup the forex pair of your currency vs that index's currency. Thus, if you're trading the US Dow (US30), and your local currency is New Zealand Dollars, then get the symbol price for either USDNZD or NZDUSD, following the examples above depending on which currency is listed first in the forex pair.


@firemyst

firemyst
04 Dec 2019, 02:37

RE:

tgjobscv said:

How reverse profitable green to red color ?!!!!!!!!!!!!!!!!!!!!!!!!!!!!

How reverse less red to green ?!!!!!!!!!!!!!!!!!

Where is setting ?

 

Why ?

Becouse green relaks me.

Red increse.

I know I suggested and provided this feedback to Spotware a while ago too. Every other charting package allows the user to set different colors for indicators to show whether their values are increasing or decreasing. For whatever reason, Spotware hasn't implemented this basic feature. So until then, it's left to you as the user to either develop your own indicator which does it, or find indicators that have the option.


@firemyst

firemyst
29 Nov 2019, 13:36

RE:

PanagiotisCharalampous said:

Hi FireMyst,

Yes please, if you can record a video it would be helpful.

Best Regards,

Panagiotis

I've figured out how to reproduce it one way.

1) Create an indicator where Overlay = false

2) Load it onto a chart in cTrader and set a Level property of 0 to color yellow.

3) Save the chart as a template

4) load the indicator's source code in Visual Studio

5) make some changes to it.

6) Save and recompile the indicator

7) Load up cTrader

8) The Level 0 line on the indicator will probably be gone

9) reload the template

10) the line reappears

11) close and reopen cTrader. The line disappears again.

12) reload the template to have the line reappear

13) change the visual studio code and recompile the indicator

14) the Level 0 line will reset and disappear again.

15) reload the template

16) close cTrader

17) reopen cTrader and the line is gone again.

18) delete the indicator.

19) reapply the indicator to the chart and change the level 0 line to yellow.

20) save the template.

21) close/reopen cTrader.

Now the line will stay on the chart until the code is updated again. At that point, the settings for the Level lines do not stay.

 

Hope this helps.


@firemyst

firemyst
27 Nov 2019, 16:55

RE:

Panagiotis Charalampous said:

Hi FireMyst,

Any chance we can get the indicator code?

Best Regards,

Panagiotis

Yup. Here it is. Looking at it further now, it seems like the values might be changing slightly for the lines to disconnect, but then I don't understand why the lines reconnect when it's redrawn.

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

namespace cAlgo.Indicators
{
    [Levels(0.0)]
    [Indicator("OSMA (DaveLoz)", IsOverlay = false, AccessRights = AccessRights.None)]
    public class OSMA : Indicator
    {
        [Parameter()]
        public TimeFrame SourceTimeFrame { get; set; }

        [Parameter(DefaultValue = 12)]
        public int ShortCycle { get; set; }

        [Parameter(DefaultValue = 26)]
        public int LongCycle { get; set; }

        [Parameter(DefaultValue = 9)]
        public int Period { get; set; }

        [Output("UpTrend", LineColor = "Green", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries UpTrend { get; set; }

        [Output("DownTrend", LineColor = "Red", PlotType = PlotType.DiscontinuousLine, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries DownTrend { get; set; }

        [Output("Main", LineColor = "Cyan", PlotType = PlotType.Line, LineStyle = LineStyle.Solid, Thickness = 2)]
        public IndicatorDataSeries Result { get; set; }

        MacdHistogram macd;
        private MarketSeries _marketSeries;
        private DataSeries _dataSeries;
        private double _result = 0;
        private double _resultIndexMinus1 = 0;
        private int _previousIndex = Int32.MaxValue;
        private int _trend = 0;

        protected override void Initialize()
        {
            if (SourceTimeFrame != null)
                _marketSeries = MarketData.GetSeries(Symbol.Name, SourceTimeFrame);
            else
                _marketSeries = MarketData.GetSeries(Symbol.Name, MarketSeries.TimeFrame);

            _dataSeries = _marketSeries.Close;
            macd = Indicators.MacdHistogram(_dataSeries, ShortCycle, LongCycle, Period);
        }

        public override void Calculate(int index)
        {
            int altIndex = index;

            if (MarketSeries.TimeFrame != _marketSeries.TimeFrame)
            {
                altIndex = _marketSeries.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index]);
            }

            if (altIndex < 2)
                return;

            _result = macd.Signal[altIndex] - macd.Histogram[altIndex];
            Result[index] = _result;
            UpTrend[index] = Double.NaN;
            DownTrend[index] = Double.NaN;

            _resultIndexMinus1 = Result[index - 1];

            if (_previousIndex < altIndex)
            {
                DownTrend[index] = Double.NaN;
                UpTrend[index] = Double.NaN;
                if (_result > _resultIndexMinus1)
                {
                    UpTrend[index] = _result;
                    UpTrend[index - 1] = _resultIndexMinus1;
                    if (UpTrend[index - 1] == DownTrend[index - 1] && UpTrend[index - 2] == DownTrend[index - 2])
                    {
                        DownTrend[index - 1] = Double.NaN;
                    }
                    _trend = 1;
                }
                else if (_result < _resultIndexMinus1)
                {
                    DownTrend[index] = _result;
                    DownTrend[index - 1] = _resultIndexMinus1;
                    if (UpTrend[index - 1] == DownTrend[index - 1] && UpTrend[index - 2] == DownTrend[index - 2])
                    {
                        UpTrend[index - 1] = Double.NaN;
                    }
                    _trend = -1;
                }
                else
                {
                    DownTrend[index] = Double.NaN;
                    UpTrend[index] = Double.NaN;
                    if (_trend == 1)
                    {
                        UpTrend[index] = _resultIndexMinus1;
                    }
                    else if (_trend == -1)
                    {
                        DownTrend[index] = _resultIndexMinus1;
                    }
                }
            }
            else
            {
                UpTrend[index] = Double.NaN;
                DownTrend[index] = Double.NaN;
                if (_trend == 1)
                {
                    UpTrend[index] = _resultIndexMinus1;
                }
                else if (_trend == -1)
                {
                    DownTrend[index] = _resultIndexMinus1;
                }
            }
            _previousIndex = altIndex;
        }
    }
}

 


@firemyst

firemyst
27 Nov 2019, 10:15 ( Updated at: 21 Dec 2023, 09:21 )

Here's the PSAR again in the middle of the candle. UK100 M1 chart from today. Pepperstone cTrader v3.6


@firemyst

firemyst
20 Nov 2019, 14:59 ( Updated at: 21 Dec 2023, 09:21 )

RE: RE:

One more example -- the candle just went through the PSAR, then came back up. But it flipped the PSAR as expected because the "close" price passed through it to form the low:


@firemyst

firemyst
20 Nov 2019, 14:46 ( Updated at: 21 Dec 2023, 09:21 )

RE:

Panagiotis Charalampous said:

Hi FireMyst,

Shouldn't it be flipped when the close price passes through and not the high/low?

Best Regards,

Panagiotis

Yes. And the CLOSE did pass through it. When a candle is open, the close is the current price until the actual candle closes. I believe that's what the cbot frame returns with MarketSeries.Close.Last(0) for every OnTick.

Thus when the price went down through the PSAR to form the low, the close would have passed the PSAR, and should have flipped it.

Here's an example from another broker's platform:


@firemyst

firemyst
20 Nov 2019, 11:26 ( Updated at: 21 Dec 2023, 09:21 )

RE:

Panagiotis Charalampous said:

Hi FireMyst,

The fix should arrive soon.

Best Regards,

Panagiotis

It's still happening in Version 3.6 as you can see:

It wasn't flipped when the candle passed through it.

 

 


@firemyst