Variable Input Indicators

Questions about MultiCharts and user contributed studies.
sims
Posts: 2
Joined: 13 Aug 2011

Variable Input Indicators

Postby sims » 15 Aug 2011

First post here - just want to say that I'm very happy with MultiCharts so far and glad i went with this platform as opposed to some of the others that are out there. For what I need I think it'll really get the job done. My only experience with programming is with TS a handful of years ago, and quite honestly it left something to be desired, specifically with regard to certain functionalities that MultiCharts cover. I'm optimistic about the purchase of my lifetime license.

Now, there's something specific I'm trying to do that I may not have the programming chops to get done (I'm not new to markets, but definitely new to programming my observations into code). Basically, I'd like to have indicators update their inputs as market conditions change.
As a basic example, let's say I've got a moving average and a basic standard deviation indicator to gauge volatility. Is it possible to have the length of the moving average change as volatility increases and decreases? I'm not sure if EasyLanguage supports this, but I think it is a big step towards building robust systems that hold up over multiple market cycles.

Any help would obviously be very appreciated. I'm wary to deploy a few of my ideas without making them a bit more intelligent. Nice community here, btw..

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Variable Input Indicators

Postby TJ » 15 Aug 2011

First post here - just want to say that I'm very happy with MultiCharts so far and glad i went with this platform as opposed to some of the others that are out there. For what I need I think it'll really get the job done. My only experience with programming is with TS a handful of years ago, and quite honestly it left something to be desired, specifically with regard to certain functionalities that MultiCharts cover. I'm optimistic about the purchase of my lifetime license.

Now, there's something specific I'm trying to do that I may not have the programming chops to get done (I'm not new to markets, but definitely new to programming my observations into code). Basically, I'd like to have indicators update their inputs as market conditions change.
As a basic example, let's say I've got a moving average and a basic standard deviation indicator to gauge volatility. Is it possible to have the length of the moving average change as volatility increases and decreases? I'm not sure if EasyLanguage supports this, but I think it is a big step towards building robust systems that hold up over multiple market cycles.

Any help would obviously be very appreciated. I'm wary to deploy a few of my ideas without making them a bit more intelligent. Nice community here, btw..
You can change the moving average length on the fly, but I am not sure how you can qualify the result, because it will be a moving target.

the syntax is:
MA = average( price, length ):

the "length" can be predetermined, or modified on the fly.



ps. if you need a refresher on EasyLanguage, you should start from post #1 here:
viewtopic.php?f=16&t=6929

sims
Posts: 2
Joined: 13 Aug 2011

Re: Variable Input Indicators

Postby sims » 15 Aug 2011

I don't actually want to change the length of a moving average - that was only a hypothetical example. The broader point is to have indicators that are capable of varying their inputs on the basis of another indicator's reading as of the current bar. Is this possible??

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Variable Input Indicators

Postby TJ » 15 Aug 2011

I don't actually want to change the length of a moving average - that was only a hypothetical example. The broader point is to have indicators that are capable of varying their inputs on the basis of another indicator's reading as of the current bar. Is this possible??
YES YES YES... that's the whole point of computerization -- tell MultiCharts your logic, and let it rip.


please see the ps. in my previous post.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Variable Input Indicators

Postby furytrader » 16 Aug 2011

To concur with TJ, yes it is. Let's imagine that you want to implement the following logic:

1) Start with specific input settings (for the sake of argument, let's say "length");
2) Based on other indicators, adjust that setting over time.

What you'd do is including an input for length. You'd also set a variable for length. You'd then use programming logic like this:

Code: Select all


Input: iLength(10);
Vars: vLength(0);

{The following code block will fire only on the first bar of the chart, and assign the value of the input setting 'iLength' to the variable 'vLength'. For ALL of our subsequent calculations, we will use the variable vLength - the input setting just gets us started off right}

If BarNumber = 1 Then Begin
vLength = iLength;
End;

{This code block then adjusts the value of the vLength variable based on arbitrary technical rules}

If RSI(C,10) > 80 then vLength = vLength + 1;
If RSI(C,10) < 20 Then vLength = vLength - 1;

If vLength = 0 Then vLength = 1;

{We can then include some trading rules here}

If Average(C,vLength) Crosses Above Average(C,20) Then Buy This Bar On Close;
If Average(C,vLength) Crosses Below Average(C,20) Then Sell Short This Bar On Close;
The point here is that the variable "vLength" is used to calculate the moving averages (and generate trading signals) but its initial value is set based on the input setting. This value is then adjusted based on what the RSI does.

BTW, I'm not suggesting this as a viable system - it's just an example.

Good luck!


Return to “MultiCharts”