Code a Function for specific time frame  [SOLVED]

Questions about MultiCharts and user contributed studies.
brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Code a Function for specific time frame

Postby brunor » 19 Oct 2013

Is it possible to code a function to output a result based on a specific time frame?
For example:

Calculate FunctionA(1minute time frame) + FunctionA(2min) + FunctionA(5min) + ...

Any assistance would be appreciated.
Thanks.

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

Re: Code a Function for specific time frame

Postby TJ » 19 Oct 2013

Is it possible to code a function to output a result based on a specific time frame?
For example:
Calculate FunctionA(1minute time frame) + FunctionA(2min) + FunctionA(5min) + ...
Any assistance would be appreciated.
Thanks.
I am not sure what you are looking for...
your example does not explain anything.
What do you mean by output? to an ascii file?

Can you give more specific detail/example?

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Code a Function for specific time frame

Postby brunor » 20 Oct 2013

I apologize for the lack of detail.
I would like to calculate the following function for a 1 minute and 2 minute time frame, and
then plot the total (sum) onto a screener.

Code: Select all

*** How would you specify a specific time frame for this function?
condition1 = High < High[1]
AND Low < Low[1]
AND High[1] < High[2]
AND Low[1] < Low[2];
If condition1 Then
BR_TrendDOWN= 1
Else
BR_TrendDOWN= 0;
Example: Result of function BR_TrendDOWN(1 minute time frame) + Result of function BR_TrendDOWN(2 minute time frame) = 1+1 = 2. I would like to plot the result "2" onto a screener.

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

Re: Code a Function for specific time frame  [SOLVED]

Postby TJ » 20 Oct 2013

I apologize for the lack of detail.
I would like to calculate the following function for a 1 minute and 2 minute time frame, and
then plot the total (sum) onto a screener.
::
Example: Result of function BR_TrendDOWN(1 minute time frame) + Result of function BR_TrendDOWN(2 minute time frame) = 1+1 = 2. I would like to plot the result "2" onto a screener.
The easiest way is to duplicate the logic and save them into a single indicator;
set one logic for data1 (1 min) and the second logic for data2 (2 min).

eg.

Code: Select all

condition1 = (High < High[1]) data1;

condition2 = (High < High[1]) data2;
See post #4 and post #5
viewtopic.php?f=16&t=6929

brunor
Posts: 65
Joined: 11 Feb 2013
Has thanked: 24 times
Been thanked: 6 times

Re: Code a Function for specific time frame

Postby brunor » 21 Oct 2013

I am not familiar with the use of "data" but thank you for the tip. I have something to work with now.


Return to “MultiCharts”