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

[amibroker] Re: send the last value of an array into the periods field



PureBytes Links

Trading Reference Links

Hello Mike,

Thank you very much for the private lesson. It's a great help.

It is working as I want with LastValue.

Regards

--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Hi,
> 
> Based on the documentation, your code:
> 
> VarSet("docy"+1,DomCycle);
> 
> will store the entire DomCycle array. If you want to store a single 
> value from that array (e.g. the value for the current bar), then you 
> should use the Ref function as follows:
> 
> VarSet("docy"+1,Ref(DomCycle, 0)); // Store current bar value
> http://www.amibroker.com/guide/afl/afl_view.php?name=varset
> 
> If what you want is really the *last* value (i.e. the very last value 
> in the array, which may be a value far into the future), then use the 
> LastValue function:
> 
> LastValue(DomCycle);
> http://www.amibroker.com/guide/afl/afl_view.php?id=81
> 
> Finally, WriteVal returns a String, so you cannot use it as the 2nd 
> argument of the Param function, which requires a number.
> http://www.amibroker.com/guide/afl/afl_view.php?name=writeval
> http://www.amibroker.com/guide/afl/afl_view.php?name=param
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "reinsley" <reinsley@> wrote:
> >
> > Hello,
> > 
> > I can't send the last value of an array DomCycle into the periods 
> field.
> > 
> > 
> > In a loop, the value of the array stays inside the loop.
> > So, inside the loop I do a :
> > 
> > VarSet("docy"+1,DomCycle);
> > 
> > and outside the loop I do a :
> > 
> > docy=int(VarGet("docy"+1));
> > 
> > A trace give me the integer of the last value of the array DomCycle.
> > It seems correct. 
> > However my number is still in an array.
> > 
> > 
> > 
> > I would like to send the last value of docy into the periods field
> > like this :
> > Periods = Param("Periods", docy, 2, 200, 1, 10 );
> > or
> > AEMA=EMA(Data ,docy);
> > 
> > This is incorrect too :
> > Periods = Param("Periods", WriteVal(docy,1.0), 2, 200, 1, 10 );
> > 
> > Error is argument #2 has incorrect type.
> > 
> > 
> > 
> > 
> > I will appreciate help.
> > 
> > Regards
> >
>



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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
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/