protected override void OnStart() { bb=Indicators.BollingerBands(MarketSeries.Close,bbperiod,bbotcl, MovingAverageType.Simple); rsi=Indicators.RelativeStrengthIndex(MarketSeries.Close,rsiperiod); psar=Indicators.ParabolicSAR(SARstep,SARmax); frc=Indicators.FractalChaosBands(5); }
protected override void OnStart() { dataOps = new DataOps(this); dataOps.Reconcile(); //events registration Positions.Closed += PositionsOnClosed; Positions.Opened += PositionsOnOpened; //constants T = Symbol.TickValue; S = Symbol.TickSize; //factor multiplier in converting target in ticks to compare position P/L in Pips factor = Symbol.PipSize / S; //indicators psar = Indicators.ParabolicSAR(minAF, maxAF); //strategies strGs = new Strategy[2]; Print("b4 psar"); var psr = new PsarStrategy(this); SendAlert("OnStart()"); var ping = new PingPongStrategy(this); strGs[0] = psr; strGs[1] = ping; }
protected override void OnStart() { bb = Indicators.BollingerBands(MarketSeries.Close, bbperiod, bbotcl, MovingAverageType.Simple); rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, rsiperiod); psar = Indicators.ParabolicSAR(SARstep, SARmax); frc = Indicators.FractalChaosBands(5); }
protected override void Create(){ m_ParabolicSAR = new ParabolicSAR(this); m_oparcl = new VariableObject<Double>(this); m_oparop = new VariableObject<Double>(this); m_oposition = new VariableObject<int>(this); m_otransition = new VariableObject<int>(this); m_ParSE = OrderCreator.Stop(new SOrderParameters(Contracts.Default, "ParSE", EOrderAction.SellShort)); }
protected override void Create() { m_ParabolicSAR = new ParabolicSAR(this); m_oparcl = new VariableObject <Double>(this); m_oparop = new VariableObject <Double>(this); m_oposition = new VariableObject <int>(this); m_otransition = new VariableObject <int>(this); m_ParSE = OrderCreator.Stop(new SOrderParameters(Contracts.Default, "ParSE", EOrderAction.SellShort)); }
protected override void OnStart() { i_MACD_main = Indicators.MacdHistogram(MarketSeries.Close, (int)_Period_SlowEMA, (int)_Period_FastEMA, (int)_Period_MACD_SMA); i_MCAD_signal = Indicators.MacdHistogram(MarketSeries.Close, (int)_Period_SlowEMA, (int)_Period_FastEMA, (int)_Period_MACD_SMA); i_MA_Close = Indicators.SimpleMovingAverage(MarketSeries.Close, 1); i_Parabolic_SAR = Indicators.ParabolicSAR(_Step_PrbSAR, 0.1); i_MA_Open = Indicators.SimpleMovingAverage(MarketSeries.Open, 1); i_EMAf = Indicators.ExponentialMovingAverage(MarketSeries.Close, (int)_Period_FastEMA); }
protected override void OnStart() { parabolicSAR = Indicators.ParabolicSAR(MinAF, MaxAF); var tradeType = parabolicSAR.Result.LastValue < Symbol.Bid ? TradeType.Buy : TradeType.Sell; Print("Trade type is {0}, Parabolic SAR is {1}, Bid is {2}", tradeType, parabolicSAR.Result.LastValue, Symbol.Bid); ExecuteMarketOrder(tradeType, Symbol, Volume, "PSAR TrailingStops"); }
public EurUsdSimpleSystem(BarItemType barType) { this.barType = barType; this.identityCode = string.Format("{0}({1})", IDENTITY_CODE, barType.Code); psar = new ParabolicSAR(barType, 5); macd = new MACD(barType, 12, 26, 9); Register(psar, macd); }
protected override void Initialize() { lrf = Indicators.LinearRegressionForecast(Source, LRFperiod); ma = Indicators.SimpleMovingAverage(lrf.Result, MAperiod); psar = Indicators.ParabolicSAR(minAF, maxAF); diff = CreateDataSeries(); zsma = Indicators.TimeSeriesMovingAverage(diff, ZSperiod); zsstddev = Indicators.StandardDeviation(diff, ZSperiod, MovingAverageType.Simple); }
protected override void Create() { m_parabolicsar1 = new ParabolicSAR(this); m_oparcl = new VariableObject <Double>(this); m_oparop = new VariableObject <Double>(this); m_oposition = new VariableObject <int>(this); m_otransition = new VariableObject <int>(this); Plot1 = AddPlot(new PlotAttributes("ParCl", EPlotShapes.Point, Color.Blue, Color.Empty, 1, 0, true)); }
protected override void Initialize() { _dixPowerDigits = Math.Pow(10, Robot.Symbol.Digits); i_MACD_main = Robot.Indicators.MacdHistogram(Robot.MarketSeries.Close, Period_SlowEMA, Period_FastEMA, Period_MACD_SMA); i_MCAD_signal = Robot.Indicators.MacdHistogram(Robot.MarketSeries.Close, Period_SlowEMA, Period_FastEMA, Period_MACD_SMA); //i_MA_Close = Robot.Indicators.SimpleMovingAverage(Robot.MarketSeries.Close, 1); i_Parabolic_SAR = Robot.Indicators.ParabolicSAR(Step_PrbSAR, 0.1); i_MA_Open = Robot.Indicators.SimpleMovingAverage(Robot.MarketSeries.Open, 1); i_EMAf = Robot.Indicators.ExponentialMovingAverage(Robot.MarketSeries.Close, Period_FastEMA); }
public PSARandADX(BarItemType barType) { this.barType = barType; this.identityCode = string.Format("{0}({1})", IDENTITY_CODE, barType.Code); psar = new ParabolicSAR(barType, 5); adx = new ADX(barType, 50); Register(psar, adx); }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"strategy by rollas from TV"; Name = "TripleSAR"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = false; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 20; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true; pointDiff = 1; profitTaker = 100; stopLoss = 100; } else if (State == State.Configure) { //SetStopLoss(CalculationMode.Ticks, stopLoss); SetProfitTarget(CalculationMode.Ticks, profitTaker); } else if (State == State.DataLoaded) { slow = ParabolicSAR(0.01, 0.2, 0.01); med = ParabolicSAR(0.01, 0.2, 0.02); fast = ParabolicSAR(0.01, 0.2, 0.03); slow.Plots[0].PlotStyle = PlotStyle.Cross; slow.Plots[0].Brush = Brushes.Red; AddChartIndicator(slow); med.Plots[0].PlotStyle = PlotStyle.Cross; med.Plots[0].Brush = Brushes.LimeGreen; AddChartIndicator(med); fast.Plots[0].PlotStyle = PlotStyle.Cross; fast.Plots[0].Brush = Brushes.Blue; AddChartIndicator(fast); } }
/// <summary> /// Evento generato quando viene avviato il cBot /// </summary> protected override void OnStart() { // --> Stampo nei log la versione corrente Print("{0} : {1}", NAME, VERSION); // --> Messaggio di avvertimento nel caso incui si eseguisse senza modifiche logiche /* * if (Chart.CanDraw(RunningMode)) * Chart.DrawStaticText(NAME, "ATTENTION : CBOT BASE, EDIT THIS TEMPLATE ONLY", VerticalAlignment.Top, HorizontalAlignment.Left, Extensions.ColorFromEnum(TextColor)); */ // --> Determino il range di pausa Pause1 = new Extensions.Monitor.PauseTimes { Over = PauseOver, Under = PauseUnder }; // --> Inizializzo il Monitor Monitor1 = new Extensions.Monitor(MyLabel, Symbol, Bars, Positions, Pause1); // --> Inizializzo il MoneyManagement MonenyManagement1 = new Extensions.MonenyManagement(Account, MyCapital, MyRisk, FixedLots, SL > 0 ? SL : FakeSL, Symbol); // --> Inizializzo i dati per la gestione del breakeven BreakEvenData1 = new Extensions.Monitor.BreakEvenData { Activation = BreakEvenActivation, Distance = BreakEvenDistance }; // --> Inizializzo i dati per la gestione del Trailing TrailingData1 = new Extensions.Monitor.TrailingData { Activation = TrailingActivation, Distance = TrailingDistance }; // --> Osservo le aperture per operazioni comuni Positions.Opened += _onOpenPositions; // --> Fissiamo la logica degli indicatori EMAfast = Indicators.ExponentialMovingAverage(Bars.ClosePrices, EmaFastPeriod); EMAslow = Indicators.ExponentialMovingAverage(Bars.ClosePrices, EmaSlowPeriod); SAR = Indicators.ParabolicSAR(0.02, 0.2); // --> Effettuo un test di apertura per verificare il funzionamento del sistema if (OpenOnStart != MyTradeType.Disabled) { _test((OpenOnStart == MyTradeType.Buy) ? TradeType.Buy : TradeType.Sell, MonenyManagement1); } }
public PSARandStochastic(BarItemType barType) { this.barType = barType; this.identityCode = string.Format("{0}({1})", IDENTITY_CODE, barType.Code); psar = new ParabolicSAR(barType, 5); stoc = new Stochastics(barType, 14); ema = new EMA(barType, 100); Register(psar, stoc, ema); }
protected override void OnStart() { label = "TheMajorV2PSar" + Symbol.Code + " " + TimeFrame.ToString() + " / " + HighOrderTimeFrame.ToString(); tendency = Indicators.GetIndicator <CandlestickTendency>(HighOrderTimeFrame); index = MarketSeries.Close.Count - 1; _macd = Indicators.MacdHistogram(LongCycle, ShortCycle, Period); rsi = Indicators.RelativeStrengthIndex(Source, Periods); _SSR = Indicators.GetIndicator <SinewaveSupportResistance>(MarketSeries, Alpha); _moneyFlow = Indicators.MoneyFlowIndex(MFIPeriod); _parabolic = Indicators.ParabolicSAR(minaf, maxaf); Positions.Opened += PositionsOnOpened; Positions.Closed += PositionsOnClosed; }
protected override void OnStart() { label = "Colonel V1 " + Symbol.Code + " " + TimeFrame.ToString() + " / "; _fastMa = Indicators.MovingAverage(SourceSeries, FastPeriods, MAType); _slowMa = Indicators.MovingAverage(SourceSeries, SlowPeriods, MAType); _macd = Indicators.MacdHistogram(LongCycle, ShortCycle, Period); rsi = Indicators.RelativeStrengthIndex(Source, Periods); _SSR = Indicators.GetIndicator <SinewaveSupportResistance>(MarketSeries, Alpha); _moneyFlow = Indicators.MoneyFlowIndex(MFIPeriod); _parabolic = Indicators.ParabolicSAR(minaf, maxaf); Positions.Opened += PositionsOnOpened; Positions.Closed += PositionsOnClosed; }
/// <summary> /// Parabolic SAR /// </summary> /// <returns></returns> public ParabolicSAR ParabolicSAR(Data.IDataSeries input, double acceleration, double accelerationMax, double accelerationStep) { if (cacheParabolicSAR != null) for (int idx = 0; idx < cacheParabolicSAR.Length; idx++) if (Math.Abs(cacheParabolicSAR[idx].Acceleration - acceleration) <= double.Epsilon && Math.Abs(cacheParabolicSAR[idx].AccelerationMax - accelerationMax) <= double.Epsilon && Math.Abs(cacheParabolicSAR[idx].AccelerationStep - accelerationStep) <= double.Epsilon && cacheParabolicSAR[idx].EqualsInput(input)) return cacheParabolicSAR[idx]; lock (checkParabolicSAR) { checkParabolicSAR.Acceleration = acceleration; acceleration = checkParabolicSAR.Acceleration; checkParabolicSAR.AccelerationMax = accelerationMax; accelerationMax = checkParabolicSAR.AccelerationMax; checkParabolicSAR.AccelerationStep = accelerationStep; accelerationStep = checkParabolicSAR.AccelerationStep; if (cacheParabolicSAR != null) for (int idx = 0; idx < cacheParabolicSAR.Length; idx++) if (Math.Abs(cacheParabolicSAR[idx].Acceleration - acceleration) <= double.Epsilon && Math.Abs(cacheParabolicSAR[idx].AccelerationMax - accelerationMax) <= double.Epsilon && Math.Abs(cacheParabolicSAR[idx].AccelerationStep - accelerationStep) <= double.Epsilon && cacheParabolicSAR[idx].EqualsInput(input)) return cacheParabolicSAR[idx]; ParabolicSAR indicator = new ParabolicSAR(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Acceleration = acceleration; indicator.AccelerationMax = accelerationMax; indicator.AccelerationStep = accelerationStep; Indicators.Add(indicator); indicator.SetUp(); ParabolicSAR[] tmp = new ParabolicSAR[cacheParabolicSAR == null ? 1 : cacheParabolicSAR.Length + 1]; if (cacheParabolicSAR != null) cacheParabolicSAR.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheParabolicSAR = tmp; return indicator; } }
/// <summary> /// Viene generato all'avvio dell'indicatore, si inizializza l'indicatore /// </summary> protected override void Initialize() { // --> Stampo nei log la versione corrente Print("{0} : {1}", NAME, VERSION); DeTrended = Indicators.DetrendedPriceOscillator(Bars.ClosePrices, Period, MAType); EMASmooth = Indicators.ExponentialMovingAverage(DeTrended.Result, Smooth); MA = Indicators.MovingAverage(Bars.ClosePrices, Period, MAType); SAR = Indicators.ParabolicSAR(0.02, 0.2); ATR = Indicators.AverageTrueRange(Period, MAType); K = Symbol.PipsToDigits(K); // --> Inizializzo i parametri grafici _updateCandleSize(); // --> Ridisegno tutte le candele ogni volta che cambia lo zoom Chart.ZoomChanged += _repaint; }
protected override void Initialize() { _dixPowerDigits = Math.Pow(10, Symbol.Digits); i_MACD_Histogram = Indicators.MacdHistogram(MarketSeries.Close, Period_SlowEMA, Period_FastEMA, Period_MACD_SMA); i_MCAD_signal = Indicators.MacdHistogram(MarketSeries.Close, Period_SlowEMA, Period_FastEMA, Period_MACD_SMA); // i_MA_Close = Indicators.SimpleMovingAverage(MarketSeries.Close, 1); i_Parabolic_SAR = Indicators.ParabolicSAR(Step_PrbSAR, 0.1); i_MA_Open = Indicators.SimpleMovingAverage(MarketSeries.Open, 1); i_EMAf = Indicators.ExponentialMovingAverage(MarketSeries.Close, Period_FastEMA); }
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"This strategy leverages the PAR to calculated an expected move range up to 4 standard deviations and trades accordingly. "; Name = "PAR"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = false; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 1; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 1; // Disable this property for performance gains in Strategy Analyzer optimizations // See the Help Guide for additional information IsInstantiatedOnEachOptimizationIteration = true; profitTaker = 1024; stopLoss = 1024; // AddPlot(Brushes.Red, "SD0"); //0 // AddPlot(Brushes.Red, "SD1"); //1 // AddPlot(Brushes.Red, "SD2"); //2 // AddPlot(Brushes.Red, "SD3"); //3 // AddPlot(Brushes.Red, "SD4"); //4 // AddPlot(Brushes.LimeGreen, "SD-0"); //5 // AddPlot(Brushes.LimeGreen, "SD-1"); //6 // AddPlot(Brushes.LimeGreen, "SD-2"); //7 // AddPlot(Brushes.LimeGreen, "SD-3"); //8 // AddPlot(Brushes.LimeGreen, "SD-5"); //9 } else if (State == State.Configure) { //AddDataSeries("VX 12-20", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last); //1 SetStopLoss(CalculationMode.Ticks, stopLoss); SetProfitTarget(CalculationMode.Ticks, profitTaker); } else if (State == State.DataLoaded) { //vwap = VWAP8(); //vwap.Plots[0].Brush = Brushes.White; ParabolicSAR1 = ParabolicSAR(Close, 0.02, 0.2, 0.02); //add the indicators //AddChartIndicator(vwap); AddChartIndicator(ParabolicSAR(0.02, 0.2, 0.02)); } }