[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applying stat. indicators to spreads



PureBytes Links

Trading Reference Links

tks for the replies, I really appreciate that.

As for the changes, do I applly them in the "indicator" or "function" files?

I have tried to be as "hardworking as possible", but hard as I had tried, I
still could not get them right. Thus, I hope my esteemed friends here would
be kind enough to point me in the right direction.

I have included the codes for RSI's indicator and function files. Would u be
kind enough to show me the amendments to these files so that RSI can be
applied to spread prices? I hope I am not giving u the impression that I am
not willing to think. I have tried very hard, but still my best is not
enough to get them to work. Please just show me one example so that I may
learn from it. tks a million.

tsi

Function

Inputs: Price(NumericSeries), Length(NumericSimple);
Variables: Counter(0), DownAmt(0), UpAmt(0), UpSum(0), DownSum(0), UpAvg(0),
DownAvg(0);

If CurrentBar = 1 AND Length > 0 Then Begin
 UpSum = 0;
 DownSum = 0;
 For Counter = 0 To Length - 1 Begin
  UpAmt = Price[Counter] - Price[Counter+1];
  If UpAmt >= 0 Then
   DownAmt = 0
  Else Begin
   DownAmt = -UpAmt;
   UpAmt = 0;
  End;
  UpSum = UpSum + UpAmt;
  DownSum = DownSum + DownAmt;
 End;
 UpAvg = UpSum / Length;
 DownAvg = DownSum / Length;
End
Else
 If CurrentBar > 1 AND Length > 0 Then Begin
  UpAmt = Price[0] - Price[1];
  If UpAmt >= 0 Then
   DownAmt = 0
  Else Begin
   DownAmt = -UpAmt;
   UpAmt = 0;
  End;
  UpAvg = (UpAvg[1] * (Length - 1) + UpAmt) / Length;
  DownAvg = (DownAvg[1] * (Length - 1) + DownAmt) / Length;
 End;

If UpAvg + DownAvg <> 0 Then
 RSI = 100 * UpAvg / (UpAvg + DownAvg)
Else
 RSI = 0;



Indicator

Inputs: NumericStream(Close), Length(14), BuyZone(30), SellZone(70),
BZColor(Green), SZColor(Magenta);

Plot1(RSI(NumericStream, Length), "RSI");
Plot2(BuyZone, "BuyZone");
Plot3(SellZone, "SellZone");

If Plot1 > SellZone then Begin
 Alert("The RSI is in overbought territory");
 SetPlotColor(1, SZColor);
End
Else
 If Plot1 < BuyZone then Begin
  Alert("The RSI is in oversold territory");
  SetPlotColor(1, BZColor);
 End;

{RSI Expert Commentary }
#BeginCmtry
 Commentary(ExpertRSI(Plot1, Plot2, Plot3));
#End;

----- Original Message -----
From: "Jim Johnson" <jejohn@xxxxxxxxxxxxxxxx>
To: "Tanoto Sau Ian" <sitanoto@xxxxxxxxxxxxxx>
Cc: <omega-list@xxxxxxxxxx>
Sent: Friday, February 01, 2002 11:02
Subject: Re: Applying stat. indicators to spreads


> Hello Tanoto,
>
> for any indicator where Price is an input (often you;ll see
> Price(close) ) you would substitute Price(Close of Data1 - Close of
> Data2).  Obviously the minus could be "divide by" depending the kind
> of spread you want.
>
> Thursday, January 31, 2002, 5:26:47 PM, you wrote:
>
> TSI> Hi,
>
> TSI> I am trying to apply stat. indicators like RSI, momentum, etc to
spread =
> TSI> charts of spreads. However, that is not possible as I can only choose
=
> TSI> either data1 or data2, which are components of the spread, instead of
=
> TSI> the spread itself.
>
> TSI> Do i have to rewrite all these indicators to work with spreads or are
=
> TSI> they just impossible to do so?
>
> TSI> Tks, for all the help u guys are giving here.
>
> TSI> tsi
>
>
>
> --
> Best regards,
>  Jim                            mailto:jejohn@xxxxxxxxxxxxxxxx