Rank: Newbie
Groups: Registered, Registered Users Joined: 9/5/2008(UTC) Posts: 8 Location: California
|
I want to do what seems like a simple thing in a System Test. When I make the entry, I want to save the SMA (mov(c,20,s)...and then in the exit, I want to refer back to the SMA as one of the possible exit criteria. I can only find a way to make a backwards reference for a deterministic period - using the ref(dataarray, period) construct - and even that is limited to the standard dataarrays. I have tried using a variable in the entry formula, but variables are not global. Does anyone have a technique that will let me save a value from a prior calculation and then make a backwards reference to it? A global variable would be an acceptable solution perhaps, which gets set every time a successful buy/sell order entry is executed. Many thanks Michael
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Hi Michael,
Go to Files (refer Black Bar above) and there under the programs folder you will find the files "gvDll" (global variable), "ForumDll Manual" and "ForumDll 200" which can all be downloaded.
Hopefully these will help you in your quest.
Cheers,
oz
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/5/2008(UTC) Posts: 8 Location: California
|
Many thanks Oz: Will do Michael
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/5/2008(UTC) Posts: 8 Location: California
|
Oz: I got the gv.dll and found gv.GetVar & gv.SetVar. There is zero documentation - at least none associated with the dll.
I tried using it as follows....
if (0.1 > ExtFml("gv.GetVar", "ShortExit") and ShortSignal, {do something}, 0)
and of course:
if (ShortSignal, ExtFml("gv.SetVar", "ShortExit", mov(c,20,s), 1,0)....but nothing seems to work
It seems that I have to have the Variable inside " " for the syntax to be accepted. There does not seem to be any requirement to pre-declare the global variable prior to using it.
Can you point me to any documentation, or is there any trick to using the gv.dll that is non-obvious?
It seems to compile, it just does not seem to carry the values globally.
btw, I'm using this inside a SystemTest....
Thanks Michael
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Michael,
I have not used the gvDll so am probably speculating somewhat but this is how I believe it works:-
ExtFml("gv.SetVar",ProfitStop,Close*4ATR(20)); {set at system entry}
System Test
{Sell Order:=}Close>ExtFml("gv.GetVar",ProfitStop)
This has not been checked in MS but hopefully will provide you with a clue as to how the gvDll works.
Regards,
oz
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/5/2008(UTC) Posts: 8 Location: California
|
Oz: So I have worked on this all day; what I have been able to do is to reach backwards, using PREV in the Order Entry side of things to where I set the ExitStop with the SMA. Further, using the global variable dll I can make this value available to the Order Exit side of the System Tester. What continues to be a problem is, when I make a decision to exit the trade, to reset some variable that can be accessed and tested by the Order Entery side when it processes the next bar. There seems no way to establish global state that is shared across the System Tester (or the Explorer for that matter). Michael
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 9/5/2008(UTC) Posts: 8 Location: California
|
Thanks Oz: So what seems to happen, in the System Tester, is that the gvGlobals are global across the Buy/Sell/Short/Cover passes for each bar, but when the next bar is processed, then the global does not persist across into the next iteration. Consequently, when I set a global value in the Buy or Short pass, I can access them in the corresponding Sell/Cover pass. What I have not found a way to do is when I reset the global value in, say, the Cover formula pass, this is lost on the next bar iteration, and so the Short [order entry] formula cannot see the decision of the prior Cover [exit] formula; all globals are reset to zero when the next bar is processed.
I have dropped a note to Roy Larsen in NZ to see if he has any ideas, given is insight into how to use latches very inventively.
What I really think I need is a global that is persistent across formulae and across iternations - processing sequential bars.
Thanks
Michael
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 7/12/2007(UTC) Posts: 134 Location: Perth Western Australia
|
Michael,
What about this sequence to resolve the problem?
ExtFml("gv.Clear"); ExtFml("gv.SetVar",ProfitStop,Close*4ATR(20));
Regards,
oz
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 8/15/2005(UTC) Posts: 8 Location: Berlin, Germany
|
Hello Michael,
do you now know the solution for this problem?
So what seems to happen, in the System Tester, is that the gvGlobals are global across the Buy/Sell/Short/Cover passes for each bar, but when the next bar is processed, then the global does not persist across into the next iteration.
I also want to store some conditions of the entry until exit is valid.
Regards
Henning
|
|
|
|
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 Henning
The GV dll is not appropriate for what you and Michael are tryng to do (I've probably done more work with this dll than anyone so I have a good idea of where it works and where it doesn't). The tool you probably need is a PREV-based latch, though you're pretty much restricted to storing one value, or an integer and a fraction at most. Also check out the various Simulation functions available in the EST. The documentation is poor but you can use the Function button in the Indicator Builder (or EST?) to look at the various finctions and syntax.
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.