Topics
Replies

firemyst
09 Mar 2023, 07:54

Maybe show more of your code so we can see how you're implementing it and what you're setting "Bars" to?

 

For example, you don't say if you're using Chart.Bars.Count or Algo.Bars.Count, which is probably why you're getting the same count -- using the incorrect one in context.


@firemyst

firemyst
09 Mar 2023, 07:50 ( Updated at: 21 Dec 2023, 09:23 )

RE:

amirus.stark said:

Hi there, how can I change the way ctrader handles the hours from the AM/PM system to the 24h system please ?

Mine does 24 by default. Maybe try resetting your chart settings?


@firemyst

firemyst
09 Mar 2023, 03:16

RE:

jaydcrowe1989 said:

Hi,

Is there a way to detect that the instrument you are trading is now outside of the trading hours? When the instruments closes I need to close all of my trades out just before that happens. I am getting trades being left open over the weekends and that is not obviously good when that instrument then opens again for trading.

 

Cheers,

Jay

 

 


@firemyst

firemyst
09 Feb 2023, 09:59

RE: RE: RE:

ctid1531384 said:

firemyst said:

firemyst said:

With API 3.7:

MarketData.GetSeries

is now obsolete, but there's no suggested replacement? How do we now get a different symbol and timeframe's data other than the currently viewed chart? Eg, if I'm viewing the US30 on an M1 chart, and want to get data from the GER30 M1, how do we now do this? It used to be MarketData.GetSeries(_symbol, _timeFrame);

Also, when will the online API guide be updated? I can't find the new "bars" interface in it.

Thank you.

I just found it.

I believe it's now:

MarketData.GetBars(Bars.TimeFrame, _symbol);

However, if I'm wrong or there's something else I should be using, please let me know.

Thanks!

So how do we do it?

All I want is to have the Weekly RSI number there, So i can have 

if (Week RSI > 70)

{dont trade etc

Dont even want it from a different symbol, Just the same one thats on the cbot chart.

 

John.

 

 

Get your Bars / Market Series in the time frame you want, and then create a new Relative Strength Index object with that bars/market series as the first parameter.

Example is right here on this site:

 


@firemyst

firemyst
05 Feb 2023, 15:13

You keep adding to the value of velocity:

 

velocity += distance * K / 100;

 

Every tick you say velocity = velocity + distance * K / 100;

 

You never reset it to another value, so of course it's going to increase into infinity.


@firemyst

firemyst
05 Feb 2023, 12:01 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE:

deeganpope said:

firemyst said:

You're missing a screen capture showing us an example of where you think your bot has gotten in late.

That would be helpful

Here's another example of the trade initiating 1-2 bars after the trigger conditions are met.

 

1) Looks like the exact same screen capture example as your previous post

2) The "sell 5.00 lots" covers up the DEMA so we can't see what it's doing there

3) have you tried putting PRINT statements in front of your conditions to see whether or not each condition is true or false? Or done any debugging in Visual Studio?

 

//Have you tried stuff like this?

Print ("Current Trend {0}", CurrentTrend());
Print ("DEMA.REsult.LastValue {0}, EMA.Result.LastValue {1}, DEMA.Result.LastValue < EMA.Result.LastValue {2}", DEMA.REsult.LastValue, EMA.Result.LastValue, DEMA.Result.LastValue < EMA.Result.LastValue);

//etc 
//etc
//etc
//Now you know what everything is evaluating to, so you can figure out why your "if" statement isn't evaluating the way you expect

 if (CurrentTrend() == "down" && DEMA.Result.LastValue < EMA.Result.LastValue && EMA.Result.LastValue < SMA.Result.LastValue && MACD.MACD.LastValue < MACD.Signal.LastValue && DEMA.Result.IsFalling() && EMA.Result.IsFalling() && SMA.Result.IsFalling() && (shortOpen == false)){

 


@firemyst

firemyst
03 Feb 2023, 03:28 ( Updated at: 21 Dec 2023, 09:23 )

RE:

Spotware said:

Dear firemyst,

Execution issues should be handled by your broker. Please contact your broker regarding this matter.

Best regards,

cTrader Team

 

Hi @Spotware, I've heard back from Pepperstone. Here is what they said and why I believe it's can't be.

 

@Spotware, in regards to "Then you have added 0.1lot  to your existing position at the Ask price of 11640.4 with no protection as you can see it at the screenshot below:", when you modify a position, you CANNOT add an SL to it as it takes on the SL of the current position you're increasing the size of. Screen capture from cTrader as evidence:

 

Even the API call "Position.ModifyVolume()" has no parameter for setting the SL when increasing the volume size of a position.

This has only started happening since the latest 4.6.x releases of cTrader.

So what appears to be happening is cTrader is NOT putting the current SL or TP on new positions when the current position's volume is increased on RENKO charts.

@SPOTWARE / @PanagiotisChar, I think this needs to be investigated further.

 

 

 


@firemyst

firemyst
02 Feb 2023, 14:39

Am pretty sure you can't.

 


@firemyst

firemyst
31 Jan 2023, 07:49 ( Updated at: 21 Dec 2023, 09:23 )

An update, it has happened again. When the "Take Profit" line in cTrader was hit, it only closed 1.1 of the 1.2 lots in the position, leaving 0.1 lots open.

As of this posting, my broker is still investigating the first incident I reported above.


@firemyst

firemyst
31 Jan 2023, 07:42

Or Kaspersky misidentified something within cTrader since nobody else seems to be having an issue.


@firemyst

firemyst
31 Jan 2023, 07:42

You're missing a screen capture showing us an example of where you think your bot has gotten in late.

That would be helpful


@firemyst

firemyst
25 Jan 2023, 17:58

Awesome new features! About time we got the color parameter and Exception handling method!

Now all we need is an update to Renko charts with an option to show the "tails" and not just the open/close prices of each bar.

 

Thanks @Spotware!


@firemyst

firemyst
25 Jan 2023, 08:15

You haven't updated the code in all the required places, and are still using Symbol.Ask in places you shouldn't be.

 

:-)


@firemyst

firemyst
25 Jan 2023, 07:47

How about posting your updated code?


@firemyst

firemyst
25 Jan 2023, 06:21

Probably not, because there's no way to know when a new bar is going to start. A new bar forms on the first tick after the previous bar closes. It could take half a second, or 10 seconds (depending on the time of day and symbol) on when that next tick will come in to cause a new bar to open up.


@firemyst

firemyst
25 Jan 2023, 06:18

RE:

jennifer1978bgf said:

How to apply multiple currencies by one cBot?

I have tried the code below, even different currencies get opened, the price is not correct.

Can someone help?


        [Parameter("Vol", DefaultValue = 10000)]
        public int Vol { get; set; }

        protected override void OnStart()
        {
            Symbol symbol_1 = MarketData.GetSymbol("USDJPY");
            Symbol symbol_2 = MarketData.GetSymbol("EURUSD");
            Symbol symbol_3 = MarketData.GetSymbol("GBPUSD");

            var result =

            PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BU", 30, 15);
            PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BE", 30, 15);           
            PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BG", 30, 15);           

            if (!result.IsSuccessful) Print("Error: ", result.Error);
             Stop();
        }
    }
}

one of your issues is for each of those, you're using the chart's current symbol to get the ask and pipsize, not the currency you want.

Symbol.Ask gets the charts current symbol's asking price.

 

If you want the asking price of USDJPY for example, with your code you have to use symbol_1.Ask and symbol_1.PipSize

 


@firemyst

firemyst
25 Jan 2023, 06:16

You should post this under "Suggestions" where Spotware will read it.


@firemyst

firemyst
25 Jan 2023, 06:14

What provider and version of cTrader are you using?

And just to be sure, you've been trying to change your indicator names in the left panel when you click on "automate"?


@firemyst

firemyst
25 Jan 2023, 06:11

How doesn't it work? What's the problem?


@firemyst

firemyst
25 Jan 2023, 06:10

You seriously need to be more specific in what you are asking for.

% changes with what?

 

% Difference in an indicator value?

% Difference in current close price vs last close price?

% difference in current price vs yesterday's market close price?

% difference in bar's open value vs the last bar's open value?

Something else?


@firemyst