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

[amibroker] Re: Static var help



PureBytes Links

Trading Reference Links

thanks Mike for your reply, 

a) can you tell me what is wrong with the code, so I don't make the same mistake again in the future. I tried to replicate code I had seen for staticvars. 

b) In terms of what I am trying to do. I am trying to write a staticvar that detects when there is a short trade. and then set it in my buy condition not to have a buy if "onshort" == 1.  so when staticvar "onshort" equals 1 then no buys will occur. 
I would use the exrem function but as I understand it, it is not very good in the backtester?? So Marcin suggested I use a staticvar. 

Can you help please
zeek


--- In amibroker@xxxxxxxxxxxxxxx, zeek ing <zeeking57@xxx> wrote:
>
> I think I am having a little problem with my static var code. I expected to
> see in an exploration with the variable "onshort" a value of 1 when a short
> trade is on. Instead all I see is zeros in the exploration. I am not sure
> why. there are two parts to the code. If anyone can tell me what is  wrong
> with this code it would be appreciated.  thanks
> 
> ///part a--
> StaticVarGet("onshort");
> 
> 
> 
> if( IsNull(  StaticVarGet("onshort"))) StaticVarSet("onshort",0);
> 
> Onshort= StaticVarGet("onshort");
> 
> 
> 
> //part b---
> 
> if (LastValue(Short))
> 
> 
> 
> {StaticVarSet("onshort",1);}
> 
> if (LastValue(Cover))
> 
> 
> 
> {StaticVarSet("onshort",0);}
> 
> 
> 
> StaticVarGet("onshort");
>




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

**** 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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/