Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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.
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.
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.