compiling a strategy in dll mode or... some methods

Questions about MultiCharts .NET and user contributed studies.
Smarty
Posts: 31
Joined: 05 Nov 2013
Has thanked: 11 times
Been thanked: 1 time

compiling a strategy in dll mode or... some methods

Postby Smarty » 24 May 2014

I am working for protect my code c#, that I think is a very important question.

how can I compile overall strategy the dll mode? or... how do I get CalcBar (as other specific methods) outside in a dll?

I try to extend a strategy object, but there is an error...
mcnet-error.png
Error on override void CalcBar()
(28.79 KiB) Downloaded 671 times
Have someone a ready solution ? Can it explain clearly how it's implemented?

Thanks for all.
Sabino

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: compiling a strategy in dll mode or... some methods

Postby JoshM » 24 May 2014

Could you translate your error message to English (roughly)?

There's some information about calling DLL's in the FAQ here if that is something the error message is about.

Edit: Perhaps related, but your `CalcBar()` method is outside the indicator class (move it before the } in line 10). And your strategy does not inherit from the `SignalObject`base class that contains the methods like `CalcBar()`.

If you're referencing a DLL, you also seem to be missing the accompanying `using` statement.

Smarty
Posts: 31
Joined: 05 Nov 2013
Has thanked: 11 times
Been thanked: 1 time

Re: compiling a strategy in dll mode or... some methods

Postby Smarty » 25 May 2014

Josh thanks for your attention, i have fixed that error but there is a last issue

as you can see from the attached, my idea is to create a DLL from the child class which inherits from "MySignalProtect" (which inherits from "SignalObject") in order to access all the attributes of the parent class.

I want to use this hierarchy:

SignalObject (... already in dll)
protected virtual void StartCalc() (by CStudyAbstract)

MySignal : SignalObject ( ...source in evidence)
protected override void StartCalc() ..... (it's empty, no syntax error)

MySignalProtect : MySignal ( ... in protected mode, i.e. dll)
protected override void StartCalc() ..... (that I have to make in protect mode)

how can I create the dll for MySignalProtect class?

I can create a project specific DLL with visual studio c #, but can not find it in the list of signals to be activate on the charts ...

Thanks for all.
Sabino

franky
Posts: 24
Joined: 25 Nov 2012
Has thanked: 4 times
Been thanked: 4 times

Re: compiling a strategy in dll mode or... some methods

Postby franky » 27 May 2014

I believe I found a solution to that question here it is:

1. In the .net editor, create a indicator (or strategy) like this:

using System;
using System.Drawing;
using PowerLanguage.Function;
using myDLLlib;

namespace PowerLanguage.Indicator{
[SameAsSymbol(true)]
public class _myInd : _myProtectedIndicator {
public _myInd (object _ctx) : base(_ctx) { }
protected override void Create() { base.Create(); }
protected override void StartCalc() { base.StartCalc(); }
protected override void CalcBar() { base.CalcBar(); }
}
}

2. And then in your DLL file :
using System;
using System.Text;
using System.Drawing;
using PowerLanguage;
using PowerLanguage.Indicator;

namespace MyNamespace {
public class myProtectedIndicator : IndicatorObject {

public myProtectedIndicator (object _ctx) : base(_ctx) {}
protected override void Create() {... your code}
protected override void StartCalc() {... your code}
protected override void CalcBar() {... your code}
}

To be able to create an indicator or strategy in a DLL, you need to import the PLTypes.dll and PLStudiesProxy.dll in "your" DLL as a references.... which is easily done using Visual Studio.
Hope it help. Any other ideas is welcome...

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: compiling a strategy in dll mode or... some methods

Postby Henry MultiСharts » 28 May 2014

In addition to Franky's post I can add that the next step will be Dll obfuscation. This is what is related to the managed code.
That is also possible to create a Dll using С++. This is a more complex task but it also provides the highest level of security.


Return to “MultiCharts .NET”