KO
Topics
06 May 2017, 08:52
2703
2
05 Apr 2017, 04:28
2655
4
23 Jan 2017, 11:46
1858
1
17 Nov 2016, 15:51
2150
2
09 Aug 2016, 11:07
2447
2
17 Jul 2016, 19:34
12840
22
Replies
korakodmy
18 Jul 2016, 05:48
RE:
lucian said:
using System; using System.Linq; using cAlgo.API; using System.IO; using System.Collections; using System.Collections.Generic; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)] public class MACD : Robot { [Parameter("Volume", DefaultValue = 1000)] public int volume { get; set; } [Parameter(DefaultValue = 50, MinValue = 1)] public int StopLoss { get; set; } [Parameter(DefaultValue = 50, MinValue = 1)] public int TakeProfit { get; set; } [Parameter("MACD LongCycle", DefaultValue = 26, MinValue = 1)] public int LongCycle { get; set; } [Parameter("MACD ShortCycle", DefaultValue = 12, MinValue = 1)] public int ShortCycle { get; set; } [Parameter("MACD Period", DefaultValue = 9, MinValue = 1)] public int MACDPeriod { get; set; } private MacdCrossOver _MACD; protected override void OnStart() { _MACD = Indicators.MacdCrossOver(LongCycle, ShortCycle, MACDPeriod); } protected override void OnBar() { if (_MACD.MACD.Last(1) < _MACD.Signal.Last(1) && _MACD.MACD.Last(0) > _MACD.Signal.Last(0) && _MACD.Signal.Last(0) < 0) { ExecuteMarketOrder(TradeType.Buy, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } if (_MACD.MACD.Last(1) > _MACD.Signal.Last(1) && _MACD.MACD.Last(0) < _MACD.Signal.Last(0) && _MACD.Signal.Last(0) > 0) { ExecuteMarketOrder(TradeType.Sell, Symbol, volume, "korakodmy", StopLoss, TakeProfit, 5); } } } }
Thanks very much , I will try it
@korakodmy
korakodmy
24 Jul 2016, 17:12
Thank very much lucian
How way to contact you I want to talk with you.
@korakodmy