public bool DetectBuyMarketSignal() { double ma_value = 0.0, ma_vol_value = 0; double sum_val = 0, sum_vol_val = 0; double cu_av_value = (Global.current_rate.ask_value + Global.current_rate.bid_value) / 2; double cu_vol_value = Global.candle_data.volume_value; int index; if (Global.candle_array.Count < Global.buy_market_min_th) { return(false); } for (index = Global.candle_array.Count - 1; index >= 0; index--) { CandleData cd = Global.candle_array.ElementAt(index); sum_val += (cd.open_value + cd.close_value) / 2; sum_vol_val += cd.volume_value; } ma_value = sum_val / Global.buy_market_min_th; ma_vol_value = sum_vol_val / Global.buy_market_min_th; double diff_val = cu_vol_value - ma_vol_value; if ((cu_av_value > ma_value && diff_val * 100 / cu_vol_value > 5) || CalculateRsi() < 35) { return(true); } return(false); }
public bool DetectSellLimitSignal() { double ma_value = 0.0; double sum_val = 0; double cu_av_value = (Global.current_rate.ask_value + Global.current_rate.bid_value) / 2; int index; if (Global.candle_array.Count < Global.sell_limit_min_th) { return(false); } for (index = Global.candle_array.Count - Global.sell_limit_min_th; index < Global.candle_array.Count; index++) { CandleData cd = Global.candle_array.ElementAt(index); sum_val += (cd.open_value + cd.close_value) / 2; } ma_value = sum_val / Global.sell_limit_min_th; double diff_val = cu_av_value - ma_value; if (diff_val * 100 / cu_av_value > 1) { return(true); } return(false); }