Page 4 of 24

Re: Strategy Builder

PostPosted: Mon Mar 21, 2011 3:49 pm
by OilyFish
Is there any chance of developing this a bit further; so that individual time frames can be assigned to different component strategies and also can it be expanded to allow more than 3 strategies in it, say around 6?

Re: Strategy Builder

PostPosted: Tue Mar 22, 2011 1:20 am
by Apprentice
Your request has been added to developmental cue.

Re: Strategy Builder

PostPosted: Fri Apr 08, 2011 4:48 am
by STEIGO
How does this strategy work?
How do I use it?
What is it trying to do?
Is there a thread or coding request link that will explain what it tries to do?

Re: Strategy Builder

PostPosted: Fri Apr 08, 2011 1:49 pm
by Apprentice
This is not a classic strategy.
In the first place i am using it for test different combinations of indicators.
When I find a promising strategy.
I continue to develop it as an independent strategy.

Although there is the possibility of trading.
Do not give the possibility of fine tuning.
Adding advanced functionality.

Re: Strategy Builder

PostPosted: Wed Apr 13, 2011 10:19 am
by bingyunid
Hi,thanks for developping this strategy. Now i have a problem on this,why it open orders,why it didn't set stop/limit,it just open without set the stop or limit. I have already changing the setting to set stop/limit,anybody can help me ,thanks very much

Re: Strategy Builder

PostPosted: Fri Apr 15, 2011 2:11 am
by bingyunid
I have solved the problem i mentioned above, it is because the account type, my demo accout cannot set, but my live accout works correctly.

BTW, if i want to add a rule to this logic, when the TMACD bar above/below 0 AND it just cross the zero line, then plus(i)/minus(i) .

The oraginal source code is:
elseif instance.parameters:getString("IN"..i) == "TMACD" then
STREAMS[0]=indicator[i]:getStream(0);
if STREAMS[0][p] > 0 then
PLUS(i);
elseif STREAMS[0][p] < 0 then
MINUS(i);
end

I change to
elseif instance.parameters:getString("IN"..i) == "TMACD" then
STREAMS[0]=indicator[i]:getStream(0);
if STREAMS[0][p] > 0 and core.crosses(STREAMS[0], 0, p) then
PLUS(i);
elseif STREAMS[0][p] < 0 and core.crosses(STREAMS[0], 0, p) then
MINUS(i);
end

it seems work ok, but when i backtest it, it give errors: index is out of range,Apprentice,could you help me ,thanks very much

Re: Strategy Builder

PostPosted: Fri Apr 15, 2011 2:20 am
by Apprentice
core.crosses function should have two data periods that would work.
Former and current period, P and P-1
This check should fix things.

if not STREAMS[0]:hasData(p) or not STREAMS[0]:hasData(p-1) then
return;
end

And this piece of code before the Cross Check.

Re: Strategy Builder

PostPosted: Fri Apr 15, 2011 4:25 am
by bingyunid
Thanks very much, Apprentice . The error has been fixed after adding your code. :lol:

Could you help on another problem which trouble me very long time. In the Strategy Builder.lua, if i want to combine two indicators(Two indicators both signal sell/buy then sell/buy,). For example.
rule: When TMACD > 0 ; in the meantime, the CCI >0, then buy.

That means, the two indicator both signal buy (PLUS(i)), then buy (PLUS(i)), is it possible to code it?

CCI code
elseif instance.parameters:getString("IN"..i) == "CCI" then

STREAMS[0]=indicator[i]:getStream(0);

if STREAMS[0][p] > 0 then
PLUS(i);
elseif STREAMS[0][p] < 0 then
MINUS(i);
end
TMACD code
elseif instance.parameters:getString("IN"..i) == "TMACD" then

STREAMS[0]=indicator[i]:getStream(0);

if STREAMS[0][p] > 0 then
PLUS(i);
elseif STREAMS[0][p] < 0 then
MINUS(i);
end

Re: Strategy Builder

PostPosted: Fri Apr 15, 2011 7:04 am
by Apprentice
This is no easy task.

This requires a complete change of codes.

There are Two solutions.

FIrst, Add an option, mandatory confirmation.
So you can define which individual signals must be positive.
To have a positive indication.

Second, change the selection algo. from individual indicators to strategy.
Currenty strategy only works with the individual indicators.
You should develop a different engine.

Re: Strategy Builder

PostPosted: Tue Apr 19, 2011 11:01 pm
by bingyunid
Got it. Thanks very much,Apprentice !