logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
sasha  
#1 Posted : Monday, November 24, 2014 9:17:07 PM(UTC)
sasha

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 11/24/2014(UTC)
Posts: 2

Hello !, this system gives good results when testing, but because of the function tester Prev believes Statistics Very slowly (Tell me how to get around this point, I will be grateful)

 

open long:

Prc:=opt1/100;

Change:=If((C > PREV*(1 + Prc)) OR (C < PREV/(1 + Prc)), C, PREV);
Change > Ref(Change,-1)

 

close long:

 

Prc:=opt1/100;
Change:=If((C > PREV*(1 + Prc)) OR (C < PREV/(1 + Prc)), C, PREV);
Long:= Change > Ref(Change,-1);
Short:= Change < Ref(Change,-1);
Position:=If( Long, 1, If( Short, -1, PREV));
Open.Long.Price:= ValueWhen(1, Position = 1 AND Ref(Position,-1) = -1, CLOSE);
CLOSE < Open.Long.Price * ((100-opt2)/100)

 

mstt  
#2 Posted : Tuesday, November 25, 2014 7:04:35 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Sasha I know that there are solutions to your problem(s) but I don't have the specific code in front of me just yet. The "Change" variable can be rewritten using the TS2 function in the MSTT DLL. If you write to me at rlarsen@quik.co.nz and I'll see what I can do for you. The "Position" variable can be rewritten as a simple latch, and in its simplest form giving 1and 0 (TRUE and FALSE) as the outputs rather than 1 and -1. I'll get back to you with code for that shortly. In the event that the "Change" variable could not be rewritten without PREV, the overheads that it generates certainly can be cut in half by saving the PREV result in a global variable ( ExtFml("GV.SetVar","Change",Change) ) and then calling that result ( ExtFml("GV.GetVar","Change") ) in the Close Long window. Using this technique any PREV variable generated in the Buy Long window can be carried through into any subsequent code window. Roy
mstt  
#3 Posted : Tuesday, November 25, 2014 8:56:23 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Sasha I haven't been able to solve your PREV problem for the "Change" variable as it does something a little different from what I initially thought. The "Position" variable, however, can have the PREV function removed. My solution eliminates the PREV. Position:=BarsSince( Long )<BarsSince( Short ); Position:=If(Position=1,1,-1); By adding the I variable as shown below you will probably pick up the earliest possible change of state. Without the I variable the simple latch function will miss the first change-of-state signal. I:=Cum(IsDefined(Long+Short))=1; Position:=BarsSince( I+Long )<BarsSince( I+Short ); Position:=If(Position=1,1,-1); To introduce the GlobalVar DLL and reduce the overheads created by "Change" in the Buy Order window your code should look something like this below. The overheads in the Buy Order window will stay the same but the overheads in the Sell Order window are virtually eliminated. {Buy Order} Prc:=opt1/100; Change:=If((C > PREV*(1 + Prc)) OR (C < PREV/(1 + Prc)), C, PREV); Change:=ExtFml("GV.SetVar","Change",Change); Change > Ref(Change,-1); {Sell Order} Prc:=opt1/100; Change:=ExtFml("GV.GetVar","Change"); Long:= Change > Ref(Change,-1); Short:= Change < Ref(Change,-1); I:=Cum(IsDefined(Long+Short))=1; Position:=BarsSince( I+Long )<BarsSince( I+Short ); Position:=If(Position=1,1,-1); Open.Long.Price:= ValueWhen(1, Position = 1 AND Ref(Position,-1) = -1, CLOSE); CLOSE < Open.Long.Price * ((100-opt2)/100); I hope this helps. You can get a copy of the GV DLL by emailing me or downloading it from www.metastocktips.co.nz/gv.dll Roy
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.