Monday, January 05, 2009     | Register
TradersStudio Forums
Subject: Derived Plots

You are not authorized to post a reply.   
Author Messages
quest
Posts:11

10-04-2008 4:52 PM Alert 

Hi,

Is it possible to take the output of one indicator plot as input to another? Let's use an example:

Bollinger bands plots a moving average with two bands. Is it possible to pipe the band values into another plot in order to calculate and plot the width of the bands in another window?

There are a number of uses for this type of logic but that's a good basic example.

 

Regards,

Dave

murray
Posts:435

10-10-2008 1:06 PM Alert 

Plot1Ago...Plot9Ago properties

Returns/Assigns value of the output series.

Syntax

Plot1Ago(BarsAgo) = value
value = Plot1Ago(BarsAgo)

The Plot1Ago property syntax has these parts:

Part Description
BarsAgo Number of the bar
value Price value on that bar

The following custom indicator demonstrates how you can access previous values of the plots:

 Sub IndicatorTest()
    Dim aver
    Dim dev

    aver = Average(Close, 10)
    dev = StdDev(Close, 10)

    Plot1(aver)
    Plot2(aver + dev)
    Plot3(aver - dev)
    If Plot1Ago(0) > Plot1Ago(5) Then BarColor(0)=vbBlue
End Sub

quest
Posts:11

10-13-2008 2:37 PM Alert 

That's not really what I'm after. It works on prior bars, when I just want to work with the current bar, and requires that the raw plot and derived plots both be in the same piece of code.

What I want to be able to do is make my code as generic as possible. So, plot A exists in function A while plot B exists as function B which is a fairly generic task type function - to do Y and Z to input X.

The separation helps with reuseability and elimination of code bloat. I suspect that what I want to do isn't possible. Is that correct?

 

Regards,

Dave

murray
Posts:435

10-14-2008 10:42 AM Alert 

One last thing to try is global variables, GValueXX. If that does not work then I don't think it's possible.

Question , why can't you write your indicator calculations as functions, call them in Indicator "B" as well as in Indicator "A"

 

quest
Posts:11

10-14-2008 10:59 AM Alert 
Posted By murray on 10-14-2008 10:42 AM

One last thing to try is global variables, GValueXX. If that does not work then I don't think it's possible.

Question , why can't you write your indicator calculations as functions, call them in Indicator "B" as well as in Indicator "A"

 

Hi,

Let's be clear...I haven't tried any of this yet. I'm asking a leading question here about how things should work. unfotunately, I don't have time for heading down blind alleys...I'm hoping you can light the way before I move on.

To me, there are two angles to this:

1. The programatic solution where values are calculated and used within my code. Your point above addresses this.

2. The charting solution where different indicators can be plotted and treated in different ways. Your answer doesn't seem to address this. By this I mean and indicator is plotted on a chart and a second indictor is then charted with the output of the first indictor taken as it's input.  

It's graphical rather than programmatic control I'm looking for. At times, manual slicing and dicing is the only way to gain insight. that requires flexibility and control...

 
Regards,

Dave

You are not authorized to post a reply.



ActiveForums 3.6
TradersStudio® Copyright 2004-2009 All Rights Reserved   |  Privacy Statement  |  Terms Of Use