TradeStation \ Easy Language life hacks - futures io
futures io



TradeStation \ Easy Language life hacks


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one swingbatter with 1 posts (1 thanks)
    2. looks_two artisanpro with 1 posts (2 thanks)
    3. looks_3 MasterYan with 1 posts (1 thanks)
    4. looks_4 njhprovo with 1 posts (1 thanks)
      Best Posters
    1. looks_one artisanpro with 2 thanks per post
    2. looks_two MasterYan with 1 thanks per post
    3. looks_3 njhprovo with 1 thanks per post
    4. looks_4 swingbatter with 1 thanks per post
    1. trending_up 4,040 views
    2. thumb_up 5 thanks given
    3. group 5 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
 

TradeStation \ Easy Language life hacks

(login for full post details)
  #1 (permalink)
MasterYan
San Francisco, CA
 
 
Posts: 29 since Jul 2016
Thanks: 13 given, 4 received

Do you have any life hacks in TradeStation or Easy Language that you can share ?

Reply With Quote
The following user says Thank You to MasterYan for this post:

Can you help answer these questions
from other members on futures io?
Market on Close data within IB
Platforms and Indicators
How do I create Strategy with the Second Entry indicator
NinjaTrader
Multi Time Frame High/Low/Median levels
NinjaTrader
NT8 Order Management Strategy
The Elite Circle
Big Mo Indicator for NT8
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
88 thanks
An embarrassing, honest confession
25 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
ApexTraderFunding.com experience and review
8 thanks
Want your NinjaTrader indicator created, free?
7 thanks
 
(login for full post details)
  #2 (permalink)
 njhprovo 
Provo, Utah
 
Experience: Advanced
Platform: TradeStation
Trading: NQ, YM, RTY, ES, US, CL, EC, JY
 
Posts: 4 since Mar 2020
Thanks: 1 given, 5 received

What type of thing are you looking for?

njh

Reply With Quote
The following user says Thank You to njhprovo for this post:
 
(login for full post details)
  #3 (permalink)
artisanpro
toronto canada
 
 
Posts: 19 since May 2021
Thanks: 20 given, 9 received


Here are four very similar hacks that work with Mutlichart Easy Language. The key hacks here are: how to change an indicator used in many windows/workspaces "all at once" as opposed to change single occurrences.

Hack 1:
How to change "all at once" the input values of an indicator that is being used in multiple windows and multiple workspaces.

As an example, you have an EMA using an input value of 14 but would prefer now to use 21 as the indicator input.

1. Open your indicator in the "power language editor".
2. Move the input to the "variable section"
3. Change the value.
4. Compile.
5. Move the input currently in the "variable section" back to the "input section"
6. Compile.

Hack 2:
Create a function that only contains/returns a value. Use that function as an input value to any/all indicators.

Function:
__fff_RngeExtrLong = 14 ;

Indicator Input:
iRERangeLength( __fff_RngeExtrLong ),

If you change the function value to 21 (i.e .__fff_RngeExtrLong = 21 ; and recompile) all indicators with this input will now use 21 in their calculations.


Hack 3:
How to change "all at once" the plot visual of an indicator that is being used in multiple windows and multiple workspaces.

As an example, you have an EMA that plots a Solid Line ______ but you want to change it in every occurrences of windows and workspaces "all at once" with a plot of a Dashed Line - - - - - .

This is fairly obvious once you know these keywords: SetPlotBGColor, SetPlotColor, Setplotstyle, SetPlotWidth. Open your indicator in the "power language editor", add the appropriate keyword in your code before the plot and recompile. See this link for how to use them: https://www.multicharts.com/trading-software/index.php?title=Category:Plotting

Hack 4:
How to change "all at once" the input values, properties, code, visual, etc of an indicator that is being used in multiple windows and multiple workspaces.

As an example, you want to do many changes to the input values and to the plotting visuals of a few plots in your indicator.

1. Open your indicator in the "power language editor".
2. Make the changes to the input values, code or code properties (with right click to open up the sub-menu), etc.
3. Compile ( if needed).
4. Comment the entire code by using '{' at the beginning of the code and '}' at the end of the code.
5. Compile again. I know, there nothing to compile but .... it is necessary.
6. Delete the added '{' and '}'.
7. Compile again and all your changes (input values, properties, etc, ) have been replicated in all the opened windows/workspaces.

This may read like tedious / complicated but once you have done it 1-2 times it becomes easy and you wonder why it is not a standard feature to be used by people like that change their mind sometimes. One caution, the "format study template" will not be changed.


General Comment:
Hack 4 is not obvious and I came to notice that sometimes my changes were replicated so I started paying a bit more attention and wrote this "recipe".

Hack 3 is simple but also can be used to change automatically the color, line style of a plot using conditions. Here is an example:
If iRERangeLength = __fff_RngeExtrLong then begin
vTaTplotColour = green ;
// setplotstyle(21, 3 ) ;
// setplotstyle(33, 3 ) ;
end else
If iRERangeLength = __fff_RngeExtrShort then begin
vTaTplotColour = magenta ;
setplotstyle(21, 4 ) ;
setplotstyle(33, 4 ) ;
end else
If iRERangeLength <> __fff_RngeExtrLong OR iRERangeLength <> __fff_RngeExtrShort then begin
vTaTplotColour = darkgreen ;
setplotstyle(21, 2 ) ;
setplotstyle(33, 2 ) ;
end ;

Hack 2 works also for something like """__ffPrix = (Open + High + Low + Close) / 4) ;"""

I hope that these hacks will prove useful to some of you and if it works with Tradestation let me know.

Reply With Quote
The following 2 users say Thank You to artisanpro for this post:
 
(login for full post details)
  #4 (permalink)
swingbatter
Arlington
 
 
Posts: 18 since Feb 2020
Thanks: 6 given, 2 received

Multiple Conditions Hack 1:
To test a strategy in which at least k out of n conditions (like MACD cross, RSI threshold, etc) are satisfied to execute a trade (regardless of which ones), you can just keep a count.
For instance if I wanted 3 out of 5 conditions to be met before buying a stock:
--------------------------------------------------------------------
input: minNumConditionsMet(3);
var: NumConditionsMet(0);

NumConditionsMet=0;
if condition_1 then NumConditionsMet+=1;
if condition_2 then NumConditionsMet+=1;
if condition_3 then NumConditionsMet+=1;
if condition_4 then NumConditionsMet+=1;
if condition_5 then NumConditionsMet+=1;

if NumConditionsMet >= minNumConditionsMet then
buy 1 share next bar at market;
setprofittarget(10);
--------------------------------------------------------------------

Multiple Conditions Hack 2:
To determine exactly which conditions work best together (and which to ditch), you can make the optimizer turn on/off the conditions sequentially. (So we're optimizing conditions instead of just variables.)
If we have 5 conditions (n=5), there are actually 2^n = 32 ways we can implement those 5 conditions: utilize all of them, or only 1, only 1&4, only 1,3&5, etc.
Stick your conditions in the code below, and then, during optimization, set the "combinations" input variable to iterate from 1 to 32, incrementing by 1, and this will test every combination of your conditions and arrive at the best mix.

------------------------------------------------------------------
input: combinations(32);
var: int n(0), bool shouldBuy(true);
shouldBuy=true;
n=1;
if mod(combinations, power(2,n) ) < power(2,n-1) and shouldBuy=true then
if condition_1 then
shouldBuy=true else shouldBuy=false;
n=2;
if mod(combinations, power(2,n) ) < power(2,n-1) and shouldBuy=true then
if condition_2 then
shouldBuy=true else shouldBuy=false;
n=3;
if mod(combinations, power(2,n) ) < power(2,n-1) and shouldBuy=true then
if condition_3 then
shouldBuy=true else shouldBuy=false;
n=4;
if mod(combinations, power(2,n) ) < power(2,n-1) and shouldBuy=true then
if condition_4 then
shouldBuy=true else shouldBuy=false;
n=5;
if mod(combinations, power(2,n) ) < power(2,n-1) and shouldBuy=true then
if condition_5 then
shouldBuy=true else shouldBuy=false;

if shouldBuy=true then
buy 1 share next bar at market;
setprofittarget(10);
--------------------------------------------------------------------

The code comes in handy when dealing with 4 or more conditions and is easily scalable for as many conditions as you want.

Reply With Quote
The following user says Thank You to swingbatter for this post:


futures io Trading Community Platforms and Indicators EasyLanguage Programming > TradeStation \ Easy Language life hacks


Last Updated on September 15, 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