TenkanSen Price crossover
Created at 31 Aug 2015, 18:44
TenkanSen Price crossover
31 Aug 2015, 18:44
Hello, I would like to make a bot based on Price and TenkanSen crossover. However I couldn't manage to get previous value of price and tenkan to fill the crossover formula: "price[1]>tenkan[1] && price[0]<tenkan[0]". Could someone write me an example how to get previous values on price and indicator (such as tenkanSen from IchimokuKinkoHyo)?
Spotware
01 Sep 2015, 23:52
Dear Trader,
For an indicator:
The index parameter of the “Calculate” method, represents each bar, ranging from 0 up to the current (last) bar. So to achieve retrieving the previous value of an indicator you should use indicatorName.ResultSeriesName[index]. In your case it should be:
For a cBot:
You will have to create a MarketSeries with Symbol and/or timeframe as parameters. Then retrieve the DataSeries from the MarketSeries on preferred values of historical trendbars (open, close, high, low). As last you count the number of elements the DataSeries contains. Then you will be able to simulate the Calculate method in you cBot the following code snippet illustrates it:
Additionally we recommend you to have a look at our API guides.
@Spotware