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

Re: [amibroker] passing variables



PureBytes Links

Trading Reference Links



Great...but
I am programmatically challenged.  Is the param1 statement in the
included file, it looks like it would have to be there.  Could you
provide a more elaborate example please?
Cheers
Sid
At 10:11 PM 12/24/2003 +0100, you wrote:
Sid,
 
There
is absolutely NO problem with
that.
You
can use optimize and pass arguments to ANY function defined in external
file.
 
#include
<file_with_your_function.afl>
 
param1
= Optimize("param1", 5, 1, 10, 1
);
 
buy
= C > MyFunction( param1
);
 
Best regards,
Tomasz Janeczko
amibroker.com


----- Original Message ----- 

From: Sidney Kaiser


To: amibroker@xxxxxxxxxxxxxxx 

Sent: Wednesday, December 24, 2003 10:07 PM

Subject: RE: [amibroker] passing variables

Clarification:

What I am talking about is the ability to run optimize on the code that is in the include file.  This means the variables are defined in the main program and the current value is passed to the include program for the range of the optimization.

Upon further reading of the help files I am beginning to think this is NOT possible in AB.  Someone correct me if I am wrong on this.

Ken, thanks for your routine,  BTW, I think what you posted is STOCH + RSI rather than StochRSI which is the stochastic of RSI.

Cheers and Merry Christmas to all

Sid

At 03:28 PM 12/24/2003 -0500, you wrote:

Hi Sid:


I added this to my function file:


function StoRSI(RSIPer,EMAPer)


{


Low1=LLV(C,7);


High1=HHV(C,7);


return (EMA(100*(C - Low1)/(High1 - Low1),EMAPer)/2) + (RSI(RSIPer)/2);


}


Note the naming and the variable positions in the declaration of the StoRSI function.


I plotted this in my IB window:


X=StoRSI(14,13);


Plot(50,"",7,1);


Plot(X,"StoRSI",5,1);


The C/O/H/L/V arrays are always available, so I only "passed" two variables, the EMA period and the RSI Period.  It gets "passed" when you write the function within your regular AFL code.  In my case, following what a lot of others do, I #include a regular (and growing) MyFunctions.AFL file.


Hope this helps.


Ken


-----Original Message-----

From: Sidney Kaiser [mailto:s9kaiser@xxxxxxxxxxx]

Sent: Wednesday, December 24, 2003 12:02 PM

To: AmiBroker@xxxxxxxxxxxxxxx

Subject: [amibroker] passing variables


I use StochRSI fairly often and rather than re-write it all the time I 


decided to make a dedicated AFL file that I can include in the other files 


where I want to use the function.  Of course to be of any use, the 


variables need to be passed from the calling program to the included 


program.  I know how to do that in TS, but I don't see how to do it in AFL.


For my StochRSI fn I would want to pass the Array (usually Close), the RSI 


period and the smoothing MA to the include file.  Three variables in all.


How is this done?


TIA


Sid


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/ 


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 the Yahoo! Terms of Service. 

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 12/11/2003
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 the Yahoo! Terms of Service. 



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 12/11/2003

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 the Yahoo! Terms of Service. 

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 12/11/2003


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 Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.551 / Virus Database: 343 - Release Date: 12/11/2003