more than one protection modifier
Created at 01 Oct 2018, 14:46
more than one protection modifier
01 Oct 2018, 14:46
my code was working until i started to make some changes. I removed all the changes and reset my code to what i belive was the last point at which it worked, however the error "more than one protection modifier occurs. can someone PLEASE tell me what ive done!!!!!
#region Inital comments // ------------------------------------------------------------------------------------------------- // // This code is a cAlgo API sample. // // This cBot is intended to be used as a sample and does not guarantee any particular outcome or // profit of any kind. Use it at your own risk. // // The "Sample RSI cBot" will create a buy order when the Relative Strength Index indicator crosses the level 30, // and a Sell order when the RSI indicator crosses the level 70. The order is closed be either a Stop Loss, defined in // the "Stop Loss" parameter, or by the opposite RSI crossing signal (buy orders close when RSI crosses the 70 level // and sell orders are closed when RSI crosses the 30 level). // // The cBot can generate only one Buy or Sell order at any given time. // // ------------------------------------------------------------------------------------------------- #endregion #region preloaded API's using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using System; #endregion namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class RSI : Robot { #region Parameters [Parameter("cBot Name")] public string cBotName { get; set; } [Parameter(" ")] public string Space5 { get; set; } [Parameter("Source")] public DataSeries Source { get; set; } [Parameter("Periods", DefaultValue = 14)] public int Periods { get; set; } [Parameter("Percentage of Equity @ risk", DefaultValue = 0.1, MinValue = 0, MaxValue = 1)] public double EquityPercentage { get; set; } [Parameter(" ")] public string Space { get; set; } [Parameter("RSI Max Value", DefaultValue = 70, MinValue = 0, MaxValue = 100, Step = 0.5)] public double Max { get; set; } [Parameter("RSI Min Value", DefaultValue = 30, MinValue = 0, MaxValue = 100, Step = 0.5)] public double Min { get; set; } [Parameter(" ")] public string Space2 { get; set; } [Parameter("Using Stop P/L")] public bool UsingPL { get; set; } [Parameter("Take profit (pips)", DefaultValue = 10, Step = 1)] public int TakeProfitPips { get; set; } [Parameter("Stop loss (Pips)", DefaultValue = 10, Step = 1)] public int StopLossPips { get; set; } [Parameter(" ")] public string Space4 { get; set; } [Parameter("")] #endregion #region Private varible public private RelativeStrengthIndex rsi; private DateTime _StartTime; private DateTime _EndTime; //These are not curerntly in use #endregion #region cTrader events protected override void OnStart() { rsi = Indicators.RelativeStrengthIndex(Source, Periods); // Start Time is the same day at 22:00:00 Server Time //_StartTime = Server.Time.Date.AddHours(StartTime); // Stop Time is the next day at 06:00:00 // _EndTime = Server.Time.Date.AddHours(StopTime); } protected override void OnTick() { if (rsi.Result.LastValue <= Min) { Close(TradeType.Sell); Open(TradeType.Buy); } else if (rsi.Result.LastValue > Max) { Close(TradeType.Buy); Open(TradeType.Sell); } } #endregion #region Position managment private void Close(TradeType tradeType) { foreach (var OpenTrade in Positions.FindAll("RSI", Symbol, tradeType)) ClosePosition(OpenTrade); } private void Open(TradeType tradeType) { var position = Positions.Find("RSI", Symbol, tradeType); var volume = Math.Round((((Account.Equity * EquityPercentage) - (Account.Balance - Account.FreeMargin)) * (Account.PreciseLeverage - 10)) / 1000.0, 0, MidpointRounding.AwayFromZero) * 1000; #region Breakdown of volume values for test purposes Print(""); Print("Account Eq * Eq% ", Account.Equity * EquityPercentage); Print("Used Margin ", Account.Balance - Account.FreeMargin); Print("Leverage minus 10 ", Account.PreciseLeverage); Print("Non rounded recomended volume", ((Account.Equity * EquityPercentage) - (Account.Balance - Account.FreeMargin)) * (Account.PreciseLeverage - 10)); Print("Final value ", volume); //assumes leverage is 1:20 and only 1 robot is running // var volumeInUnits = Symbol.QuantityToVolume(Quantity); #endregion if (position == null & Account.FreeMargin > (1 - EquityPercentage) * Account.Equity & UsingPL == true) { ExecuteMarketOrder(tradeType, Symbol, volume, "RSI", StopLossPips, TakeProfitPips); Print("TESTING INSTANCE 1 HAS OCCURED, A P&L HAS OCCURED"); } if (position == null & Account.FreeMargin > (1 - EquityPercentage) * Account.Equity & UsingPL == false) { ExecuteMarketOrder(tradeType, Symbol, volume, "RSI"); Print("TESTING INSTANCE 2 HAS OCCURED, A P&L HAS NOT OCCURED"); } // if (possition == null & Account.FreeMargin > (1 - EquityPercentage)* Account.Equity) else { Print("An error has ocured, possition opening failed to occur!"); } #endregion } } }
willd7781
01 Oct 2018, 14:59
PLEASE IGNOR THIS QUESTION, I WAS BEING AN IDIOT
@willd7781