[amibroker] Re: Code Assistance

 

Hi KBGlenn


I'm no expert, but it seems you're missing the periods part from the Sum function. See:
AFL Function Reference - SUM

 

So, if you wanted it to Sum all the values, you'd probably want something like BarCount-1 for periods. That is,

VarSet( "NHNLStr", (Sum(VarGet( "NHNLSig_" + Sym )), BarCount-1));

Need to get someone more expert than myself to confirm that though. You could see if that works as is, too.

Also, I dont know if it's appropriate here, but why not use variables for your VarGet statements, for ease of reading the code. Eg,

nhnlSig = VarGet( "NHNLSig_" + Sym );

Then you could substitute the lengthy VarGet code for a variable name and it might make the code easier to read?

CK

---In amibroker@yahoogroups.com, <kbglenn2@...> wrote :

I'm trying to sum up all the values of NHNLSig to get a NHNLStr (strength) value. The below is not working for the strength part

for( i = 0; ( Sym = StrExtract( SymbolList, i ) ) != ""; i++ )
{
    VarSet( "NHNLSig_" + Sym, IIf( VarGet( "NHNLMA_" + Sym )  < NHNLMATrigger2, -2, IIf( VarGet( "NHNLMA_" + Sym ) < 0 AND VarGet( "NHNLMA_" + Sym ) >= NHNLMATrigger2, -1, 1 ) ) );
    VarSet( "NHNLStr", Sum(VarGet( "NHNLSig_" + Sym ),1));
}

Plot(VarGet( "NHNLSig_N1"), "test", colorRed, styleLine);


Tks!


__._,_.___

Posted by: sladbrook@hotmail.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
**** 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/


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv