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
FieldsModifier and TypeFieldDescriptionstatic intThe Constant ChartTF_D1.static intThe Constant ChartTF_M1.static intThe Constant ChartTF_W1.The Close.The Connection.intThe Event type.The High.The Instrument.static org.slf4j.LoggerThe Constant Log.The Low.com.strategyquant.tradinglib.strategy.MarketDataThe Market data.com.strategyquant.datalib.dataseries.ComputedDataSeriesThe Median.The Open.The Symbol.com.strategyquant.datalib.dataseries.TimeDataSeriesThe Time.The Timeframe.com.strategyquant.datalib.dataseries.ComputedDataSeriesThe Typical.The Volume.com.strategyquant.datalib.dataseries.ComputedDataSeriesThe Weighted. -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates 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 TypeMethodDescriptiondoubleAsk()Ask.intBars()Bars.intBars(int chartIndex)Bars.doubleBid()Bid.doubleReturns BigPointValue (Tradestation compatibility)intChart hash code.cloneForTF(int chartTF)Clone for TF.cloneOnlyTF(int chartTF)Clone for TF.doubleClose(int shift)Close.doubleClose(int chartIndex, int shift)Close.doubleCloseD(int shift)Close D.doubleCloseD(int chartIndex, int shift)Close D.doubleCloseM(int shift)Close M.doubleCloseM(int chartIndex, int shift)Close M.doubleCloseW(int shift)Close W.doubleCloseW(int chartIndex, int shift)Close W.voiddestroy()destroys all objects in this market data and frees offheap memory.voidfindTickInData(TickEvent tick, int eventTypeToProcess, boolean callCloseEvent, boolean updateData, int dataSerie)Find tick in data.voidfindTickInDataComplete(TickEvent tick, int eventTypeToProcess)there are always two calls of processTick() from MarketData for every tick: - first for BarClose event, and then for BarOpen eventintGets the connection hash.Gets the connection name.intGets the current bar.intGets the instrument info.doubleGets the min distance.intGets the serie index.getSeries(int serieType)Gets the series.getSeries(int serieType, int chartTF)Gets the series.Gets the symbol.intGets the symbol hash.doubleHigh(int shift)High.doubleHigh(int chartIndex, int shift)High.doubleHighD(int shift)High D.doubleHighD(int chartIndex, int shift)High D.doubleHighM(int shift)High M.doubleHighM(int chartIndex, int shift)High M.doubleHighW(int shift)High W.doubleHighW(int chartIndex, int shift)High W.booleanisNewBarOnMainSymbolTF(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.booleanChecks if is next day.booleanreturns true if this chart was updated in the recent tick.doubleLow(int shift)Low.doubleLow(int chartIndex, int shift)Low.doubleLowD(int shift)Low D.doubleLowD(int chartIndex, int shift)Low D.doubleLowM(int shift)Low M.doubleLowM(int chartIndex, int shift)Low M.doubleLowW(int shift)Low W.doubleLowW(int chartIndex, int shift)Low W.doubleMedian(int shift)Median.doubleMinMove()Returns MinMove (Tradestation compatibility)doubleOpen(int shift)Open.doubleOpen(int chartIndex, int shift)Open.doubleOpenD(int shift)Open D.doubleOpenD(int chartIndex, int shift)Open D.doubleOpenint(int shift)Openint.doubleOpenM(int shift)Open M.doubleOpenM(int chartIndex, int shift)Open M.doubleOpenW(int shift)Open W.doubleOpenW(int chartIndex, int shift)Open W.doubleReturns PriceScale (Tradestation compatibility)voidprocessTick(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 eventvoidprocessTickSimplified(TickEvent tick, int seriesCount)simplified tick processing for bars - used only in MarketData.requestHistoryData()voidReset prepared data shifts.voidsetCurrentBar(int reservedBars, int userDefinedStartingBar)Sets the current bar.voidsetIndyStartingBar(int indyStartingBar)voidSets the instrument info.voidsetPerformanceParams(boolean hasOnTickRule, boolean hasDailyDataBlock, boolean hasWeeklyDataBlock, boolean hasMonthlyDataBlock)Sets the performance params.voidSets the symbol.longTime()Time.longTime(int shift)Time.longTime(int chartIndex, int shift)Time.longTime current.longTimeD(int shift)Time D.longTimeM(int shift)Time M.longTimeW(int shift)Time W.doubleTypical(int shift)Typical.doubleVolume(int shift)Volume.doubleVolume(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)
-