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

[amibroker] Re: problem with "buyprice" and "shortprice" during backtesting



PureBytes Links

Trading Reference Links

Thanks for clarifying Tomasz. I'd noticed that I couldn't pass the arrays in
and give the function parameters the same names as the globals, and that's
why -- I didn't declare them as globals.

FWIW, it would be great if we had pointers to variables, to allow the
function to be told what return vars to use. The resulting code would make
the function's internals much less tightly coupled to the outside world, a
Good Thing, as I know you know.

Dave

> Yes but you should use global keyword inside function to make sure
> it is treates  variables as global and you don't need to declare
> them before function call:
>
> function SetTwoArrays()
> {
>    global staReturn1, staReturn2;
>
>    staReturn1 = C;
>    staReturn2 = ROC( C, -1 );
>
>    return MACD(); // you can return 3rd array
> }
>
>
> SetTwoArrays();
>
> //staReturn1 and staReturn2 variables are accessible there;
>
> WriteVal( staReturn1);
> WriteVal( staReturn2 );
>
> Hope this helps.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Yahoo! Groups Links

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

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/