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

Re: questions about plotting indicators?



PureBytes Links

Trading Reference Links

At 9:56 PM -0700 7/24/01, p wrote:

>  Have a question about how to plot 2 indicators only on the last 20 days
>of a chart.
>  Like if I have 500 days of data on my chart.  How can I have a plot of
>say a moving average and say something like stochastics or RSI plot only on
>the last 20 days? 
>  Any ideas, would be helpful.

Try something like:

   Vars: StartDay(0), RSI_Val(0);

   if CurrentBar = 1 then begin
      StartDay = JulianToDate(LastCalcDate - 20);
   end;

   RSI_Val = RSI(Close, Length);

   if Date >= StartDay then begin
      Plot1(RSI_Val, "1");     
      Plot2(.... , "2");     
      Plot3(.... , "3");
   end;

Be sure to use variables to calculate the value of RSI, etc., outside
the plotting conditional code to make sure the values are properly
initialized.

You will need to plot points rather than lines if you only want it to
plot during the above interval.

Bob Fulks