예제 #1
0
        protected virtual bool SignalIsCorrect(Position signalPosition)
        {
            if(!Framework.Inst.SignalsRulesChecking)
            {
                Framework.CallTrace("Skipping signals checking..");
                return true;
            }
            if (IsFirstSignal)
            {
                Framework.CallTrace("It`s first signal. OK");
                return true;
            }

            Framework.CallTrace("Verifing signals..");
            if (LastPosition.EntryDate.AddMinutes(8).Subtract(signalPosition.EntryDate) > new TimeSpan(0, 0, 10))
            {
                LogWithDetails("To short time between signals! Ignoring it!", LastPosition, signalPosition);
                return false;
            }

            if (LastPosition.Direction == signalPosition.Direction)
            {
                LogWithDetails("Same direction signal detected. Ignoring it!", LastPosition, signalPosition);
                return false;
            }

            return true;
        }
예제 #2
0
        public bool AreAccountsInSync()
        {
            bool result = true;
            Framework.Inst.MainAccount.Login();
            LastPosition = Framework.Inst.MainAccount.GetCurrentPosition();
            Framework.Inst.MainAccount.Logout();

            foreach (AccountBase account in Framework.Inst.AccountsList)
            {
                if (!LastPosition.IsEqual(account.Position))
                {
                    result = false;
                }
            }

            Framework.CallTrace("AreAccountsInSync = " + result);
            return result;
        }
예제 #3
0
 protected static string GetDetails(Position last)
 {
     string m = "pos: " + last.Size + " " + last.Direction
                 + ", date: " + last.EntryDate + ", price:" + last.EntryPoint;
     return m;
 }
예제 #4
0
 protected static void LogWithDetails(string message, Position last, Position toPosition)
 {
     string m = "Last " + GetDetails(last) + "\n" + "To: " + GetDetails(toPosition) + "\n";
     Framework.CallTrace(message + "\n" + m);
     log.Warn(message + "\n" + m);
 }