[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] SetForeign and StaticVarSet question


  • Date: Sun, 31 Jan 2010 17:06:47 -0000
  • From: "el_pato_ut" <trader.geto@xxxxxxxxx>
  • Subject: [amibroker] SetForeign and StaticVarSet question

PureBytes Links

Trading Reference Links

I cross-posted this in the auto-trading group on Friday and haven't heard any responses, so I am posting it here as well since this group appears to be a little more active. Apologies in advance if this goes against any established policies.

I have a quick question about using StaticVarSet with SetForeign. I want to capture and log study values of $SPX at the time my system enters and exits positions. (I am currently using the IBc and TWS to perform a walk-forward test of a system sending limit orders.)  I want to do this by first switching to the $SPX symbol (SetForeign) and then setting the study value in a static variable (StaticVarSet). However, I am noticing that after I RestorePriceArrays(), the static variable I am setting becomes empty. I have searched the various Amibroker Yahoo groups and UserKB, but have not been able to find a solution. I'm pretty sure I am overlooking something rather obvious. Any help would be greatly appreciated.

Here is my code snippet:

SetForeign("$SPX");
//Get RSI value for the S&P500
RSISPX = LastValue(Ref(RSI(14),-1));
StaticVarSet("RSI-SPX-"+Name(),RSISPX);

// Trace statment to test what is happening
RSISPX = StaticVarGet("RSI-SPX-"+Name());
_TRACE("RSISPX: " + RSISPX);
RestorePriceArrays();

//Another trace statement to see what is going on
RSISPX = StaticVarGet("RSI-SPX-"+Name());
_TRACE("RSISPX: " + RSISPX);


The first "_TRACE" outputs the correct value. The second "_TRACE" (after RestorePriceArrays()) shows up as <EMPTY> in the Trace window.

Thanks,
Dave



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/