Profile Picture

How to create a custom indicator

Posted By parliament718 6 Years Ago
Message
Posted Wednesday December 28 2011
How do I create a custom indicator? The only thing I found in the documentation about that is it will be a plugin? But how do I build such plugin (which sounds way more complicated than how easy it is to make one in say NT). But anyways what classes should the indicator inherit from? What methods should I implement? Etc..

I decided to use RIghtEdge as my first trading system dev platform so Im not familiar with the entire event based architecture for analyzing bar data and it seems that the documentation and api are seriously lacking in explaining how to use the RightEdge libraries in depth to a beginner such as myself. Some guidance on how to go about learning to use the RightEdge libraries IN GENERAL would be appreciated but the main questions I guess really is "how do i create a custom indicator?" Im trying to create an indicator for pivot points. Which also bring up the question how do I access the current DAY's open, high, low, close regardless of what frequency the script is executing on.

Thanks

Edited: Thursday December 29 2011 by parliament718
Posted Thursday December 29 2011
Some things may indeed be more complicated in RightEdge, that's part of the trade off for flexibility. Of course, we're always working to improve ease of use without sacrificing flexibility. You have two choices, really. If you want your indicator to be a first class citizen in the RightEdge user interface, you must create an indicator plugin. The best place to start is to look at the source code of the indicators we ship with in the samples folder. There are 3 classes you can derive from, each with different benefits. Under the Create Indicator topic, check out the IndicatorBase, SeriesCalculatorBaseSimple and SeriesCalculatorBaseWithValues headings for a complete explanation of the tradeoffs.

The second option is to create a UserSeries. UserSeries are done in the trading system itself, they can be plotted on a chart, but have no drag and drop or capabilities of being referenced outside of the trading system itself.

Check out this topic for an explanation and code sample.

Finally, to address your question about accessing the current high, low, etc. Those are represented as ISeries values accessible within the trading system. So for example, to access the close, you would simply say something like:

double myClose = Close.Current;

To go back a day

double yesterdaysClose = Close.Lookback(1);

parliament718 (12/28/2011)
How do I create a custom indicator? The only thing I found in the documentation about that is it will be a plugin? But how do I build such plugin (which sounds way more complicated than how easy it is to make one in say NT). But anyways what classes should the indicator inherit from? What methods should I implement? Etc..

I decided to use RIghtEdge as my first trading system dev platform so Im not familiar with the entire event based architecture for analyzing bar data and it seems that the documentation and api are seriously lacking in explaining how to use the RightEdge libraries in depth to a beginner such as myself. Some guidance on how to go about learning to use the RightEdge libraries IN GENERAL would be appreciated but the main questions I guess really is "how do i create a custom indicator?" Im trying to create an indicator for pivot points. Which also bring up the question how do I access the current DAY's open, high, low, close regardless of what frequency the script is executing on.

Thanks
Posted Thursday December 29 2011
Which also bring up the question how do I access the current DAY's open, high, low, close regardless of what frequency the script is executing on.


If your system is running on a different frequency, you can access daily values by creating a separate daily frequency. This help topic covers how it works, but basically:

// In your symbol script class:
Frequency DailyFreq;

// In your symbol script Startup() method:
DailyFreq = GetFrequency(BarFrequency.Daily);

// To get the most recent close (may be "today" or yesterday depending on whether you are at the end of day or not)
double dailyClose = DailyFreq.Close.Current;

Thanks,
Daniel
Posted Friday December 30 2011
Spot on, thanks!


Edited: Friday December 30 2011 by parliament718


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems