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

Re[2]: Applying stat. indicators to spreads



PureBytes Links

Trading Reference Links

Hello Tanoto,  the change needed is in the first line of indicator
code as follows:

TSI> Indicator

TSI> Inputs: Price(Close of Data1 - close of Data2), Length(14),



Friday, February 01, 2002, 10:34:09 AM, you wrote:

TSI> tks for the replies, I really appreciate that.

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

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

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

TSI> tsi

TSI> Function

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

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

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



TSI> Indicator

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

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

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

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

TSI> ----- Original Message -----
TSI> From: "Jim Johnson" <jejohn@xxxxxxxxxxxxxxxx>
TSI> To: "Tanoto Sau Ian" <sitanoto@xxxxxxxxxxxxxx>
TSI> Cc: <omega-list@xxxxxxxxxx>
TSI> Sent: Friday, February 01, 2002 11:02
TSI> 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
TSI> spread =
>> TSI> charts of spreads. However, that is not possible as I can only choose
TSI> =
>> TSI> either data1 or data2, which are components of the spread, instead of
TSI> =
>> TSI> the spread itself.
>>
>> TSI> Do i have to rewrite all these indicators to work with spreads or are
TSI> =
>> 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



-- 
Best regards,
 Jim                            mailto:jejohn@xxxxxxxxxxxxxxxx