Exemple #1
0
 internal Tunnel(TunnelMartingaleBot robot)
 {
     //Ask is always higher than Bid, Buy is always take the Ask while Sell is always take the Bid.
     tmBot              = robot;
     LastTradeType      = new Random().Next(1, 2) == 1 ? TradeType.Buy : TradeType.Sell;
     SessionNumber      = 0;
     Statistics         = new TunnelStatistics();
     TunnelChartObjects = new TunnelChartObjects();
     Initialize();
 }
 internal TunnelMartingaleEngine(TunnelMartingaleBot robot)
 {
     //Ask is always higher than Bid, Buy is always take the Ask while Sell is always take the Bid.
     tmBot              = robot;
     LastTradeType      = new Random().Next(1, 2) == 1 ? TradeType.Buy : TradeType.Sell;
     SessionNumber      = 0;
     Statistics         = new TunnelStatistics();
     TunnelChartObjects = new TunnelChartObjects();
     rsi = tmBot.Indicators.RelativeStrengthIndex(tmBot.Bars.ClosePrices, tmBot.RSIPeriods);
     bb  = tmBot.Indicators.BollingerBands(tmBot.Bars.ClosePrices, tmBot.BBPeriods, 2, tmBot.BBMAType);
     if (tmBot.config.InitialBucket.IsPositive())
     {
         NetLossBucket = !tmBot.config.InitialBucket.IsNegative() ? -tmBot.config.InitialBucket : tmBot.config.InitialBucket;
         tmBot.Print("Initial bucket set at {0:#,##0.00}", NetLossBucket);
     }
     Initialize();
 }