Does this simple EL code actually work in TradeStation? - futures io
futures io



Does this simple EL code actually work in TradeStation?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 2,430 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Does this simple EL code actually work in TradeStation?

(login for full post details)
  #1 (permalink)
Genesis13
Brisbane Australia
 
 
Posts: 4 since Jun 2021
Thanks: 0 given, 1 received

Hello, before I sign up to use the TS platform for backtesting I need to know if my EL code posted below actually works and prints out the number 7 in the TS platform print log. Could someone please test this on their machine. Here is the code that I need tested. Does the EL code below print out the number 7 in the TS Print Log or does it not work for some reason? Really appreciate any help, huge thanks in advance.


[IntrabarOrderGeneration = TRUE]

variables:

intrabarpersist AD_Max_Pos_Acc_1(0),
intrabarpersist AD_Max_Pos_Acc_1_S(""),
intrabarpersist AD_Get_Pos_Acc_1(0),
intrabarpersist AD_Get_Pos_Acc_1_S(""),
intrabarpersist Count(0),
intrabarpersist Count_S(""),
intrabarpersist Lots(0);

AD_Max_Pos_Acc_1 = 13 ;

AD_Max_Pos_Acc_1_S = NumToStr(AD_Max_Pos_Acc_1,0);

AD_Get_Pos_Acc_1 = 6 ;

AD_Get_Pos_Acc_1_S = NumToStr(AD_Get_Pos_Acc_1,0);

Count = 1 ;

Count_S = NumToStr(Count,0) ;

Lots = StrToNum("AD_Max_Pos_Acc_" + Count_S + "_S") - StrToNum("AD_Get_Pos_Acc_" + Count_S + "_S") ;

Print("Lots = ",Lots) ; // Question: Does this Print statement print out the number 7 ?

Reply With Quote

Can you help answer these questions
from other members on futures io?
help with take profit several targets
TradeStation
How do I create Strategy with the Second Entry indicator
NinjaTrader
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
Big Mo Indicator for NT8
NinjaTrader
Multi Time Frame High/Low/Median levels
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,361 since Apr 2013
Thanks: 426 given, 1,578 received

Genesis13,

welcome to futures.io. Your code will print 0 due to the way StrToNum works.

Take a look at the description for this reserved word taken from the TS help file:

Quoting 
If any non-numeric characters are included in the string expression, zero (0) is returned. The only exception is when non-numeric characters are located at the end of the string expression, in which case, they are dropped from the numeric expression.

While your expression "AD_Max_Pos_Acc_" + Count_S + "_S" evaluates to the string AD_Max_Pos_Acc_1_S within EasyLanguage, the compiler will treat this as a new string literal and not access the value stored in the variable with the same name.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #3 (permalink)
Genesis13
Brisbane Australia
 
 
Posts: 4 since Jun 2021
Thanks: 0 given, 1 received


Hi ABCTG, huge thanks for your help and advice, I really appreciate this. Will my code print the number 7 (instead of 0) if I change the code to the following syntax? If not, can you think of any solution here to get the code to print the number 7 ?

[IntrabarOrderGeneration = TRUE]

variables:

intrabarpersist AD_Max_Pos_Acc_1(0),
intrabarpersist AD_Max_Pos_Acc_1_S(""),
intrabarpersist AD_Get_Pos_Acc_1(0),
intrabarpersist AD_Get_Pos_Acc_1_S(""),
intrabarpersist Count(0),
intrabarpersist Count_S(""),
intrabarpersist String1(""),
intrabarpersist String2(""),
intrabarpersist Lots(0);

AD_Max_Pos_Acc_1 = 13 ;

AD_Max_Pos_Acc_1_S = NumToStr(AD_Max_Pos_Acc_1,0);

AD_Get_Pos_Acc_1 = 6 ;

AD_Get_Pos_Acc_1_S = NumToStr(AD_Get_Pos_Acc_1,0);

Count = 1 ;

Count_S = NumToStr(Count,0) ;

String1 = "AD_Max_Pos_Acc_" + Count_S + "_S" ;

String2 = "AD_Get_Pos_Acc_" + Count_S + "_S" ;

Lots = StrToNum(String1) - StrToNum(String2) ;

Print("Lots = ",Lots) ; // Question: Does this Print statement print out the number 7 ?

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,361 since Apr 2013
Thanks: 426 given, 1,578 received

Genesis13,

it will also print 0, as you are basically trying the same just storing the string in another variable. You cannot dynamically set variable names and access the values of these variables within EasyLanguage the way you intend to do it.

One idea that comes to mind is using a Dictionary where you can store and lookup values using keys (strings).

Regards,

ABCTG


Genesis13 View Post
Hi ABCTG, huge thanks for your help and advice, I really appreciate this. Will my code print the number 7 (instead of 0) if I change the code to the following syntax? If not, can you think of any solution here to get the code to print the number 7 ?

[IntrabarOrderGeneration = TRUE]

variables:

intrabarpersist AD_Max_Pos_Acc_1(0),
intrabarpersist AD_Max_Pos_Acc_1_S(""),
intrabarpersist AD_Get_Pos_Acc_1(0),
intrabarpersist AD_Get_Pos_Acc_1_S(""),
intrabarpersist Count(0),
intrabarpersist Count_S(""),
intrabarpersist String1(""),
intrabarpersist String2(""),
intrabarpersist Lots(0);

AD_Max_Pos_Acc_1 = 13 ;

AD_Max_Pos_Acc_1_S = NumToStr(AD_Max_Pos_Acc_1,0);

AD_Get_Pos_Acc_1 = 6 ;

AD_Get_Pos_Acc_1_S = NumToStr(AD_Get_Pos_Acc_1,0);

Count = 1 ;

Count_S = NumToStr(Count,0) ;

String1 = "AD_Max_Pos_Acc_" + Count_S + "_S" ;

String2 = "AD_Get_Pos_Acc_" + Count_S + "_S" ;

Lots = StrToNum(String1) - StrToNum(String2) ;

Print("Lots = ",Lots) ; // Question: Does this Print statement print out the number 7 ?


Follow me on Twitter Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Does this simple EL code actually work in TradeStation?


Last Updated on June 17, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts