CT
ctid+customer-395444
7 follower(s) 0 following 845 subscription(s)
Topics
Replies

ctid+customer-395444
10 Apr 2023, 15:53 ( Updated at: 21 Dec 2023, 09:23 )

RE:

algorithmic.trading.eu_gmail.com said:

Hi

I created a very profitable cBot. When I didn't have a free testing version (with the Expiration date in the code) for the user to try it out first, I was getting emails from programmers. They said they can help me add the code for expiration date and so on. I did that. Then I gave my cBot to them WITHOUT THE SOURCE CODE.

The Expiration date code works. It is in the OnStart and in the OnTick section.

Now they are reverse engineering my very profitable cBot and making fun of me.

Can someone please help me make my cBot more difficult for reverse engineering? Please. Thanks.

 

I tried to find this in cTrader but I couldn't find it :

To obfuscate your cBot code in cTrader, you can use the built-in obfuscation tool provided by the platform. To access it, open your cBot project and go to the "Tools" menu, then select "Obfuscate code". This will open a dialog box where you can select the options for obfuscating your code, such as renaming variables and functions, removing comments, and compressing the code.

Once you have selected the options you want, click the "Obfuscate" button to start the process. The obfuscated code will be saved in a new file, which you can use instead of the original code. Keep in mind that while obfuscation can make it harder to reverse engineer your code, it is not foolproof and determined attackers may still be able to understand your code with enough effort.

 

This is why I downloaded www.gapotchenko.com/eazfuscator.net     Eazfuscator.NET (I also tried with the .NET reactor but I can't add the cbots file)

I hope this is correct and now it will be more difficult to reverse engineer my cBot ? Can someone reply to me and help me out?

 

The first question is are .algo files still "encrypted" regardless of the platform (eg, .Net Framework or .Net 6)?

Last time I spoke and asked @PanagiotisChar about obfuscation in compilation, he said it wasn't possible. So if that's still the case, you'd have to build your source code, then copy/paste it into another project, obfuscate it there within the editor, and then build it to a .algo file.

Read this thread for more information:

 

 


@ctid+customer-395444

ctid+customer-395444
10 Apr 2023, 15:42 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE:

Shares4us said:

please provide me with a 'something' to create the .algo file

 

And just to confirm, you are looking under the "Automate" tab (since your screen capture from earlier shows it to be an indicator and not a cbot) and you have everything being shown?


@ctid+customer-395444

ctid+customer-395444
10 Apr 2023, 15:39 ( Updated at: 10 Apr 2023, 15:43 )

RE: RE:

Shares4us said:

please provide me with a 'something' to create the .algo file

 

Can you post your Indicator code, or some sort of sampling there of, that's causing the issue? So someone else can try building your code to see if it works?


@ctid+customer-395444

ctid+customer-395444
10 Apr 2023, 15:36

Have you looked up the actual Indicie symbol name for HONG KONG 50 on your platform?

On most other cTrader platforms, it's known as "HK50"


@ctid+customer-395444

ctid+customer-395444
09 Apr 2023, 07:19

RE:

ctid5083541 said:

I get the  'new' expression can be simplified to the following line of code:

private List<double> myPrices = new List<double>();

It works fine in .NET Framework 4x (Legacy) but I want my code to work in .NET 6.0 as well.

How do I resolve this?

Any help appreciated.

Many thanks.

You don't have to. It can be simplified doesn't mean it has to be simplified.

If you simplify it, the syntax may not be compatible with .net framework 4.x.

If you are using Visual Studio, just hover the issue in the actual code and then in the pop up window select "show potential fixes".


@ctid+customer-395444

ctid+customer-395444
08 Apr 2023, 05:13

Of course it does :-)

That's because each time you draw the number, you call the object on the chart the same name, so it replaces the one that was there previously with the same name, with the new values. You need to make the name of your object more "unique" -- the part highlighted in bold below:

ChartObjects.DrawText("Your Number", "1", Bars.Count-1, Bars.HighPrices[Bars.Count-1] + (Symbol.PipValue * 10), VerticalAlignment.Center, HorizontalAlignment.Center, Colors.GreenYellow);

 

So I would do one of 2 things:

1) append the current bar index onto the end of the name

2) append the current datetime it's drawn onto the end of the name

The "index" option would be easier if you ever have to go back and delete a particular object

 

Example if you're in the calculate method:

protected override void Calculate (int index)

{

ChartObjects.DrawText("Your Number" + index, "1", Bars.Count-1, Bars.HighPrices[Bars.Count-1] + (Symbol.PipValue * 10), VerticalAlignment.Center, HorizontalAlignment.Center, Colors.GreenYellow);

}


@ctid+customer-395444

ctid+customer-395444
06 Apr 2023, 08:23

Are you wanting to check for each "tick", or only the previous bar?

It sounds like you're wanting to check each tick, but am not 100% sure.

If you want to check the previous bar when a new bar is formed, if you are on Renko charts it'll be a bit more complex than any of the other kinds of charts since cTrader doesn't keep track of Renko "tails" for bar related data.

Otherwise, pseudo business logic:

1) get current bar's open

2) check if open is initially above/below the MA

3) if open was below MA, then on each tick:

     a) get the MA's current value

     b) get the Symbol Ask/Bid/Closing price (whatever you want to consider has touched the MA)

    c) check if the above price is >= MA current value

4) if open was above MA, then:

    a) repeat steps 3a/3b

    b) check if the price is <= MA current value

 

Hope that helps and is what you're after?


@ctid+customer-395444

ctid+customer-395444
05 Apr 2023, 04:04

The API isn't that great for what you want to do if you have a position and change the volume along the way.

The easiest way I've found is to create a variable in my cBots to keep track of each entry.

I use a Dictionary<int,DateTime> object with the int key being the position number (starting with 1 and increasing each time I add to my position size) and the value being the datetime the position was successfully modified/updated.

Hope that helps.


@ctid+customer-395444

ctid+customer-395444
29 Mar 2023, 16:27

RE:

Spotware said:

Dear firemyst,

Is it possible to check your Event Viewer and send us the exact message you receive there?

Best regards,

cTrader Team

 

Sure. All my instances are running Renko charts. Here's a few distinct ones from the Event Viewer -> Windows Logs -> Application:

Faulting application name: cTrader.exe, version: 4.6.4.13909, time stamp: 0x6406f01d
Faulting module name: KERNELBASE.dll, version: 6.3.9600.20876, time stamp: 0x6400576c
Exception code: 0xe0434352
Fault offset: 0x000000000001804c
Faulting process id: 0xd14
Faulting application start time: 0x01d962211908bc00
Faulting application path: C:\Users\Administrator\AppData\Local\Spotware\cTrader\abb70432efbee65d18af69e79fe8efe1\cTrader.exe
Faulting module path: C:\windows\system32\KERNELBASE.dll
Report Id: 0e81d030-ce24-11ed-811f-8509a194ebd8
Faulting package full name: 
Faulting package-relative application ID: 

///////////////////////////////////////////////

Application: cTrader.exe
CoreCLR Version: 6.0.21.52210
.NET Version: 6.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at cTrader.Automate.TargetProcess.TargetProcessBase.Stop()
   at cTrader.Automate.Runtime.OutProc.OutProcRuntimeHost.Stop()
   at cTrader.Automate.AutomateRuntimeSessionProvider.TryStopHost(AutomateId automateId)
   at cTrader.Automate.Instances.AutomateInstance.Dispose()
   at cTrader.Automate.ChartAutomation.AutomateChartAutomation.Dispose()
   at cTrader.Chart.Infrastructure.Automation.ChartAutomationRepository.Dispose()
   at Autofac.Core.Disposer.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at cTrader.Infrastructure.Lifetime.LifetimeScopeService.Remove(Guid identity)
   at cTrader.Chart.Infrastructure.TradeChartRepository.Dispose()
   at Autofac.Core.Disposer.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at Autofac.Core.Container.Dispose(Boolean disposing)
   at Autofac.Util.Disposable.Dispose()
   at cTrader.CTraderBootstrapper.OnShutdownFinished(Object sender, EventArgs e)
   at System.Windows.Threading.Dispatcher.ShutdownImplInSecurityContext(Object state)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.Dispatcher.ShutdownImpl()
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at cTrader.App.Main()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at cTrader.AppHostEndpoint.ExecuteStaticMethod(Assembly assemblyProxy, String typeName, String methodName)
   at cTrader.AppHostEndpoint.RunApplication(String productDirectory)
   at cTrader.AppHostEndpoint.Launcher.Main(IntPtr arg, Int32 argLength)

////////////////////////////////////////////////////

The description for Event ID 0 from source Application cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

Error occurred in frmDetails.RDPTimer_Tick
The parameter 'addresses' cannot be an empty string.
Parameter name: addresses


the message resource is present but the message is not found in the string/message table

////////////////////////////////////////////////////

Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: cTrader.exe
P2: 4.6.4.13909
P3: 6406f01d
P4: KERNELBASE.dll
P5: 6.3.9600.20876
P6: 6400576c
P7: e0434352
P8: 000000000001804c
P9: 
P10: 

Attached files:

These files may be available here:
C:\Users\Administrator\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_cTrader.exe_a0ee1be6efe6301dd91763eb5318a7e6572d8c88_4f91f2c9_3343768b

Analysis symbol: 
Rechecking for solution: 0
Report Id: 58df2e07-cdf5-11ed-811f-8509a194ebd8
Report Status: 2048
Hashed bucket: 

///////////////////////////////////////////////

 


@ctid+customer-395444

ctid+customer-395444
29 Mar 2023, 14:25 ( Updated at: 21 Dec 2023, 09:23 )

I also received this error today as well besides the one above:

 

Exception unknown software exception??

LOL

 

@Spotware -- any ideas?


@ctid+customer-395444

ctid+customer-395444
28 Mar 2023, 03:33 ( Updated at: 21 Dec 2023, 09:23 )

RE:

josef.van.niekerk said:

It seems what the documentation states about the value being calculated at bot startup still holds true, despite the version. I'm using 4.6.4. I did another check today using the BabyPips Pip Value Calculator

Doing the calculations for EURUSD at an asking price of 1.14155, the pip value I get is 8.760019 EUR.

Symbol.PipSize / Symbol.Ask * Symbol.LotSize = 8.7600192720423991

Still, cTrader (4.6.4) reports a Pip Value of 9.37980. I doubt that it is calculating this value on each tick/bar. Definitely seems to still be using the same value as when the Bot was started. I find it strange that it would do that in the first place, it's not a super expensive calculation to update.

BabyPips Pip Value Calculator

Just for kicks, have you tried getting the symbol.PipValue on each tick and each bar for comparison purposes and output to the log?

Eg, Symbol s = Symbol.PipValue

?


@ctid+customer-395444

ctid+customer-395444
28 Mar 2023, 03:28

Why not put time parameters in your cbot as a work around so that it only places trades during the time of day you want?


@ctid+customer-395444

ctid+customer-395444
28 Mar 2023, 03:23

Work around for Idea #1 -- why not put the bot name and basic description in the "Label" when a position is open?

 

Eg:

"MyBot_US30_Renko10"

 

?

 

Also, "Be able to sort by the values in the trade window." -- sort by what values?


@ctid+customer-395444

ctid+customer-395444
28 Mar 2023, 03:20

RE:

PanagiotisChar said:

Hi there,

At the moment there is no event raised at the moment a bar closes. A workaround would be to implement a Timer that is triggered on fixed intervals which coincide with a bar closing time.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Or if you're using a chart that doesn't involve time like Renko and Range bars where a timer isn't practical, you can see how well the Bar Open event works for you because obviously when a new bar opens, the previous bar is closed.


@ctid+customer-395444

ctid+customer-395444
27 Mar 2023, 16:25

You can try doing:

 


//Pseudo code

//Get the start index you want to search from
int startIndex = Bars.OpenTimes.GetIndexByTime( <enter your start date/time value here> );

//get the end index corresponding to the ending date/time you want
int endIndex = Bars.OpenTimes.GetIndexByTime( <enter your end date/time value here> );

//Now go through every bar
for (int x=startIndex; x <= endIndex; x++)
{
  // put your logic here that you want to do
}

 


@ctid+customer-395444

ctid+customer-395444
27 Mar 2023, 06:55 ( Updated at: 27 Mar 2023, 15:40 )

RE: RE: RE: RE: RE: RE:Impulse MACD

jani said:

Anyone interested in cTrader version of Impuse MACD can contact me at Telegram: @Fibonacci2011 

 

Or they can just search the archive of indicators others have developed and download for free at their convenience:

 


@ctid+customer-395444

ctid+customer-395444
15 Mar 2023, 04:26

RE: RE:

algo-trader said:

PanagiotisChar said:

Hi there,

Can you share the cBot code?

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 

Hi,

I've sorted the issue now but thank you for your response.

 

For future reference, are you able to post the solution on how you did it so if others have the same issue they know what to do?

 

 


@ctid+customer-395444

ctid+customer-395444
15 Mar 2023, 04:10

Not sure why you're trying to attach to a process?

Here's how to debug:

 

 


@ctid+customer-395444

ctid+customer-395444
15 Mar 2023, 04:09

RE: RE:

notzen said:

I am also available for a webex or google meet or zoom session where you can expect the issue locally

Spotware said:

Hi notzen,

Can we have a complete cBot that will allow us to reproduce these exceptions?

Best regards,

cTrader Team

 

As a suggestion, any reason why you can't send @Spotware a slimmed down, minimal version of code that shows the issue?


@ctid+customer-395444