Topics
Replies

firemyst
18 Feb 2025, 04:57

You can't send push notifications. You can use Telegram to send messages. If you have a separate 3rd party libray that you can connect to to send sms txt messages you might be able to do it that way. I don't believe there's anything built in to natively do it.


@firemyst

firemyst
18 Feb 2025, 04:55

You don't need to do this:

// Initialize output buffers
           K = CreateDataSeries();
           D = CreateDataSeries();

 

It's taken care for you when you declare those using the [Output … ] directive as you have.


@firemyst

firemyst
18 Feb 2025, 04:54

Out of curiosity, why are you calculating startIndex twice?

int startIndex = Math.Max(0, Bars.Count - LookbackPeriod);

Just do it once in Calculate, and then pass the “startIndex” as a parameter to DrawSignal.

 

By doing so, it also means you no longer need this conditional check in DrawSignal:

if (barIndex < startIndex) return;


@firemyst

firemyst
18 Feb 2025, 01:14

the calgo documentation specifically states:

“The sleep functionality is available only for .NET 6 algos. While a cBot stays in sleep mode, all other events in the code will be ignored.”

 

If you need to do other things, then you obviously need to set your own timer and check if after x-seconds/minutes/hours/whatever.

So create your own timer, and set a flag after the desired amount of time has elapsed. When the flag is set to true, then continue executing whatever code you need to. In the mean time, you should still be able to listen to messages from whatever sockets you have set up.


@firemyst

firemyst
18 Feb 2025, 01:10

You didn't show the output of:

Print($"ATR: {atrValue}, TP: {_takeProfitDistance}, SL: {_trailingStopDistance}");

 

So basically, nobody knows what the numbers are along the way as it calculates the TP price you're setting. Have you tried debugging the code and/or used Visual studio to run in debug mode to see what the values are along the way to make sure they tee up to what you're expecting?


@firemyst

firemyst
18 Feb 2025, 01:06

Set the “Levels” attribute in your indicator's code.

Google “calgo Levels” for more info.

Or when placing the indicator on the chart, manually set the levels. For example:


@firemyst

firemyst
18 Feb 2025, 01:00

RE: RE: ctrader can't get tp and sl and use them when my code says the opposite

Offhand I'd say your error is here:

// Calcul du SL et du TP
                double slPips = SlPercentage * Symbol.PipSize;
                double tpPips = TpPercentage * Symbol.PipSize;

Why are you taking the percentage here? 

You're taking the percentage of the value of the pipsize. For non jpy forex pairs, this is 0.0001, so your number is only going to be smaller, which won't make placing the SL/TP practical. 

so  let's say you want to take 50% percentage. That means your pipsize is now going to be 0.00005, not the actual pips distance you want to place. Your modify order call is then placing the SL/TP at distances of only ½ pip - not even a full pip! With some symbols having pip spreads of greater than 0.5, how do you expect the system the order to be placed when the SL or TP is inside the spread?

 

 

 


@firemyst

firemyst
09 Feb 2025, 06:21 ( Updated at: 14 Feb 2025, 18:16 )

Android / data / com.spotware.ct


@firemyst

firemyst
08 Feb 2025, 21:41 ( Updated at: 14 Feb 2025, 18:16 )

Is it not based on your Windows theme colours?


@firemyst

firemyst
08 Feb 2025, 03:54 ( Updated at: 14 Feb 2025, 18:19 )

Duplicate of this thread:

https://community.ctrader.com/forum/ctrader-algo/46280/

 

 


@firemyst

firemyst
07 Feb 2025, 02:56 ( Updated at: 14 Feb 2025, 18:18 )

Are you still experiencing this issue? If so, can you post sample code that reproduces the issue?


@firemyst

firemyst
07 Feb 2025, 02:54 ( Updated at: 14 Feb 2025, 18:18 )

Try rounding to (Symbol.Digits + 1) instead of just Symbol.Digits

 

 


@firemyst

firemyst
07 Feb 2025, 02:52 ( Updated at: 14 Feb 2025, 18:18 )

Limitations of cbots in the cloud:

 

https://www.spotware.com/terms-of-services

 

 


@firemyst

firemyst
07 Feb 2025, 02:51 ( Updated at: 14 Feb 2025, 18:16 )

You should also check this page for when cbots are automatically restarted in the cloud:

 

https://www.spotware.com/terms-of-services

 


@firemyst

firemyst
07 Feb 2025, 02:43 ( Updated at: 14 Feb 2025, 18:18 )

Is it still like this?


@firemyst

firemyst
07 Feb 2025, 02:42 ( Updated at: 14 Feb 2025, 18:18 )

This would be a great feature to have. Unfortunately at least 8 years on and they still haven't included pips as part of the profit/loss display despite numerous requests and suggestions. 😢


@firemyst

firemyst
07 Feb 2025, 02:37 ( Updated at: 14 Feb 2025, 18:18 )

You probably don't have enough funds to meet the margin requirements for the symbol.


@firemyst

firemyst
07 Feb 2025, 02:34 ( Updated at: 14 Feb 2025, 18:18 )

What notification are you referring to?


@firemyst

firemyst
07 Feb 2025, 02:31 ( Updated at: 14 Feb 2025, 18:18 )

Can you post a screen capture showing the price beyond your take-profit line as evidence of the position not closing?


@firemyst

firemyst
07 Feb 2025, 02:29 ( Updated at: 14 Feb 2025, 18:18 )

Why are you posting this 6 times instead of voting for the suggestion as posted by other users?


@firemyst