DMI Handelssystem
Forums › ProRealTime Deutsch forum › ProOrder Support › DMI Handelssystem
- This topic has 3 replies, 2 voices, and was last updated 7 years ago by Rim.
-
-
05/02/2017 at 7:44 PM #34311
Hallo Trader,
kann mir jemand helfen und ein Automatisches Handelssystem erstellen, den “Chande
s Dynamic Momentum Index” DMI.
Benutze das System bei cityindex.de ist nicht schlecht, aber es gibt keine Möglichkeit Stoploss, Limit Uhrzeit usw. einzugeben.
Es wäre echt nett.
Hier der Code von cityindex.de wenn’s hilft.
using CITrader.Algo.Attributes;
using CITrader.Algo.Enums;
using CITrader.Algo.Indicators;
using CITrader.Algo.Interfaces;
namespace CITrader.Algo.TradingSystems
{
/// <summary>
/// Implements Chande’s Dynamic Momentum Index Reversal System
/// </summary>
[TradingSystem(“Chande’s Dynamic Momentum Index Reversal System”, “{8FD47B96-7EDF-4653-9111-F0738DB1C9EB}”, Format=@”Chande’s Dynamic Momentum Index Reversal System
Chande’s DMI (%PriceType%,%stdevPeriods%,%stdevmaper%,%DmiPeriods%,%DmiLowerLimit%,%DmiUpperLimit%) = %DMIndex%, DMI OB/OS Levels = %CDMIOBL% / %CDMIOSL%”,
IsOverlay = false,
Description = @”
Overview
This trading system uses Chandes Dynamic Momentum Index to generate signals for potential trading opportunities.
The signals are generated using the following logic:
Long Entry = Chande
s DMI crosses above its OverSold Level
Long Exit = Chande
s DMI crosses below its OverBought Level OR Chande
s DMI crosses below its OverSold LevelShort Entry = Chandes DMI crosses below its OverBought Level
Short Exit = Chande
s DMI crosses above its OverSold Level OR Chande
s DMI crosses above its OverBought Level“)]
public class ChandesDynamicMomentumIndexReversalSystem : ExtendedTradingSystem, INotAlwaysInTheMarket
{
#region Fields
private ChandesDynamicMomentumIndexIndicator _indicator;
#endregion
#region Properties
#region Parameters
/// <summary>
/// Gets or sets the type of the price.
/// </summary>
/// <value>The type of the price.</value>
[Parameter(“Chande’s DMI Price Type”, ParameterType.Enumeration, DefaultValue = DataSeriesType.Close, IsReadOnly = true)]
public DataSeriesType PriceType { get; set; }
/// <summary>
/// Gets or sets Standard Deviation Periods
/// </summary>
/// <value>The period.</value>
[Parameter(“Chande’s DMI Standard Deviation Periods”, ParameterType.Integer, DefaultValue = 5, MinValue = 1)]
public int StdevPeriods { get; set; }
/// <summary>
/// MA of Standard Deviation Periods
/// </summary>
/// <value>The period.</value>
[Parameter(“Chande’s DMI MA of Standard Deviation Periods”, ParameterType.Integer, DefaultValue = 10, MinValue = 1)]
public int StdeVmaper { get; set; }
/// <summary>
/// Gets or sets MA of Standard Deviation Type
/// </summary>
/// <value>
/// The type of the MA.
/// </value>
[Parameter(“Chande’s DMI MA of Standard Deviation Type”, ParameterType.Enumeration, DefaultValue = MovingAverageType.Simple)]
public MovingAverageType StdevMaType { get; set; }
/// <summary>
/// Get or set Dynamic Momentum Index Periods
/// </summary>
/// <value>The period.</value>
[Parameter(“Chande’s DMI Dynamic Momentum Index Periods”, ParameterType.Integer, DefaultValue = 14, MinValue = 1)]
public int DmiPeriods { get; set; }
/// <summary>
/// Get or set Dynamic Periods Lower Bounds
/// </summary>
/// <value>The period.</value>
[Parameter(“Chande’s DMI Dynamic Periods Lower Bounds”, ParameterType.Integer, DefaultValue = 3)]
public int DmiLowerLimit { get; set; }
/// <summary>
/// Get or set Dynamic Periods Upper Bounds
/// </summary>
/// <value>The period.</value>
[Parameter(“Chande’s DMI Dynamic Periods Upper Bounds”, ParameterType.Integer, DefaultValue = 30)]
public int DmiUpperLimit { get; set; }
/// <summary>
/// Gets or sets the dmi LL.
/// </summary>
/// <value>
/// The dmi LL.
/// </value>
[Parameter(“Chande’s DMI OverBought Level”, ParameterType.Integer, DefaultValue = 70, MinValue = 50, MaxValue = 100)]
public int CDMIOBL { get; set; }
[Parameter(“Chande’s DMI OverSold Level”, ParameterType.Integer, DefaultValue = 30, MinValue = 0, MaxValue = 50)]
public int CDMIOSL { get; set; }
#endregion
[Output(“Chande’s DMI”, Style = LineStyle.Solid, Thickness = 2, Color = OutputColor.Blue)]
public IIndicatorDataSeries DMIndex
{
get { return _indicator.IndicatorPlot; }
}
[Output(“Chande’s DMI OB Level”, Style = LineStyle.Dash, Thickness = 1, Color = OutputColor.Red)]
public IDataSeries CDMIOBLevel { get; private set; }
[Output(“Chande’s DMI Mid Level”, Style = LineStyle.Dash, Thickness = 1, Color = OutputColor.Grey)]
public IDataSeries CDMIMidLevel { get; private set; }
[Output(“Chande’s DMI OS Level”, Style = LineStyle.Dash, Thickness = 1, Color = OutputColor.Red)]
public IDataSeries CDMIOSLevel { get; private set; }
//[Output(“Chande’s DMI Long Entry Level”, Style = LineStyle.Dash, Thickness = 1, Color = OutputColor.Blue)]
//public IIndicatorDataSeries CDMILLevel { get; set; }
//[Output(“Chande’s DMI Short Entry Level”, Style = LineStyle.Dash, Thickness = 1, Color = OutputColor.Blue)]
//public IIndicatorDataSeries CDMISLevel { get; set; }
[Trigger(“Long Exit Signal”)]
[Graphics(Symbol.Exit, OutputColor.Blue, SymbolLocation.Above)]
[Alert(“Long exit signal detected!”)]
public virtual ITriggerDataSeries LongExitSignal { get; set; }
/// <summary>
/// Gets or sets the short signal.
/// </summary>
/// <value>
/// The short signal.
/// </value>
[Trigger(“Short exit Signal”)]
[Graphics(Symbol.Exit, OutputColor.Red, SymbolLocation.Below)]
[Alert(“Short exit signal detected!”)]
public virtual ITriggerDataSeries ShortExitSignal { get; set; }
#endregion
#region Overriden methods
/// <summary>
/// Called when Initialize() is invoked .
/// </summary>
protected override void OnInitialize()
{
base.OnInitialize();
_indicator = CreateIndicator<ChandesDynamicMomentumIndexIndicator>(i =>
{
i.DmiLowerLimit = DmiLowerLimit;
i.DmiPeriods = DmiPeriods;
i.DmiUpperLimit = DmiUpperLimit;
i.Mode = ChandesDynamicMomentumIndexIndicatorMode.DynamicMomentumIndex;
i.PriceType = PriceType;
i.StdeVmaper = StdeVmaper;
i.StdevMaType = StdevMaType;
i.StdevPeriods = StdevPeriods;
});
CDMIOBLevel = CreateConstantSeries(CDMIOBL);
CDMIOSLevel = CreateConstantSeries(CDMIOSL);
CDMIMidLevel = CreateConstantSeries(50);
}
private bool LongTradeAlert;
private bool ShortTradeAlert;
/// <summary>
/// Called when calculate.
/// </summary>
/// <param name=”index”>The index.</param>
protected override void OnCalculate(int index)
{
//{Basic Entry/Exit Conditions}
//LongEntrySetup:= Cross(DMIndex,CDMIOSLevel);
var LongEntrySetup = All.Cross(DMIndex, CDMIOSLevel, index);
//LongExitCond1:= Cross(CDMIOSLevel,DMIndex);
var LongExitCond1 = All.Cross(CDMIOSLevel, DMIndex, index);
//LongExitCond2:= Cross(CDMIOBLevel,DMIndex);
var LongExitCond2 = All.Cross(CDMIOBLevel, DMIndex, index);
//LongExitSetup:= LongExitCond1=1 OR LongExitCond2=1;
var LongExitSetup = LongExitCond1 || LongExitCond2;
//ShortEntrySetup:= Cross(CDMIOBLevel,DMIndex);
var ShortEntrySetup = All.Cross(CDMIOBLevel, DMIndex, index);
//ShortExitCond1:= Cross(DMIndex,CDMIOBLevel);
var ShortExitCond1 = All.Cross(DMIndex, CDMIOBLevel, index);
//ShortExitCond2:= Cross(DMIndex,CDMIOSLevel);
var ShortExitCond2 = All.Cross(DMIndex, CDMIOSLevel, index);
//ShortExitSetup:= ShortExitCond1=1 OR ShortExitCond2=1;
var ShortExitSetup = ShortExitCond1 || ShortExitCond2;
//{Long Entry Signal}
//LongEntrySignal:= (LongTradeAlert=0 AND ShortTradeAlert=0 AND LongEntrySetup=1) OR (LongTradeAlert=0 AND ShortExitSetup=1 AND LongEntrySetup=1);
LongSignal[index] = (!LongTradeAlert && !ShortTradeAlert && LongEntrySetup) || (!LongTradeAlert && ShortExitSetup && LongEntrySetup);
//{Long Exit Signal}
//LongExitSignal:= (LongTradeAlert=1 AND LongExitSetup=1);
LongExitSignal[index] = (LongTradeAlert && LongExitSetup);
//{Short Entry Signal}
//ShortEntrySignal:= (ShortTradeAlert=0 AND LongTradeAlert=0 AND ShortEntrySetup=1) OR (ShortTradeAlert=0 AND LongExitSetup=1 AND ShortEntrySetup=1);
ShortSignal[index]= (!ShortTradeAlert && !LongTradeAlert && ShortEntrySetup) || (!ShortTradeAlert && LongExitSetup && ShortEntrySetup);
//{Short Exit Signal}
//ShortExitSignal:= (ShortTradeAlert=1 AND ShortExitSetup=1);
ShortExitSignal[index]= (ShortTradeAlert && ShortExitSetup);
//{Open Trade Determination for Long/Short Entry/Exit Signals}
//LongTradeAlert:= SignalFlag(LongEntrySignal=1,LongExitSignal=1);
LongTradeAlert= All.SignalFlag(LongSignal,LongExitSignal,index);
//ShortTradeAlert:= SignalFlag(ShortEntrySignal=1,ShortExitSignal=1);
ShortTradeAlert= All.SignalFlag(ShortSignal,ShortExitSignal,index);
// {Auto-Trading Functionality; Used in Auto-Trade Mode Only}
OpenBuy[index] = Trading.GetBuyPositionCount() == 0 && LongSignal[index];
CloseBuy[index] = Trading.GetBuyPositionCount() > 0 && LongExitSignal[index];
OpenSell[index] = Trading.GetSellPositionCount() == 0 && ShortSignal[index];
CloseSell[index] = Trading.GetSellPositionCount() > 0 && ShortExitSignal[index];
}
#endregion
}
}
10/15/2017 at 2:57 PM #49415hello the DMI has always fascinated me … could you kindly write it using the PRT button on the gray bar, and optimize it with the missing parameters?
you sure have run the BT, with what parameters did you find it right? on what TF and what tools do I recommend?
thank you so much11/29/2017 at 8:25 PM #5438412/04/2017 at 9:58 PM #54724 -
AuthorPosts
Find exclusive trading pro-tools on