Hello
1. You need to use IHistory interface to get historical data. Look at the IHistory.getBar() method, it has shift parameter 0 - currently forming candle, 1 - last formed candle etc
2. Depends on what you want to achive. Methods that retrieve historical bars all have period parameter. onBar method is called from the platform and supplied with the correct period for the bars in parameters
3. Filled orders has FILLED state. Look at the IOrder.getState() method. When price reaces some order's stop loss, it gets closed and onMessage method is called with corresponding parameters
4. Indicators can be calculated from IIndicators interface
Examples can be found in Code Examples section of this forum, look at
Simple strategy or
Limit Order