Greetings,
In an effort to make my complex strategies more structured, I have decided to work on trying to make them Object Oriented.
It seems a lot of routines used in EFS are objects, such as the IBBroker object, or the Strategy object that many people use for backtesting, for example.
But what about creating our own classes to instantiate during runtime? For me, this is becoming almost invaluable; with lots of orders being sent off with different stops and profit targets, it would make my life a whole lot easier; as well as the people who read my code.
I recently compiled a javascript interpreter in order to test my theories on the FreeBSD platform, as ESignal would make debugging them a little difficult (which is not a big deal). After this was done, I composed a small bit of testing code. Take a look at the following if you will.
In this short example, I've created the class 'whatever'. It's instantiated inside the main(), as the object 'huh'. Inside the class I also defined two methods/functions, bob() and dobbs(). However, something goes wrong when I try to call them; But there are no syntax errors reported.
When running this, you'll notice that no debug window output is given, when there clearly should be. Also, note that main() returns the value of 1; but there is never anything returned to the chart. This leads me to believe that either the execution is hung up somewhere, or that execution terminates completely.
When calling a similar (obviously not exactly, as some of these routines are propriatary to EFS) routine in my own javascript interpreter, it outputs accordingly; as it should.
Any input ESignal crew?
Once I figure this out I'd like to write up a series of tutorials pertaining to this subject. I imagine a lot of people would find it very useful in developing their own custom trading systems.
Cheers,
Joshua C. Bergeron
jcb@othernet / #ESignal
In an effort to make my complex strategies more structured, I have decided to work on trying to make them Object Oriented.
It seems a lot of routines used in EFS are objects, such as the IBBroker object, or the Strategy object that many people use for backtesting, for example.
But what about creating our own classes to instantiate during runtime? For me, this is becoming almost invaluable; with lots of orders being sent off with different stops and profit targets, it would make my life a whole lot easier; as well as the people who read my code.
I recently compiled a javascript interpreter in order to test my theories on the FreeBSD platform, as ESignal would make debugging them a little difficult (which is not a big deal). After this was done, I composed a small bit of testing code. Take a look at the following if you will.
PHP Code:
function whatever(id)
{
this.id = id;
function bob()
{
return this.id;
}
function dobbs()
{
debugPrintln(this.id);
}
}
function main()
{
var huh = new whatever(1);
var ehh = huh.bob();
debugPrintln(ehh);
return 1;
}
When running this, you'll notice that no debug window output is given, when there clearly should be. Also, note that main() returns the value of 1; but there is never anything returned to the chart. This leads me to believe that either the execution is hung up somewhere, or that execution terminates completely.
When calling a similar (obviously not exactly, as some of these routines are propriatary to EFS) routine in my own javascript interpreter, it outputs accordingly; as it should.
Any input ESignal crew?
Once I figure this out I'd like to write up a series of tutorials pertaining to this subject. I imagine a lot of people would find it very useful in developing their own custom trading systems.
Cheers,
Joshua C. Bergeron
jcb@othernet / #ESignal
Comment