Access price data and/or pass price to a method() - how?
Author: garylapidus
Creation Date: 2/23/2012 1:02 PM
profile picture

garylapidus

#1
My script passes RSI data from Execute() into method DoThis(). The RSI I pass appears to be established w/ statement:
RSI rsi = RSI.Series( Close, period );

and then I pass it w/ the statement:
Method (ref Variable, rsi, ...)

I want to do the same thing with Price, e.g. closing price, i.e. pass it into DoThis()

I am not able to access price data directly within DoThis(), e.g. using Close[bar] syntax
It seems I need a statement that makes Price accessible inside DoThis(), akin to the statement:
RSI rsi = RSI.Series( Close, period );

FYI
protected override void Execute() is one { within public class MyStrategy : WealthScript, and Method() is also one { within MyStrategy

Help greatly appreciated.
profile picture

Eugene

#2
Closing price, or other OHLC components, is a DataSeries - exactly like RSI.Series. Therefore, same calling convention applies if you want to pass another DataSeries.

Was:
void Method( ref Variable, RSI rsi, ...)

Becomes:
void Method( ref Variable, RSI rsi, DataSeries c...)

where c = Bars.Close
profile picture

garylapidus

#3
appologies, but my limited skill not allowing me to interpret your timely reply. I tried what you said but compiler does not like syntax (I am using).

Let me please paste the relevant statements. The statement which appears to "declare" RSI is

RSI rsi = RSI.Series( Close, period );

Do I need a similar statement for Price, and if so what form would it take?

what is the significance of 'RSI' vs 'rsi' in this statement? I don't understand it.

The statement(s) which call Method () look like

Method (ref vari, ..., rsi, ...);

While the Method statement itself is
static void Method(ref int vari,..., RSI rsi, ...)

you said use - void Method (RSI rsi, DataSeries C, ...) Is C a string variable or do I just type that in? What is the corresponding syntax for "Price" in the statement which calls Method()? Based on the RSI rsi syntax it would appear to be (..., DataSeries,...).

Help greatly appreciated.
profile picture

Eugene

#4
Is this more clear?
CODE:
Please log in to see this code.
profile picture

garylapidus

#5
thanks!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).