Topics
Replies
daemon
06 Mar 2013, 16:55
You want to compare the SMA(200) at the current index to an index when? Can you say a little more about the logic?
private SimpleMovingAverage sma; protected override void OnStart() { sma = Indicators.SimpleMovingAverage(MarketSeries.Close, 200); } protected override void OnTick() { Print("{0}",sma.Result.Count); }
The above outputs 8165. So, I believe you don't have to wait for data.
To index an indicator within a Robot you can declare an int index and set it to the last index (MarketSeries.Close.Count -1) then call sma.Result[index] or you can use a loop for(int i = 0; i < index; i++){ do something with sma.Result[i]}. Don't know what you are trying to do exactly...
@daemon
daemon
11 Sep 2012, 12:29
( Updated at: 21 Dec 2023, 09:20 )
Hey,
I'm trying the same robot but with a little modification and it seems to work fine.
Try OnBar instead with a previous index like:
protected override void OnBar () { if (Trade.IsExecuting) return; int lastIndex = slowMa.Result.Count - 2; int prevIndex = slowMa.Result.Count - 3;
// etc.
@daemon
daemon
19 Jun 2013, 12:40
It is meant to play anything in the Media folder(C:\Windows\Media). So the files you try need to be located there otherwise it won't find them. check for error messages in the log.
You can change the code to find the file in a different folder or just provide the path as an input.
Check this out:
/api/internals/inotifications/playsound-5292
@daemon