cBot with Regression starts very slow - why ?
cBot with Regression starts very slow - why ?
19 Jan 2015, 11:02
Hi,
Why Regression2000 indicator and cBots with Regression2000 starts very slowly (On mt4 1 second on cAlgo > 30 Seconds) ?
What is with this cAlgo?
Bye.
Replies
breakermind
20 Jan 2015, 14:03
cBot pending orders
Hi support
why this bot dont set pending orders (cBotRegression2000 with multi pending orders :)?
//======================================================================= // Breakermind.com All rights reserved. Copyrights breakermind.com 2014 = //======================================================================= using System; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class cBotRegression : Robot { [Parameter(DefaultValue = 1000, MinValue = 1000)] public int Volume { get; set; } [Parameter("Stop Loss (pips)", DefaultValue = 0, MinValue = 0)] public int StopLossInPips { get; set; } [Parameter("Take Profit (pips)", DefaultValue = 0, MinValue = 0)] public int TakeProfitInPips { get; set; } [Parameter("Auto Take Profit", DefaultValue = true)] public bool AutoTP { get; set; } [Parameter(DefaultValue = true)] public bool closeOnReg { get; set; } [Parameter(DefaultValue = 3, MinValue = 1, MaxValue = 4)] public int RegDegree { get; set; } [Parameter(DefaultValue = 2000, MinValue = 1)] public int RegPeriod { get; set; } [Parameter(DefaultValue = 2, MinValue = 1)] public double RegStrdDev { get; set; } [Parameter(DefaultValue = true)] public bool SetMultiOrders { get; set; } [Parameter(DefaultValue = 3, MinValue = 1)] public int HowMuchOrders { get; set; } [Parameter(DefaultValue = 25, MinValue = 5)] public int Spacing { get; set; } [Parameter(DefaultValue = "breakermind.com")] public string Copyrights { get; set; } private const string label = "cBotRegression"; private Regression cog; protected override void OnStart() { string txt = "Install Regression2000 indicator first - /algos/indicators/show/571"; string txt0 = " If TakeProfitInPips or StopLossInPips = 0 - cBot dont set StopLoss or TakeProfit"; string txt1 = "If closeOnReg = true - cBot close positions on regression up(close buy) and down(close sell) backtest on M1"; string txt2 = "Copyrights 2014 breakermind.com - All rights reserved."; Print(txt); Print(txt0); Print(txt1); Print(txt2); //How to Use custom indicator cog = Indicators.GetIndicator<Regression>(RegDegree, RegPeriod, RegStrdDev); } protected override void OnTick() { double up = cog.sqh.LastValue; double zero = cog.prc.LastValue; double dn = cog.sql.LastValue; if (AutoTP) { double val = (zero - Symbol.Bid); TakeProfitInPips = (int)(val / Symbol.PipSize); } var name = "Up"; var text = "Up Reg: " + up.ToString(); var staticPos = StaticPosition.TopRight; var color = Colors.Red; ChartObjects.DrawText(name, text, staticPos, color); name = "Dn"; text = "Dn Reg: " + dn.ToString(); staticPos = StaticPosition.BottomRight; color = Colors.Blue; ChartObjects.DrawText(name, text, staticPos, color); var pos = Positions.Find(label, Symbol); var longPosition = Positions.Find(label, Symbol, TradeType.Buy); var shortPosition = Positions.Find(label, Symbol, TradeType.Sell); if (pos == null) { // close all pending foreach (var order in PendingOrders) { //CancelPendingOrder(order); } if (Symbol.Bid <= dn) { if (shortPosition != null && closeOnReg == true) { ClosePosition(shortPosition); } ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, label, StopLossInPips, TakeProfitInPips); // Set multi orders pending if (SetMultiOrders) { for (int i = 1; i < HowMuchOrders; i++) { PlaceStopOrder(TradeType.Buy, Symbol, Volume, Symbol.Ask + Spacing * i * Symbol.PipSize, label, StopLossInPips, TakeProfitInPips); } } if (Symbol.Ask >= up) { if (longPosition != null && closeOnReg == true) { ClosePosition(longPosition); } ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, label, StopLossInPips, TakeProfitInPips); // Set multi orders pending if (SetMultiOrders) { for (int j = 1; j < HowMuchOrders; j++) { PlaceStopOrder(TradeType.Sell, Symbol, Volume, Symbol.Bid - Spacing * j * Symbol.PipSize, label, StopLossInPips, TakeProfitInPips); } } } } } } } }
where is error?
thanks for help
@breakermind
Spotware
20 Jan 2015, 14:24
Hello breakermind,
For help with coding please contact one of our partners /consultants/ or post a job in Development Jobs section /jobs/
Cheers.
@Spotware
breakermind
20 Jan 2015, 15:25
RE:
Spotware said:
Hello breakermind,
For help with coding please contact one of our partners /consultants/ or post a job in Development Jobs section /jobs/
Cheers.
Buahahahahahahaha.....
Cheers ;)
@breakermind
Spotware
20 Jan 2015, 15:58
RE: RE:
breakermind said:
Spotware said:
Hello breakermind,
For help with coding please contact one of our partners /consultants/ or post a job in Development Jobs section /jobs/
Cheers.
Buahahahahahahaha.....
Cheers ;)
???
@Spotware
breakermind
20 Jan 2015, 12:05 ( Updated at: 23 Jan 2024, 13:11 )
RE:
breakermind said:
Hi hi hi,
cBotRegression code - [/algos/cbots/show/624]
Bye.
@breakermind