private void initialSetup() { if (_StartUp == true) { _StartUp = false; //_instr.SendOrder("BUY", 1, "MKT"); //_instr.SendOrder("SELL", 1, "MKT"); double[] m2IS = new double[12]; m2IS = MassFuncs.mass2(AskPriList, BidPriList, AskSizeList, BidSizeList); int percentageChange = Math.Abs(percentDecision(m2IS)); // Here we place the order if (percentageChange > 0) { _instr.SendOrder("BUY", 1, "MKT"); //Using Oddlots to preserve } if (percentageChange < 0) { _instr.SendOrder("SELL", 1, "MKT"); } else if (percentageChange == 0) { _instr.SendOrder("BUY", 1, "MKT"); } } }
private void OnTimedEvent(object sender, ElapsedEventArgs e) { if (_PriceChangeCounter > 52) { // this is where we make mass1, depending on the MAs calculated above double[] m1 = new double[12]; double[] m2 = new double[12]; m1 = MassFuncs.mass1(MA100_old, MA100_new, MA200_old, MA200_new, MA500_old, MA500_new); // Bid m2m = new Bid(); m2 = MassFuncs.mass2(AskPriList, BidPriList, AskSizeList, BidSizeList); // now we call the DST fusion. You need to insert the other mass function somewhere double[] M = new double[12]; // MassFuncs.massFusion Mass = new massFusion(); M = MassFuncs.massFusionFunc(m1, m2); //Timer DSTtime = new Timer(); // Here we figure out what are position decision will be, i.e. increase/decrease and by what percentage //percentageChange = percentDecision(M); int percentageChange = percentDecision(M); for (int i = 0; i < 12; i++) { Debug.WriteLine(M[i]); } Debug.WriteLine("im working nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0000000000w" + _Counter + " " + percentageChange); Debug.WriteLine(percentageChange); // Here we place the order if (percentageChange > 0) { _instr.SendOrder("BUY", (Math.Abs(percentageChange)), "MKT"); } if (percentageChange < 0) { _instr.SendOrder("SELL", (Math.Abs(percentageChange)), "MKT"); } orderPlaced++; } }