393 lines
28 KiB
C#
393 lines
28 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using MarketData.Utils;
|
|
|
|
namespace MarketData.Generator.MGSHMomentum
|
|
{
|
|
public class MGSHConfiguration
|
|
{
|
|
// Operational Settings
|
|
public bool Verbose{get;set;}
|
|
// Basic settings
|
|
public int HoldingPeriod{get;set;}
|
|
public int MaxPositions{get;set;}
|
|
public String NoTradeSymbols{get;set;}
|
|
public String NoTradeFinancialSymbols{get;set;}
|
|
public double InitialCash{get;set;} // There is no defaullt for this value. It is supplied to the model at launch time.
|
|
|
|
// Stop Limit Functionality
|
|
public bool UseStopLimits{get;set;}
|
|
public double StopLimitRiskPercentDecimal{get;set;}
|
|
public int StopLimitScalingVolatilityDays{get;set;}
|
|
public int MinDaysBetweenStopAdjustments{get;set;}
|
|
public int MinDaysBetweenInitialStopAdjustment{get;set;}
|
|
public int StopLimitPriceTrendDays{get;set;}
|
|
public double StopLimitATRMultiplier{get;set;}
|
|
|
|
// Hedging Strategy
|
|
public bool UseHedging{get;set;}
|
|
public String HedgeBenchmarkSymbol{get;set;}
|
|
public String HedgeShortSymbol{get;set;}
|
|
public double HedgeRiskPercentDecimal{get;set;}
|
|
public int HedgeMinDaysBetweenStopAdjustments;
|
|
public double HedgeInitialCash{get;set;} // There is no default for this value. It is supplied to the model at launch time
|
|
public int HedgeCloseAboveSMANDays{get;set;}
|
|
public int HedgeBandBreakCheckDays{get;set;}
|
|
public double HedgeATRMultiplier{get;set;}
|
|
|
|
// Manage buying and selling
|
|
public bool KeepSlotPositions{get;set;} // if this setting is true then we never sell slot positions, allowing the trailing stop to eventually invoke a sell.
|
|
|
|
// Pricing Exceptions
|
|
public int MaxPricingExceptions{get;set;} // This is the pricing exception limit. If we have this many of exceptions then we will sell the security at the last known good price.
|
|
|
|
// Fundamental screenings
|
|
public double MarketCapLowerLimit{get;set;}
|
|
|
|
public bool UsePEScreen{get;set;} // If set this filter will ignore any security that is either missing a PE or if the PE is present but less than 0
|
|
|
|
public bool UseMaxPEScreen{get;set;} // control Max PE range check
|
|
public double MaxPE{get;set;} // if UseMaxPECheck is set this setting will ignore any security who's PE is greater. If PE is missing candidate will be accepted
|
|
public bool StrictMaxPE{get;set;} // if TRUE then UseMaxPEScreen is STRICT otherwise UseMaxPEScreen is SOFT RULE where >MaxPE is AVOIDED but used to fill the quota. The quota is filled by ranking highPECandidates by PE and taking the lower PE's up to the quota. Soft rule yields best result
|
|
|
|
// EBITDA screen
|
|
public bool UseEBITDAScreen{get;set;}
|
|
public bool UseRevenuePerShareScreen{get;set;}
|
|
|
|
// BETA
|
|
public bool UseBetaGenerator{get;set;} // If set then the model will use the internal beta generator. Otherwise it will use Beta from Fundamental data
|
|
public int UseBetaGeneratorMonths{get;set;} // If UseBetaGenerator=true then UseBetaGeneratorMonths will prescribe the number of months over which to calculate the monthly beta
|
|
|
|
// If slope Beta Check is true then we compare the fundamental Beta to the threshhold value. If Beta>Threshhold AND the slope from the Benchmark LowPrice over BetaDays is <0 we reject
|
|
public String Benchmark{get;set;}
|
|
public bool UseLowSlopeBetaCheck{get;set;}
|
|
public int LowSlopeBetaDays{get;set;}
|
|
public double LowSlopeBetaThreshhold{get;set;}
|
|
|
|
// MACD Settings : If MACD is being used then the process configures the MACD as per setup and eliminates candidates with a weak sell/strong sell signal in the signal days setting.
|
|
public bool UseMACD{get;set;}
|
|
public String MACDSetup="(12,26,9)"; // (8,17,9) is another alternative
|
|
public int MACDSignalDays{get;set;}
|
|
public bool MACDRejectWeakSellSignals{get;set;}
|
|
public bool MACDRejectStrongSellSignals{get;set;}
|
|
|
|
// Stochastics Settings : If Stochastics is being used then the process eliminates candidates with a weak sell/strong sell in the signal days setting.
|
|
public bool UseStochastics{get;set;}
|
|
public int StochasticsSignalDays{get;set;}
|
|
public bool StochasticsRejectWeakSells{get;set;}
|
|
public bool StochasticsRejectStrongSells{get;set;}
|
|
|
|
// FallbackCandidate : If this setting is true then the FallbackCandidate is purchased if there are no candidates that qualify in a given cycle
|
|
public bool UseFallbackCandidate{get;set;}
|
|
public String FallbackCandidate{get;set;}
|
|
public String FallbackCandidateBestOf{get;set;} // if this is set then the fallback candidate with the best 252 day return is selected
|
|
|
|
// Benchmark mode : If this is set to true then purchases the benchmark symbol instead of the momentum candidates
|
|
public bool BenchmarkMode{get;set;}
|
|
public String BenchmarkModeSymbol{get;set;}
|
|
|
|
// QualityIndicator
|
|
public String QualityIndicatorType{get;set;} // this can be either IDINDICATOR or SCOREINDICATOR. The SCOREINDICATOR was adopted from CMMomentum model
|
|
|
|
// IncludeTradeMasterForSymbolsHeld :
|
|
public bool IncludeTradeMasterForSymbolsHeld{get;set;} // if this is set to true then use both ActivePositions within the model as well as the master trades table to determine held positions.
|
|
|
|
public MGSHConfiguration()
|
|
{
|
|
Verbose=true; // user verbose output
|
|
BenchmarkMode=false; // set this to true if you want to run the model using just the benchmark symbol to buy.
|
|
BenchmarkModeSymbol="SPY"; // SPY is the default symbol to buy when testing
|
|
HoldingPeriod=3; // 3 is the default. Hold for three months
|
|
MaxPositions=3; // 3 is the default. Max positions per slot
|
|
NoTradeSymbols="GBTC,YOKU,PNY,RFMD,ASAZY"; // ASAZY came up as candidate during 3/30 run but not available on Robinhood
|
|
NoTradeFinancialSymbols="U.S. Private Equity,U.S. Financials,U.S. Financial Services,U.S. Banking and Investment Services,Trading-Miscellaneous,Trading--Miscellaneous,Trading--Leveraged Equity,Trading--Leveraged Debt,Trading--Leveraged Commodities,Trading--Inverse Equity,Trading--Inverse Commodities,Tactical Allocation,Specialty Finance,Japan Financials,Savings & Cooperative Banks,Option Writing,Insurance Brokers,Insurance - Specialty,Insurance - Reinsurance,Insurance - Property & Casualty,Insurance - Life,Insurance - Diversified,Global Private Equity,Global Financials,Financial Services,Financial Exchanges,Financial,China Financials,Banks - Regional - US,Banks - Regional - Latin America,Banks - Global,Asset Management,Credit Services";
|
|
Benchmark="SPY"; // SPY is the default
|
|
// Candidate selection settings
|
|
MarketCapLowerLimit=1000000000; // 1B is the default
|
|
// PEScreen is off by default
|
|
UsePEScreen=false; // false is the default. This setting yields the most optimal performance in backtests. Checks for existance of PE and if exists ensures >0
|
|
// UseMaxPEScreen, MaxPE, and StrictPEExclusion
|
|
UseMaxPEScreen=true;
|
|
MaxPE=40;
|
|
StrictMaxPE=false;
|
|
|
|
// Beta
|
|
UseBetaGenerator=true; // The default setting is to calculate our own beta rather than use the beta from the fundamental data
|
|
UseBetaGeneratorMonths=24; // The default number of months over which to calculate our monthly return stream for the beta generator
|
|
|
|
// Stop Limits
|
|
UseStopLimits=false; // Flag to control the use of stop limits
|
|
StopLimitRiskPercentDecimal=.17; // The per share risk to take when setting the initial stop. This was the best setting after running a suite of tests
|
|
StopLimitScalingVolatilityDays=30; // This is the number of days to use in the average true range calculation
|
|
MinDaysBetweenInitialStopAdjustment=30; // 30 Number of days that must elapse before attempting to adjust the stop limit. This is the best setting
|
|
MinDaysBetweenStopAdjustments=30; // 30 Number of days between stop adjustments. This is after the initial stop is set... of course
|
|
StopLimitPriceTrendDays=20; // The number of days for which we want to see upward trend before adjusting a subsequent stop limit
|
|
StopLimitATRMultiplier=3.00; // the ATR multiplier for setting stop limits on regular positions
|
|
|
|
// Hedging Strategy
|
|
UseHedging=false; // Flag to control the use of hedging strategy
|
|
HedgeBenchmarkSymbol="SPY"; // The benchmark symbol for the hedging strategy
|
|
HedgeShortSymbol="SH"; // The symbol that is used to go short
|
|
HedgeRiskPercentDecimal=.12; // This will be the risk to assume with the hedge position.
|
|
HedgeMinDaysBetweenStopAdjustments=1; // We use a single day for hedge positions
|
|
HedgeCloseAboveSMANDays=10; // Part of open hedge indicator if Close is not above Bollinger SMAN for this many days then reject
|
|
HedgeBandBreakCheckDays=3; // Number of days that low and close must be <= LP1 in order to open hedge. If >= number of days then reject
|
|
HedgeATRMultiplier=1.00; // 1.00 produces best results for the hedging stops. The default ATR multiplier in the code Volatility Calculator is 3 which gives a good spread when adjusting stop prices.
|
|
|
|
// Manage buying and selling
|
|
KeepSlotPositions=true; // The default is true to retain legacy functionality
|
|
|
|
MaxPricingExceptions=3; // The maximum number of pricing exceptions. If exceeded then the security will be sold at the last known good price
|
|
|
|
// Other settings
|
|
UseEBITDAScreen=true; // true is the default
|
|
UseRevenuePerShareScreen=true; // true is the default
|
|
UseLowSlopeBetaCheck=true; // true is the default. this yields the most optimal performance in backtests
|
|
LowSlopeBetaDays=15; // 15 is the default. This yields the most optimal performance in backtests
|
|
LowSlopeBetaThreshhold=1.00; // (1.00) is the default This yields the most optimal performance in backtests
|
|
UseMACD=true; // true is the default
|
|
MACDSetup="(12,26,9)"; // (12,26,9)
|
|
MACDSignalDays=12; // 12 is the default
|
|
MACDRejectStrongSellSignals=false; // false is the default
|
|
MACDRejectWeakSellSignals=true; // true is the default
|
|
UseStochastics=true; // true is the default
|
|
StochasticsSignalDays=3; // 3 is the default
|
|
StochasticsRejectStrongSells=true; // true is the default
|
|
StochasticsRejectWeakSells=true; // true is the default
|
|
|
|
// Fallback candidate settings
|
|
UseFallbackCandidate=true; // True is the default
|
|
FallbackCandidate="SHV"; // "SHV" ICE U.S. Treasury Short Bond Index, "AGG" Barclays U.S. Aggregate Bond Index - AGG can have a slighty better return but is more volatile
|
|
FallbackCandidateBestOf="SHV,NEAR,BIL,GSY,AGG,ACWX,GSY,SCHF,IXUS,DBEF,IEFA,TLT"; // if set then the fallback candidate is selected as the best 252 day return in this comma seperated list (i.e.) "SHV,ACWX,AGG,SHV,NEAR,BIL,GSY,AGG,ACWX,GSY,SCHF,IXUS,DBEF,IEFA
|
|
// Set the QualityIndicator type to the ScoreIndicator by default.
|
|
QualityIndicatorType=MGSHQualityIndicator.ToString(MGSHQualityIndicator.QualityType.ScoreIndicator);
|
|
|
|
IncludeTradeMasterForSymbolsHeld=false; // If this is set to true then the model takes into account any open positions in other models etc.,
|
|
}
|
|
public void DisplayHeader()
|
|
{
|
|
MDTrace.WriteLine(LogLevel.DEBUG,"Setting,Value");
|
|
}
|
|
public NVPCollection ToNVPCollection()
|
|
{
|
|
NVPCollection nvpCollection=new NVPCollection();
|
|
nvpCollection.Add(new NVP("Verbose",Verbose.ToString()));
|
|
nvpCollection.Add(new NVP("KeepSlotPositions",KeepSlotPositions.ToString()));
|
|
nvpCollection.Add(new NVP("BenchmarkMode",BenchmarkMode.ToString()));
|
|
nvpCollection.Add(new NVP("BenchmarkModeSymbol",BenchmarkModeSymbol.ToString()));
|
|
nvpCollection.Add(new NVP("HoldingPeriod",HoldingPeriod.ToString()));
|
|
nvpCollection.Add(new NVP("MaxPositions",MaxPositions.ToString()));
|
|
nvpCollection.Add(new NVP("NoTradeSymbols",NoTradeSymbols.ToString()));
|
|
nvpCollection.Add(new NVP("NoTradeFinancialSymbols",NoTradeFinancialSymbols.ToString()));
|
|
nvpCollection.Add(new NVP("Benchmark",Benchmark.ToString()));
|
|
nvpCollection.Add(new NVP("MarketCapLowerLimit",MarketCapLowerLimit.ToString()));
|
|
nvpCollection.Add(new NVP("UsePEScreen",UsePEScreen.ToString()));
|
|
nvpCollection.Add(new NVP("UseEBITDAScreen",UseEBITDAScreen.ToString()));
|
|
nvpCollection.Add(new NVP("UseRevenuePerShareScreen",UseRevenuePerShareScreen.ToString()));
|
|
nvpCollection.Add(new NVP("UseLowSlopeBetaCheck",UseLowSlopeBetaCheck.ToString()));
|
|
nvpCollection.Add(new NVP("LowSlopeBetaDays",LowSlopeBetaDays.ToString()));
|
|
nvpCollection.Add(new NVP("LowSlopeBetaThreshhold",LowSlopeBetaThreshhold.ToString()));
|
|
nvpCollection.Add(new NVP("UseMACD",UseMACD.ToString()));
|
|
nvpCollection.Add(new NVP("MACDSetup",MACDSetup.ToString()));
|
|
nvpCollection.Add(new NVP("MACDSignalDays",MACDSignalDays.ToString()));
|
|
nvpCollection.Add(new NVP("MACDRejectStrongSellSignals",MACDRejectStrongSellSignals.ToString()));
|
|
nvpCollection.Add(new NVP("MACDRejectWeakSellSignals",MACDRejectWeakSellSignals.ToString()));
|
|
nvpCollection.Add(new NVP("UseStochastics",UseStochastics.ToString()));
|
|
nvpCollection.Add(new NVP("StochasticsSignalDays",StochasticsSignalDays.ToString()));
|
|
nvpCollection.Add(new NVP("StochasticsRejectStrongSells",StochasticsRejectStrongSells.ToString()));
|
|
nvpCollection.Add(new NVP("StochasticsRejectWeakSells",StochasticsRejectWeakSells.ToString()));
|
|
nvpCollection.Add(new NVP("UseFallbackCandidate",UseFallbackCandidate.ToString()));
|
|
nvpCollection.Add(new NVP("FallbackCandidate",FallbackCandidate.ToString()));
|
|
nvpCollection.Add(new NVP("FallbackCandidateBestOf",FallbackCandidateBestOf.ToString()));
|
|
nvpCollection.Add(new NVP("UseMaxPEScreen",UseMaxPEScreen.ToString()));
|
|
nvpCollection.Add(new NVP("MaxPE",MaxPE.ToString()));
|
|
nvpCollection.Add(new NVP("StrictMaxPE",StrictMaxPE.ToString()));
|
|
nvpCollection.Add(new NVP("QualityIndicatorType",QualityIndicatorType.ToString()));
|
|
nvpCollection.Add(new NVP("IncludeTradeMasterForSymbolsHeld",IncludeTradeMasterForSymbolsHeld.ToString()));
|
|
|
|
nvpCollection.Add(new NVP("UseStopLimits",UseStopLimits.ToString()));
|
|
nvpCollection.Add(new NVP("StopLimitRiskPercentDecimal",StopLimitRiskPercentDecimal.ToString()));
|
|
nvpCollection.Add(new NVP("StopLimitScalingVolatilityDays",StopLimitScalingVolatilityDays.ToString()));
|
|
nvpCollection.Add(new NVP("MinDaysBetweenInitialStopAdjustment",MinDaysBetweenInitialStopAdjustment.ToString()));
|
|
nvpCollection.Add(new NVP("MinDaysBetweenStopAdjustments",MinDaysBetweenStopAdjustments.ToString()));
|
|
nvpCollection.Add(new NVP("StopLimitPriceTrendDays",StopLimitPriceTrendDays.ToString()));
|
|
nvpCollection.Add(new NVP("StopLimitATRMultiplier",StopLimitATRMultiplier.ToString()));
|
|
|
|
nvpCollection.Add(new NVP("UseHedging",UseHedging.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeBenchmarkSymbol",HedgeBenchmarkSymbol.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeShortSymbol",HedgeShortSymbol.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeRiskPercentDecimal",HedgeRiskPercentDecimal.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeMinDaysBetweenStopAdjustments",HedgeMinDaysBetweenStopAdjustments.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeInitialCash",HedgeInitialCash.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeCloseAboveSMANDays",HedgeCloseAboveSMANDays.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeBandBreakCheckDays",HedgeBandBreakCheckDays.ToString()));
|
|
nvpCollection.Add(new NVP("HedgeATRMultiplier",HedgeATRMultiplier.ToString()));
|
|
|
|
nvpCollection.Add(new NVP("MaxPricingExceptions",MaxPricingExceptions.ToString()));
|
|
|
|
nvpCollection.Add(new NVP("UseBetaGenerator",UseBetaGenerator.ToString()));
|
|
nvpCollection.Add(new NVP("UseBetaGeneratorMonths",UseBetaGeneratorMonths.ToString()));
|
|
|
|
return nvpCollection;
|
|
}
|
|
public static MGSHConfiguration FromNVPCollection(NVPCollection nvpCollection)
|
|
{
|
|
MGSHConfiguration mgConfiguration=new MGSHConfiguration();
|
|
NVPDictionary nvpDictionary=nvpCollection.ToDictionary();
|
|
mgConfiguration.Verbose=nvpDictionary["Verbose"].Get<Boolean>();
|
|
if(nvpDictionary.ContainsKey("KeepSlotPositions")) mgConfiguration.KeepSlotPositions=nvpDictionary["KeepSlotPositions"].Get<bool>();
|
|
mgConfiguration.BenchmarkMode=nvpDictionary["BenchmarkMode"].Get<Boolean>();
|
|
mgConfiguration.BenchmarkModeSymbol=nvpDictionary["BenchmarkModeSymbol"].Get<String>();
|
|
mgConfiguration.HoldingPeriod=nvpDictionary["HoldingPeriod"].Get<int>();
|
|
mgConfiguration.MaxPositions=nvpDictionary["MaxPositions"].Get<int>();
|
|
mgConfiguration.NoTradeSymbols=nvpDictionary["NoTradeSymbols"].Get<String>();
|
|
mgConfiguration.NoTradeFinancialSymbols=nvpDictionary["NoTradeFinancialSymbols"].Get<String>();
|
|
mgConfiguration.Benchmark=nvpDictionary["Benchmark"].Get<String>();
|
|
mgConfiguration.MarketCapLowerLimit=nvpDictionary["MarketCapLowerLimit"].Get<double>();
|
|
mgConfiguration.UsePEScreen=nvpDictionary["UsePEScreen"].Get<Boolean>();
|
|
mgConfiguration.UseMaxPEScreen=nvpDictionary["UseMaxPEScreen"].Get<Boolean>();
|
|
mgConfiguration.MaxPE=nvpDictionary["MaxPE"].Get<double>();
|
|
mgConfiguration.StrictMaxPE=nvpDictionary["StrictMaxPE"].Get<Boolean>();
|
|
mgConfiguration.UseEBITDAScreen=nvpDictionary["UseEBITDAScreen"].Get<Boolean>();
|
|
mgConfiguration.UseRevenuePerShareScreen=nvpDictionary["UseRevenuePerShareScreen"].Get<Boolean>();
|
|
mgConfiguration.UseLowSlopeBetaCheck=nvpDictionary["UseLowSlopeBetaCheck"].Get<Boolean>();
|
|
mgConfiguration.LowSlopeBetaDays=nvpDictionary["LowSlopeBetaDays"].Get<int>();
|
|
mgConfiguration.LowSlopeBetaThreshhold=nvpDictionary["LowSlopeBetaThreshhold"].Get<double>();
|
|
mgConfiguration.UseMACD=nvpDictionary["UseMACD"].Get<Boolean>();
|
|
mgConfiguration.MACDSetup=nvpDictionary["MACDSetup"].Get<String>();
|
|
mgConfiguration.MACDSignalDays=nvpDictionary["MACDSignalDays"].Get<int>();
|
|
mgConfiguration.MACDRejectStrongSellSignals=nvpDictionary["MACDRejectStrongSellSignals"].Get<Boolean>();
|
|
mgConfiguration.MACDRejectWeakSellSignals=nvpDictionary["MACDRejectWeakSellSignals"].Get<Boolean>();
|
|
mgConfiguration.UseStochastics=nvpDictionary["UseStochastics"].Get<Boolean>();
|
|
mgConfiguration.StochasticsSignalDays=nvpDictionary["StochasticsSignalDays"].Get<int>();
|
|
mgConfiguration.StochasticsRejectStrongSells=nvpDictionary["StochasticsRejectStrongSells"].Get<Boolean>();
|
|
mgConfiguration.StochasticsRejectWeakSells=nvpDictionary["StochasticsRejectWeakSells"].Get<Boolean>();
|
|
mgConfiguration.UseFallbackCandidate=nvpDictionary["UseFallbackCandidate"].Get<Boolean>();
|
|
mgConfiguration.FallbackCandidate=nvpDictionary["FallbackCandidate"].Get<String>();
|
|
mgConfiguration.FallbackCandidateBestOf=nvpDictionary["FallbackCandidateBestOf"].Get<String>();
|
|
mgConfiguration.MaxPricingExceptions=nvpDictionary["MaxPricingExceptions"].Get<int>();
|
|
|
|
if(nvpDictionary.ContainsKey("QualityIndicatorType")) mgConfiguration.QualityIndicatorType=nvpDictionary["QualityIndicatorType"].Get<String>();
|
|
else mgConfiguration.QualityIndicatorType=MGSHQualityIndicator.ToString(MGSHQualityIndicator.QualityType.IDIndicator);
|
|
|
|
if(nvpDictionary.ContainsKey("IncludeTradeMasterForSymbolsHeld")) mgConfiguration.IncludeTradeMasterForSymbolsHeld=nvpDictionary["IncludeTradeMasterForSymbolsHeld"].Get<bool>();
|
|
else mgConfiguration.IncludeTradeMasterForSymbolsHeld=false;
|
|
|
|
// Stop Limits
|
|
if(nvpDictionary.ContainsKey("UseStopLimits"))
|
|
{
|
|
mgConfiguration.UseStopLimits = nvpDictionary["UseStopLimits"].Get<bool>();
|
|
mgConfiguration.StopLimitRiskPercentDecimal = nvpDictionary["StopLimitRiskPercentDecimal"].Get<double>();
|
|
mgConfiguration.StopLimitScalingVolatilityDays = nvpDictionary["StopLimitScalingVolatilityDays"].Get<int>();
|
|
mgConfiguration.MinDaysBetweenInitialStopAdjustment = nvpDictionary["MinDaysBetweenInitialStopAdjustment"].Get<int>();
|
|
mgConfiguration.MinDaysBetweenStopAdjustments = nvpDictionary["MinDaysBetweenStopAdjustments"].Get<int>();
|
|
mgConfiguration.StopLimitPriceTrendDays = nvpDictionary["StopLimitPriceTrendDays"].Get<int>();
|
|
if(nvpDictionary.ContainsKey("StopLimitATRMultiplier"))
|
|
{
|
|
mgConfiguration.StopLimitATRMultiplier = nvpDictionary["StopLimitATRMultiplier"].Get<double>();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mgConfiguration.UseStopLimits = false;
|
|
}
|
|
|
|
// Hedging
|
|
if(nvpDictionary.ContainsKey("UseHedging"))
|
|
{
|
|
mgConfiguration.UseHedging = nvpDictionary["UseHedging"].Get<bool>();
|
|
mgConfiguration.HedgeBenchmarkSymbol = nvpDictionary["HedgeBenchmarkSymbol"].Get<String>();
|
|
mgConfiguration.HedgeShortSymbol = nvpDictionary["HedgeShortSymbol"].Get<string>();
|
|
mgConfiguration.HedgeRiskPercentDecimal = nvpDictionary["HedgeRiskPercentDecimal"].Get<double>();
|
|
mgConfiguration.HedgeMinDaysBetweenStopAdjustments = nvpDictionary["HedgeMinDaysBetweenStopAdjustments"].Get<int>();
|
|
mgConfiguration.HedgeInitialCash = nvpDictionary["HedgeInitialCash"].Get<int>();
|
|
mgConfiguration.HedgeCloseAboveSMANDays = nvpDictionary["HedgeCloseAboveSMANDays"].Get<int>();
|
|
mgConfiguration.HedgeBandBreakCheckDays = nvpDictionary["HedgeBandBreakCheckDays"].Get<int>();
|
|
mgConfiguration.HedgeATRMultiplier = nvpDictionary["HedgeATRMultiplier"].Get<double>();
|
|
}
|
|
else
|
|
{
|
|
mgConfiguration.UseHedging=false;
|
|
}
|
|
|
|
if(nvpDictionary.ContainsKey("UseBetaGenerator"))
|
|
{
|
|
mgConfiguration.UseBetaGenerator = nvpDictionary["UseBetaGenerator"].Get<bool>();
|
|
mgConfiguration.UseBetaGeneratorMonths = nvpDictionary["UseBetaGeneratorMonths"].Get<int>();
|
|
}
|
|
|
|
return mgConfiguration;
|
|
}
|
|
public void DisplayConfiguration()
|
|
{
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Verbose,{0}",Verbose));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MaxPricingExceptions,{0}",MaxPricingExceptions));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("KeepSlotPositions,{0}",KeepSlotPositions));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Holding Period,{0}",HoldingPeriod));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MaxPositions,{0}",MaxPositions));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("NoTradeSymbols,{0}",NoTradeSymbols));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("NoTradeFinancialSymbols,{0}",NoTradeFinancialSymbols));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Benchmark,{0}",Benchmark));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MarketCapLowerLimit,{0}",MarketCapLowerLimit));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UsePEScreen,{0}",UsePEScreen));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseMaxPEScreen,{0}",UseMaxPEScreen));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MaxPE,{0}",MaxPE));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StrictMaxPE,{0}",StrictMaxPE));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseEBITDAScreen,{0}",UseEBITDAScreen));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseRevenuePerShareScreen,{0}",UseRevenuePerShareScreen));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseLowSlopeBetaCheck,{0}",UseLowSlopeBetaCheck));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("LowSlopeBetaDays,{0}",LowSlopeBetaDays));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("LowSlopeBetaThreshhold,{0}",LowSlopeBetaThreshhold));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseMACD,{0}",UseMACD));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MACDSetup,{0}",MACDSetup));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MACDSignalDays,{0}",MACDSignalDays));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MACDRejectStrongSellSignals,{0}",MACDRejectStrongSellSignals));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MACDRejectWeakSellSignals,{0}",MACDRejectWeakSellSignals));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseStochastics,{0}",UseStochastics));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StochasticsSignalDays,{0}",StochasticsSignalDays));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StochasticsRejectStrongSells,{0}",StochasticsRejectStrongSells));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StochasticsRejectWeakSells,{0}",StochasticsRejectWeakSells));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseFallbackCandidate,{0}",UseFallbackCandidate));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("FallbackCandidate,{0}",FallbackCandidate));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("FallbackCandidateBestOf,{0}",FallbackCandidateBestOf));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("BenchmarkMode,{0}",BenchmarkMode));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("BenchmarkSymbol,{0}",BenchmarkModeSymbol));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("QualityIndicatorType,{0}",QualityIndicatorType));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("IncludeTradeMasterForSymbolsHeld,{0}",IncludeTradeMasterForSymbolsHeld));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseStopLimits,{0}",UseStopLimits));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StopLimitRiskPercentDecimal,{0}",StopLimitRiskPercentDecimal));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StopLimitScalingVolatilityDays,{0}",StopLimitScalingVolatilityDays));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MinDaysBetweenInitialStopAdjustment,{0}",MinDaysBetweenInitialStopAdjustment));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("MinDaysBetweenStopAdjustments,{0}",MinDaysBetweenStopAdjustments));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StopLimitPriceTrendDays,{0}",StopLimitPriceTrendDays));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("StopLimitATRMultiplier,{0}",StopLimitATRMultiplier));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UseHedging,{0}",UseHedging));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("HedgeBenchmarkSymbol,{0}",HedgeBenchmarkSymbol));
|
|
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("HedgeShortSymbol,{0}",HedgeShortSymbol));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("HedgeRiskPercentDecimal,{0}", HedgeRiskPercentDecimal));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("HedgeMinDaysBetweenStopAdjustments,{0}", HedgeMinDaysBetweenStopAdjustments));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("HedgeInitialCash,{0}", HedgeInitialCash));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("HedgeCloseAboveSMANDays,{0}", HedgeCloseAboveSMANDays));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("HedgeBandBreakCheckDays,{0}", HedgeBandBreakCheckDays));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("HedgeATRMultiplier,{0}", HedgeATRMultiplier));
|
|
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("UseBetaGenerator,{0}", UseBetaGenerator));
|
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("UseBetaGeneratorMonths,{0}", UseBetaGeneratorMonths));
|
|
|
|
}
|
|
}
|
|
}
|