public void AddTradeAction(int barNo, string actname, TradeActionType saType, SupportResistanceRange <double> snr) { TradeAction sa = new TradeAction(); sa.ActionType = saType; //sa.SnR = snr; TradeAction tact = new TradeAction(); tact.BarNo = barNo; // tact.ActionName = actname; // tact.TradeActionType = TradeActionType.BracketSignal; //tact.Signal_Action = sa; AddTradeAction(barNo, tact); }
/// <summary> /// Get the action list for the bar by action type ??? /// Get the trade action from bar with barNo and the actionActionType ??? /// </summary> /// <param name="barNo"></param> /// <param name="action_type"></param> /// <returns></returns> public TradeAction GetTradeActionByType(int barNo, TradeActionType action_type) { TradeAction list_action = GetTradeAction(barNo); if (list_action != null) { TradeAction list_sigByType = new TradeAction(); // foreach(TradeAction sig in list_action) { // if(action_type == sig.TradeActionType) // list_sigByType.Add(sig); // } // if(list_sigByType.Count > 0) // return list_sigByType; } return(null); }
/// <summary> /// Get last action list before barNo by action type ??? /// Get the last action before barNo by actionActionType ??? /// </summary> /// <param name="barNo"></param> /// <param name="action_type"></param> /// <returns></returns> public TradeAction GetLastTradeActionByType(int barNo, TradeActionType action_type) { int k = barNo; foreach (int kk in this.tradeActions.Keys.Reverse()) { if (kk < k) { TradeAction sigs = GetTradeActionByType(k, action_type); if (sigs != null) { return(sigs); } k = kk; } } return(null); }