
Topics
Replies
admin
04 Dec 2012, 14:44
( Updated at: 21 Dec 2023, 09:20 )
using cAlgo.API; namespace cAlgo.Indicators { [Indicator(IsOverlay = false, ScalePrecision = 5)] public class Level2 : Indicator { [Output("BidEntries", Color = Colors.Red, PlotType = PlotType.Histogram, Thickness = 5)] public IndicatorDataSeries BidResult { get; set; } [Output("AskEntries", Color = Colors.Blue, PlotType = PlotType.Histogram, Thickness = 5)] public IndicatorDataSeries AskResult { get; set; } MarketDepth GBPUSD; private int _askNo; private int _bidNo; protected override void Initialize() { GBPUSD = MarketData.GetMarketDepth(Symbol); GBPUSD.Updated += OnGbpUsdUpdated; } void OnGbpUsdUpdated() { _askNo = 0; _bidNo = 0; var index = MarketSeries.Close.Count - 1; for (var i = 0; i < AskResult.Count; i++) AskResult[i] = double.NaN; foreach (var entry in GBPUSD.AskEntries) { AskResult[index - _askNo] = (-1) * entry.Volume; _askNo++; } for (var i = 0; i < BidResult.Count; i++) BidResult[i] = double.NaN; foreach (var entry in GBPUSD.BidEntries) { BidResult[index - _bidNo] = entry.Volume; _bidNo++; } } public override void Calculate(int index) { } } }
@admin
admin
03 Dec 2012, 16:22
If you are using OnPositionClosed and if you have a global field of type Position similar to the sample robots, the global field position will need to be set to null in the OnPositionClosed event. For your convenience we will implement funtionality to do this automatically so that you do not have to worry about such issues.
@admin
admin
03 Dec 2012, 15:37
This example is setting stop loss value equal to the last value of parabolic sar in the OnTick event. There are two things to keep in mind. One, the OnTick event occurs many times for the same bar until the time is up, therefore it cannot coinside with the actual value produced on the chart. That value is known only when the execution of the next bar begins. In other words the last value of the parabolic sar will keep changing on each tick for the duration of the bar. Second, the value at the OnTick event is as close to the actual value that occured as possible but it is not identical due to the fact that the ticks are generated by interpolation for the backtesting. It is in our future plans though to include the actual ticks in the backtesting.
@admin
admin
03 Dec 2012, 14:05
All open positions under the account are in Account.Positions list. So, in the code you may check for the opened positions by accessing this list. For the specific positions opened just by one Robot it has not been made available yet. It will be available very soon though.
@admin
admin
29 Nov 2012, 17:09
( Updated at: 21 Dec 2023, 09:20 )
In cTrader you can click on the chartshot icon from the toolbar to the right. This will turn the cursor into a camera button. You may click it on the chart.
Files are saved by default in this location: C:\Users\...\Documents\cTrader\Chartshots
They are also saved on the web at http://spotware.ctrader.com/images/screens/...
After you click on the camera button it will pop up a new browser page with the information.
@admin
admin
07 Dec 2012, 12:00
Thank you for the suggestion. We are currently working on adding more build in indicators to the platform. We will look into Gartley patterns as well.
@admin