noob - how to refer indicator in my Robot
10 Jul 2013, 17:04
Hi,
Where can I see an example of referncing to an indicator from a robot.
Would you mind putting a little example of using ZigZag in the Martingale sample?
Regards,
Stoyan
Replies
... Deleted by UFO ...

gorin
16 Jul 2013, 12:10
Sample Martingale with zigzag
//#reference: ..\Indicators\ZigZag.algo // 1. Add reference using System; using cAlgo.API; using cAlgo.API.Requests; using cAlgo.Indicators; namespace cAlgo.Robots { [Robot] public class SampleMartingaleRobot : Robot { private ZigZag zigZag; // 2. declare [Parameter(DefaultValue = 12)] public int Depth { get; set; } [Parameter(DefaultValue = 5)] public int Deviation { get; set; } [Parameter(DefaultValue = 3)] public int BackStep { get; set; } // etc.protected override void OnStart() { zigZag = Indicators.GetIndicator<ZigZag>(Depth, Deviation, BackStep); // 3. Initialize ExecuteOrder(InitialVolume, GetRandomTradeCommand()); } private void ExecuteOrder(int volume, TradeType tradeType) { Print(zigZag.Result.LastValue); // 4. Get value // etc. } // etc.
@gorin