NexusFi: Find Your Edge


Home Menu

 





Easylanguage subroutines


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one MooreTech with 3 posts (2 thanks)
    2. looks_two skan with 2 posts (0 thanks)
    3. looks_3 Big Mike with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 4,917 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

Easylanguage subroutines

(login for full post details)
  #1 (permalink)
skan
spain
 
Posts: 11 since Jun 2010
Thanks Given: 0
Thanks Received: 0

Hello

How can I create and use subroutines with Easylanguage?

I need to reuse code many times and it would be nice to convert it as a subroutines and call it several times.

Somebody might advise me to use functions but I need that those subrotuines also contain orders (sell, buy, stop loss...) and only strategies are allowed to send orders.


Thanks.


For example, but It could more difficult

/// Subrutine1
 
Code
If close>High[1]+30 then begin
	Buy("entry1") next bar at market;
	Sell("exitstop") Next Bar Low-30 stop;
end;

// Main code
 
Code
if condition1 then call subroutine1;
if condition2 then call subroutine2;
if condition3 then begin
	call subroutine1;
	call subroutine2;
end;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Request for MACD with option to use different MAs for fa …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
30 thanks
Supertradersams Thread Journal on NQ/MNQ
25 thanks
Deaddogs Stock Trading
23 thanks
GFIs1 1 DAX trade per day journal
22 thanks
Daytrading ES & NQ
13 thanks

(login for full post details)
  #3 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73


You can define your subroutines as methods.

 
Code
Method double Subroutine1(double dou) begin
    if t=1200 then Buy this bar;    
    Return dou*2;
end;    

Method double Subroutine2(double dou) begin
    if t=1300 then sell this bar;    
    Return dou/2;
end;   

value1=Subroutine1(c);
value2=Subroutine2(c);

setexitonclose;

If you have any questions about our products or services please contact me via Private Message
Follow me on Twitter Reply With Quote
The following 2 users say Thank You to MooreTech for this post:
(login for full post details)
  #4 (permalink)
 sysot1t 
 
Posts: 1,173 since Nov 2009

that should only work on TS9 right? I dont recall 8.x having methods, then again... I am not an expert on EL...


MooreTech View Post
You can define your subroutines as methods.

 
Code
Method double Subroutine1(double dou) begin
    if t=1200 then Buy this bar;    
    Return dou*2;
end;    
 
Method double Subroutine2(double dou) begin
    if t=1300 then sell this bar;    
    Return dou/2;
end;   
 
value1=Subroutine1(c);
value2=Subroutine2(c);
 
setexitonclose;


Reply With Quote
(login for full post details)
  #5 (permalink)
skan
spain
 
Posts: 11 since Jun 2010
Thanks Given: 0
Thanks Received: 0

I use Multicharts.
I can't find any documentation on this at powerlanguage.chm nor EL_FunctionsAndReservedWords_Ref.pdf help files.
Could you tell me where can I find it, please?

Can these subroutines send "Sell" and "Buy" orders or they are just functions?

Reply With Quote
(login for full post details)
  #6 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73


sysot1t View Post
that should only work on TS9 right? I dont recall 8.x having methods, then again... I am not an expert on EL...

I'm not sure which version introduced the functionality. Give it a try and see.

If you have any questions about our products or services please contact me via Private Message
Follow me on Twitter Reply With Quote
(login for full post details)
  #7 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73


skan View Post
I use Multicharts.
I can't find any documentation on this at powerlanguage.chm nor EL_FunctionsAndReservedWords_Ref.pdf help files.
Could you tell me where can I find it, please?

Can these subroutines send "Sell" and "Buy" orders or they are just functions?

As far as I know, MultiCharts does not support this as of yet. TradeStation is able to send orders from the subroutines.

If you have any questions about our products or services please contact me via Private Message
Follow me on Twitter Reply With Quote
(login for full post details)
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Posts: 50,234 since Jun 2009
Thanks Given: 33,106
Thanks Received: 101,351


MooreTech View Post
You can define your subroutines as methods.

Very useful.

When will @MultiCharts support this? (hoping Stan will respond).

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor


For the best trading education, watch our webinars
Searching for trading reviews? Review this list


Lifetime Elite Membership: Sign-up for only $149 USD
Receive exclusive offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:





Last Updated on August 18, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts