Package com.strategyquant.tradinglib
Class ChartData
java.lang.Object
com.strategyquant.tradinglib.debug.Debugger
com.strategyquant.tradinglib.ChartData
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StrategyBase
The Class ChartData.
- See Also:
- Serialized Form
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
The Constant ChartTF_D1.static int
The Constant ChartTF_M1.static int
The Constant ChartTF_W1.The Close.The Connection.int
The Event type.The High.The Instrument.static org.slf4j.Logger
The Constant Log.The Low.com.strategyquant.tradinglib.strategy.MarketData
The Market data.com.strategyquant.datalib.dataseries.ComputedDataSeries
The Median.The Open.The Symbol.com.strategyquant.datalib.dataseries.TimeDataSeries
The Time.The Timeframe.com.strategyquant.datalib.dataseries.ComputedDataSeries
The Typical.The Volume.com.strategyquant.datalib.dataseries.ComputedDataSeries
The Weighted. -
Constructor Summary
ConstructorDescriptionInstantiates a new chart data.ChartData(com.strategyquant.tradinglib.strategy.MarketData marketData, ChartDef chartDef, int serieIndex, int backtestEngine)
Instantiates a new chart data.ChartData(String timeframe, com.strategyquant.datalib.dataseries.TimeDataSeries time, DataSeries open, DataSeries high, DataSeries low, DataSeries close, DataSeries volume, com.strategyquant.datalib.dataseries.TimeDataSeries timeD, DataSeries openD, DataSeries highD, DataSeries lowD, DataSeries closeD, com.strategyquant.datalib.dataseries.TimeDataSeries timeW, DataSeries openW, DataSeries highW, DataSeries lowW, DataSeries closeW, com.strategyquant.datalib.dataseries.TimeDataSeries timeM, DataSeries openM, DataSeries highM, DataSeries lowM, DataSeries closeM)
Instantiates a new chart data. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Ask()
Ask.int
Bars()
Bars.int
Bars(int chartIndex)
Bars.double
Bid()
Bid.double
Returns BigPointValue (Tradestation compatibility)int
Chart hash code.cloneForTF(int chartTF)
Clone for TF.cloneOnlyTF(int chartTF)
Clone for TF.double
Close(int shift)
Close.double
Close(int chartIndex, int shift)
Close.double
CloseD(int shift)
Close D.double
CloseD(int chartIndex, int shift)
Close D.double
CloseM(int shift)
Close M.double
CloseM(int chartIndex, int shift)
Close M.double
CloseW(int shift)
Close W.double
CloseW(int chartIndex, int shift)
Close W.void
destroy()
destroys all objects in this market data and frees offheap memory.void
findTickInData(TickEvent tick, int eventTypeToProcess, boolean callCloseEvent, boolean updateData, int dataSerie)
Find tick in data.void
findTickInDataComplete(TickEvent tick, int eventTypeToProcess)
there are always two calls of processTick() from MarketData for every tick: - first for BarClose event, and then for BarOpen eventint
Gets the connection hash.Gets the connection name.int
Gets the current bar.int
Gets the instrument info.double
Gets the min distance.int
Gets the serie index.getSeries(int serieType)
Gets the series.getSeries(int serieType, int chartTF)
Gets the series.Gets the symbol.int
Gets the symbol hash.double
High(int shift)
High.double
High(int chartIndex, int shift)
High.double
HighD(int shift)
High D.double
HighD(int chartIndex, int shift)
High D.double
HighM(int shift)
High M.double
HighM(int chartIndex, int shift)
High M.double
HighW(int shift)
High W.double
HighW(int chartIndex, int shift)
High W.boolean
isNewBarOnMainSymbolTF(TickEvent tick)
returns true if current tick starts a new bar - means it is open of a new bar Reguired for realistic gaps handling in MT4.boolean
Checks if is next day.boolean
returns true if this chart was updated in the recent tick.double
Low(int shift)
Low.double
Low(int chartIndex, int shift)
Low.double
LowD(int shift)
Low D.double
LowD(int chartIndex, int shift)
Low D.double
LowM(int shift)
Low M.double
LowM(int chartIndex, int shift)
Low M.double
LowW(int shift)
Low W.double
LowW(int chartIndex, int shift)
Low W.double
Median(int shift)
Median.double
MinMove()
Returns MinMove (Tradestation compatibility)double
Open(int shift)
Open.double
Open(int chartIndex, int shift)
Open.double
OpenD(int shift)
Open D.double
OpenD(int chartIndex, int shift)
Open D.double
Openint(int shift)
Openint.double
OpenM(int shift)
Open M.double
OpenM(int chartIndex, int shift)
Open M.double
OpenW(int shift)
Open W.double
OpenW(int chartIndex, int shift)
Open W.double
Returns PriceScale (Tradestation compatibility)void
processTick(TickEvent tick, int eventTypeToProcess, int seriesCount)
there are always two calls of processTick() from MarketData for every tick: - first for BarClose event, and then for BarOpen eventvoid
processTickSimplified(TickEvent tick, int seriesCount)
simplified tick processing for bars - used only in MarketData.requestHistoryData()void
Reset prepared data shifts.void
setCurrentBar(int reservedBars, int userDefinedStartingBar)
Sets the current bar.void
setIndyStartingBar(int indyStartingBar)
void
Sets the instrument info.void
setPerformanceParams(boolean hasOnTickRule, boolean hasDailyDataBlock, boolean hasWeeklyDataBlock, boolean hasMonthlyDataBlock)
Sets the performance params.void
Sets the symbol.long
Time()
Time.long
Time(int shift)
Time.long
Time(int chartIndex, int shift)
Time.long
Time current.long
TimeD(int shift)
Time D.long
TimeM(int shift)
Time M.long
TimeW(int shift)
Time W.double
Typical(int shift)
Typical.double
Volume(int shift)
Volume.double
Volume(int chartIndex, int shift)
Volume.Methods inherited from class com.strategyquant.tradinglib.debug.Debugger
debug, fdebug
-
Field Details
-
Log
public static final org.slf4j.Logger LogThe Constant Log. -
ChartTF_D1
public static final int ChartTF_D1The Constant ChartTF_D1.- See Also:
- Constant Field Values
-
ChartTF_W1
public static final int ChartTF_W1The Constant ChartTF_W1.- See Also:
- Constant Field Values
-
ChartTF_M1
public static final int ChartTF_M1The Constant ChartTF_M1.- See Also:
- Constant Field Values
-
Time
public com.strategyquant.datalib.dataseries.TimeDataSeries TimeThe Time. -
Open
The Open. -
High
The High. -
Low
The Low. -
Close
The Close. -
Median
public com.strategyquant.datalib.dataseries.ComputedDataSeries MedianThe Median. -
Typical
public com.strategyquant.datalib.dataseries.ComputedDataSeries TypicalThe Typical. -
Weighted
public com.strategyquant.datalib.dataseries.ComputedDataSeries WeightedThe Weighted. -
Volume
The Volume. -
MarketData
public com.strategyquant.tradinglib.strategy.MarketData MarketDataThe Market data. -
Connection
The Connection. -
Symbol
The Symbol. -
Instrument
The Instrument. -
Timeframe
The Timeframe. -
EventType
public int EventTypeThe Event type.
-
-
Constructor Details
-
ChartData
public ChartData()Instantiates a new chart data. -
ChartData
public ChartData(String timeframe, com.strategyquant.datalib.dataseries.TimeDataSeries time, DataSeries open, DataSeries high, DataSeries low, DataSeries close, DataSeries volume, com.strategyquant.datalib.dataseries.TimeDataSeries timeD, DataSeries openD, DataSeries highD, DataSeries lowD, DataSeries closeD, com.strategyquant.datalib.dataseries.TimeDataSeries timeW, DataSeries openW, DataSeries highW, DataSeries lowW, DataSeries closeW, com.strategyquant.datalib.dataseries.TimeDataSeries timeM, DataSeries openM, DataSeries highM, DataSeries lowM, DataSeries closeM)Instantiates a new chart data.- Parameters:
timeframe
- the timeframetime
- the timeopen
- the openhigh
- the highlow
- the lowclose
- the closevolume
- the volumetimeD
- the time DopenD
- the open DhighD
- the high DlowD
- the low DcloseD
- the close DtimeW
- the time WopenW
- the open WhighW
- the high WlowW
- the low WcloseW
- the close WtimeM
- the time MopenM
- the open MhighM
- the high MlowM
- the low McloseM
- the close M
-
ChartData
public ChartData(com.strategyquant.tradinglib.strategy.MarketData marketData, ChartDef chartDef, int serieIndex, int backtestEngine) throws ExceptionInstantiates a new chart data.- Parameters:
marketData
- the market datachartDef
- the chart defserieIndex
- the serie indexbacktestEngine
- the backtest engine- Throws:
Exception
- the exception
-
-
Method Details
-
chartHashCode
public int chartHashCode()Chart hash code.- Returns:
- the int
-
TimeCurrent
Time current.- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
Time
Time.- Parameters:
shift
- the shift- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
Time
Time.- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
Time
Time.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
TimeD
Time D.- Parameters:
shift
- the shift- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
TimeW
Time W.- Parameters:
shift
- the shift- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
TimeM
Time M.- Parameters:
shift
- the shift- Returns:
- the long
- Throws:
TradingException
- the trading exception
-
Ask
Ask.- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Bid
Bid.- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Open
Open.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Open
Open.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
OpenD
Open D.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
OpenD
Open D.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
OpenW
Open W.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
OpenW
Open W.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
OpenM
Open M.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
OpenM
Open M.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Close
Close.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Close
Close.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
CloseD
Close D.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
CloseD
Close D.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
CloseW
Close W.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
CloseW
Close W.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
CloseM
Close M.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
CloseM
Close M.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
High
High.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
High
High.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
HighD
High D.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
HighD
High D.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
HighW
High W.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
HighW
High W.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
HighM
High M.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
HighM
High M.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Low
Low.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Low
Low.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
LowD
Low D.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
LowD
Low D.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
LowW
Low W.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
LowW
Low W.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
LowM
Low M.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
LowM
Low M.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Volume
Volume.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Openint
Openint.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Volume
Volume.- Parameters:
chartIndex
- the chart indexshift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Median
Median.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Typical
Typical.- Parameters:
shift
- the shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
Bars
public int Bars()Bars.- Returns:
- the int
-
Bars
public int Bars(int chartIndex)Bars.- Parameters:
chartIndex
- the chart index- Returns:
- the int
-
getConnectionHash
public int getConnectionHash()Gets the connection hash.- Returns:
- the connection hash
-
getSymbolHash
public int getSymbolHash()Gets the symbol hash.- Returns:
- the symbol hash
-
getSymbol
Gets the symbol.- Returns:
- the symbol
-
setSymbol
Sets the symbol.- Parameters:
the
- symbol
-
getConnectionName
Gets the connection name.- Returns:
- the connection name
-
isUpdated
public boolean isUpdated()returns true if this chart was updated in the recent tick.- Returns:
- true, if is updated
-
processTick
there are always two calls of processTick() from MarketData for every tick: - first for BarClose event, and then for BarOpen event- Parameters:
tick
- the tickeventTypeToProcess
- the event type to processseriesCount
- the series count- Throws:
Exception
- the exception
-
findTickInData
public void findTickInData(TickEvent tick, int eventTypeToProcess, boolean callCloseEvent, boolean updateData, int dataSerie) throws ExceptionFind tick in data.- Parameters:
tick
- the tickeventTypeToProcess
- the event type to processcallCloseEvent
- the call close eventupdateData
- the update datadataSerie
- the data serie- Throws:
Exception
- the exception
-
isNextDay
Checks if is next day.- Parameters:
tickEvent
- the tick event- Returns:
- true, if is next day
-
findTickInDataComplete
there are always two calls of processTick() from MarketData for every tick: - first for BarClose event, and then for BarOpen event- Parameters:
tick
- the tickeventTypeToProcess
- the event type to process- Throws:
Exception
- the exception
-
processTickSimplified
simplified tick processing for bars - used only in MarketData.requestHistoryData()- Parameters:
tick
- the tickseriesCount
- the series count- Throws:
Exception
- the exception
-
getSeries
Gets the series.- Parameters:
serieType
- the serie type- Returns:
- the series
- Throws:
TradingException
- the trading exception
-
getSeries
Gets the series.- Parameters:
serieType
- the serie typechartTF
- the chart TF- Returns:
- the series
- Throws:
TradingException
- the trading exception
-
destroy
public void destroy()destroys all objects in this market data and frees offheap memory. -
getInstrumentInfo
Gets the instrument info.- Returns:
- the instrument info
-
setInstrumentInfo
Sets the instrument info.- Parameters:
ii
- the InstrumentInfo
-
MinMove
public double MinMove()Returns MinMove (Tradestation compatibility)- Returns:
-
BigPointValue
public double BigPointValue()Returns BigPointValue (Tradestation compatibility)- Returns:
-
PriceScale
public double PriceScale()Returns PriceScale (Tradestation compatibility)- Returns:
-
getMinDistance
public double getMinDistance()Gets the min distance.- Returns:
- the min distance
-
resetPreparedDataShifts
public void resetPreparedDataShifts()Reset prepared data shifts. -
setPerformanceParams
public void setPerformanceParams(boolean hasOnTickRule, boolean hasDailyDataBlock, boolean hasWeeklyDataBlock, boolean hasMonthlyDataBlock)Sets the performance params.- Parameters:
hasOnTickRule
- the has on tick rulehasDailyDataBlock
- the has daily data blockhasWeeklyDataBlock
- the has weekly data blockhasMonthlyDataBlock
- the has monthly data block
-
getCurrentBar
public int getCurrentBar()Gets the current bar.- Returns:
- the current bar
-
setCurrentBar
public void setCurrentBar(int reservedBars, int userDefinedStartingBar)Sets the current bar.- Parameters:
reservedBars
- the reserved barsuserDefinedStartingBar
- the user defined starting bar
-
getSerieIndex
public int getSerieIndex()Gets the serie index.- Returns:
- the serie index
-
cloneForTF
Clone for TF.- Parameters:
chartTF
- the chart TF- Returns:
- the chart data
-
cloneOnlyTF
Clone for TF.- Parameters:
chartTF
- the chart TF- Returns:
- the chart data
-
isNewBarOnMainSymbolTF
returns true if current tick starts a new bar - means it is open of a new bar Reguired for realistic gaps handling in MT4.- Parameters:
tick
- the tick- Returns:
- true, if is new bar on main symbol TF
-
getIndyStartingBar
public int getIndyStartingBar() -
setIndyStartingBar
public void setIndyStartingBar(int indyStartingBar)
-