Welcome to 4XLab.NET : Forex Lab Community Server
Sign in
|
Join
|
Faq
4XLab.NET : Forex Lab Community Server
Forex Simulator Software and Mechanical Trading Systems Forums
Forums
Home
Indicators
Started by asimon at 07-25-2006 4:52 PM. Topic has 0 replies.
4XLab.NET : For...
»
4XLab.NET
»
Indicators
»
Sample Indicator
Search
Sort Posts:
Oldest to newest
Newest to oldest
07-25-2006, 4:52 PM
asimon
Joined on 03-07-2006
Posts 140
Sample Indicator
public
class
iStub
{
int
tickcount;
int
periods;
//
// declare basic indicators here
//
public
iStub(
int
pPeriods)
{
periods = pPeriods;
tickcount = 0;
// instantiate any basic indicators here
}
public
void
ReceiveTick(
double
Val)
{
tickcount++;
if
(tickcount == (3*periods))
{
tickcount = (2*periods);
// avoid overflow (large->0) when indicator is primed
}
// perform indicator calculations here or send ticks to other indicators
}
public
double
Value()
{
double
v=0;
// compute indicator value here (note that this function might get called multiple times
// so do not set flags or do time specific behavior
if
(isPrimed())
{
// perform computation of output value
v = 1;
}
return
v;
}
// returns true when indicator has seen enough values to compute a result
// it will never return true if initialization parameters are incorrect
// this will cause indicator to silently fail and not give results
// on optimization runs where parameter combination is invalid.
public
bool
isPrimed()
{
bool
v =
false
;
// change this to the appropriate criteria
if
((tickcount >= periods) && (periods>0))
{
v =
true
;
}
return
v;
}
}
Report
4XLab.NET : For...
»
4XLab.NET
»
Indicators
»
Sample Indicator
(please select)
Forums Home
|- Search Forums
|- Active Topics
|- Unanswered Posts
User Options
|- Sign In
|- Join this community
|- Forgot Password
4XLab.NET
|- Introduction
|- Tools Of The Trade
|- Automated Trading Systems
|- FX University
|-- Forums
|-- Classrooms
|- 4XLab.NET Trading Systems Source Code
|-- 4XLab.NET GUI Source Code
|- Indicators
|- Questions and Answers
|- InvestorFLIX
|- Articles
Lectures
|- Lesson Meeting Times
|- Week 1
|- Week 2
Forex Lab .NET | 4X Lab .NET © Copyright 2005-2006 ASCSE LLC |
Disclaimer