롱 올림
This commit is contained in:
@@ -309,59 +309,59 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
BuyShortStep[market] = 0;
|
||||
BuyLongStep[market] = 0;
|
||||
}
|
||||
if (!(전저고점.ContainsKey(market + "5m")))
|
||||
if (!(전저고점.ContainsKey(market + "30m")))
|
||||
continue;
|
||||
|
||||
#region 5분봉 처리
|
||||
|
||||
var candleDatas_5 = findedMarket.candleDataList[MCandleTimeType.M5];
|
||||
var candleDatas_5_정렬 = candleDatas_5.OrderBy(i => i.Argument).ToList();
|
||||
var candleDatas_5_TempList = candleDatas_5.OrderBy(i => i.Argument).ToList();
|
||||
var candleData_5 = candleDatas_5.Find(i => i.Argument == candleDatas_5_정렬.Last().Argument);
|
||||
var candleDatas_30 = findedMarket.candleDataList[MCandleTimeType.M30];
|
||||
var candleDatas_30_정렬 = candleDatas_30.OrderBy(i => i.Argument).ToList();
|
||||
var candleDatas_30_TempList = candleDatas_30.OrderBy(i => i.Argument).ToList();
|
||||
var candleData_30 = candleDatas_30.Find(i => i.Argument == candleDatas_30_정렬.Last().Argument);
|
||||
|
||||
if (candleData_5 == null) continue;
|
||||
if (candleData_30 == null) continue;
|
||||
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_5_정렬, candleData_5);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_5_정렬, candleData_5);
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_30_정렬, candleData_30);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_30_정렬, candleData_30);
|
||||
|
||||
candleDatas_5_정렬.RemoveAt(candleDatas_5_정렬.Count - 1);
|
||||
var candleData_5_전봉 = candleDatas_5.Find(i => i.Argument == candleDatas_5_정렬.Last().Argument);
|
||||
candleDatas_30_정렬.RemoveAt(candleDatas_30_정렬.Count - 1);
|
||||
var candleData_30_전봉 = candleDatas_30.Find(i => i.Argument == candleDatas_30_정렬.Last().Argument);
|
||||
|
||||
if (candleData_5_전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_5_정렬, candleData_5_전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_5_정렬, candleData_5_전봉);
|
||||
if (candleData_30_전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_30_정렬, candleData_30_전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_30_정렬, candleData_30_전봉);
|
||||
|
||||
candleDatas_5_정렬.RemoveAt(candleDatas_5_정렬.Count - 1);
|
||||
var candleData_5_전전봉 = candleDatas_5.Find(i => i.Argument == candleDatas_5_정렬.Last().Argument);
|
||||
candleDatas_30_정렬.RemoveAt(candleDatas_30_정렬.Count - 1);
|
||||
var candleData_30_전전봉 = candleDatas_30.Find(i => i.Argument == candleDatas_30_정렬.Last().Argument);
|
||||
|
||||
if (candleData_5_전전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_5_정렬, candleData_5_전전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_5_정렬, candleData_5_전전봉);
|
||||
if (candleData_30_전전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_30_정렬, candleData_30_전전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_30_정렬, candleData_30_전전봉);
|
||||
|
||||
candleDatas_5_정렬.RemoveAt(candleDatas_5_정렬.Count - 1);
|
||||
var candleData_5_전전전봉 = candleDatas_5.Find(i => i.Argument == candleDatas_5_정렬.Last().Argument);
|
||||
candleDatas_30_정렬.RemoveAt(candleDatas_30_정렬.Count - 1);
|
||||
var candleData_30_전전전봉 = candleDatas_30.Find(i => i.Argument == candleDatas_30_정렬.Last().Argument);
|
||||
|
||||
if (candleData_5_전전전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_5_정렬, candleData_5_전전전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_5_정렬, candleData_5_전전전봉);
|
||||
if (candleData_30_전전전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_30_정렬, candleData_30_전전전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_30_정렬, candleData_30_전전전봉);
|
||||
|
||||
|
||||
candleDatas_5_정렬.RemoveAt(candleDatas_5_정렬.Count - 1);
|
||||
var candleData_5_전전전전봉 = candleDatas_5.Find(i => i.Argument == candleDatas_5_정렬.Last().Argument);
|
||||
candleDatas_30_정렬.RemoveAt(candleDatas_30_정렬.Count - 1);
|
||||
var candleData_30_전전전전봉 = candleDatas_30.Find(i => i.Argument == candleDatas_30_정렬.Last().Argument);
|
||||
|
||||
if (candleData_5_전전전전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_5_정렬, candleData_5_전전전전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_5_정렬, candleData_5_전전전전봉);
|
||||
if (candleData_30_전전전전봉 == null) continue;
|
||||
ichimokuConditionSetup.calIchimokuData(candleDatas_30_정렬, candleData_30_전전전전봉);
|
||||
movingAverageConditionSetup.Cal_YHK_Downpublic(candleDatas_30_정렬, candleData_30_전전전전봉);
|
||||
#endregion
|
||||
var 저고점 = 전저고점[market + strInterval];
|
||||
if (영호조건식_상향돌파 || 영호조건식_하향돌파)
|
||||
{
|
||||
if (영호조건식_상향돌파)
|
||||
{
|
||||
var price = candleData_5.Close;
|
||||
var rate = (candleData_5.Close / candleData_5.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData_5.Open;
|
||||
var indicatorRate = (candleData_5.Close / indicatorPrice) * 100 - 100;
|
||||
var price = candleData_30.Close;
|
||||
var rate = (candleData_30.Close / candleData_30.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData_30.Open;
|
||||
var indicatorRate = (candleData_30.Close / indicatorPrice) * 100 - 100;
|
||||
|
||||
var description = string.Format("{0} 72,24,4 상승", strInterval);
|
||||
var signalData = signals_SD.Find(i => i.MarketName.Equals(market) && i.Description.Equals(description));
|
||||
@@ -375,14 +375,14 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{
|
||||
if(!FirstFlag[market + strInterval + "Long"])
|
||||
{
|
||||
if(sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.LongSell, market, true))
|
||||
if(!sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongBuy, market, true))
|
||||
{
|
||||
FirstFlag[market + strInterval + "Long"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.LongBuy, market, true) &&
|
||||
!sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.LongSell, market, true) &&
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongBuy, market, true) &&
|
||||
!sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, market, true) &&
|
||||
FirstFlag[market + strInterval + "Long"]
|
||||
//&& 저고점["전저가"] > 저고점["전전저가"]
|
||||
)
|
||||
@@ -411,8 +411,8 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "Price", price },
|
||||
{ "Flag", 저고점["전저가"] > 저고점["전전저가"] },
|
||||
{ "MCandleTimeType", (int)interval },
|
||||
{ "CandleTime", candleData_5.Argument },
|
||||
{ "Candle", candleData_5 }
|
||||
{ "CandleTime", candleData_30.Argument },
|
||||
{ "Candle", candleData_30 }
|
||||
};
|
||||
|
||||
UpBuyList.Add(market, buyDic);
|
||||
@@ -440,7 +440,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "BuyDate", nowTime },
|
||||
{ "Price", price },
|
||||
{ "MCandleTimeType", (int)interval },
|
||||
{ "Candle", candleData_5 },
|
||||
{ "Candle", candleData_30 },
|
||||
{ "Size", size },
|
||||
{ "orderId", orderDic["orderId"] }
|
||||
};
|
||||
@@ -459,7 +459,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
var flag = (bool)buyItem["Flag"];
|
||||
if (interval < MCandleTimeType.H1)
|
||||
{
|
||||
var buyTime = ((DateTime)buyItem["BuyDate"]).AddMinutes(5);
|
||||
var buyTime = ((DateTime)buyItem["BuyDate"]).AddMinutes(30);
|
||||
if (nowTime < buyTime)
|
||||
continue;
|
||||
|
||||
@@ -481,11 +481,11 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
}
|
||||
else
|
||||
{
|
||||
if (저고점["전저가"] < 저고점["전전저가"] || 저고점["전저가"] > candleData_5_전봉.Close)
|
||||
if (저고점["전저가"] < 저고점["전전저가"] || 저고점["전저가"] > candleData_30_전봉.Close)
|
||||
sellFlag = true;
|
||||
}
|
||||
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.LongSell, market, true) || sellFlag)
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.LongSell, market, true) || sellFlag)
|
||||
{
|
||||
double.TryParse(buyItem["Price"].ToString(), out var buyPrice);
|
||||
var resultRate = ((price - buyPrice) / buyPrice) * 100;
|
||||
@@ -500,7 +500,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "BuyCandle", buyItem["Candle"] },
|
||||
{ "SellDate", nowTime},
|
||||
{ "SellPrice", price },
|
||||
{ "SellCandle", candleData_5 },
|
||||
{ "SellCandle", candleData_30 },
|
||||
{ "Rate", resultRate }
|
||||
};
|
||||
|
||||
@@ -541,7 +541,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "BuyCandle", buyItem["Candle"] },
|
||||
{ "SellDate", nowTime},
|
||||
{ "SellPrice", price},
|
||||
{ "SellCandle", candleData_5 },
|
||||
{ "SellCandle", candleData_30 },
|
||||
{ "Rate", resultRateData }
|
||||
};
|
||||
ResultList.Add(orderResult);
|
||||
@@ -561,10 +561,10 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
}
|
||||
if (영호조건식_하향돌파)
|
||||
{
|
||||
var price = candleData_5.Close;
|
||||
var rate = (candleData_5.Close / candleData_5.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData_5.Open;
|
||||
var indicatorRate = (candleData_5.Close / indicatorPrice) * 100 - 100;
|
||||
var price = candleData_30.Close;
|
||||
var rate = (candleData_30.Close / candleData_30.Open) * 100 - 100;
|
||||
var indicatorPrice = candleData_30.Open;
|
||||
var indicatorRate = (candleData_30.Close / indicatorPrice) * 100 - 100;
|
||||
|
||||
var description = string.Format("{0} 72,24,4 하락", strInterval);
|
||||
var signalData = signals_SD.Find(i => i.MarketName.Equals(market) && i.Description.Equals(description));
|
||||
@@ -576,15 +576,15 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{
|
||||
if (!FirstFlag[market + strInterval + "Short"])
|
||||
{
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.ShortSell, market, true))
|
||||
if (!sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortBuy, market, true))
|
||||
{
|
||||
FirstFlag[market + strInterval + "Short"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.ShortBuy, market, true) &&
|
||||
!sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.ShortSell, market, true) &&
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortBuy, market, true) &&
|
||||
!sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, market, true) &&
|
||||
FirstFlag[market + strInterval + "Short"]
|
||||
//&& 저고점["전고가"] < 저고점["전전고가"])
|
||||
)
|
||||
@@ -612,8 +612,8 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "Price", price },
|
||||
{ "Flag", 저고점["전고가"] < 저고점["전전고가"] },
|
||||
{ "MCandleTimeType", (int)interval },
|
||||
{ "CandleTime", candleData_5.Argument },
|
||||
{ "Candle", candleData_5 }
|
||||
{ "CandleTime", candleData_30.Argument },
|
||||
{ "Candle", candleData_30 }
|
||||
};
|
||||
|
||||
DownBuyList.Add(market, buyDic);
|
||||
@@ -641,7 +641,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "BuyDate", nowTime },
|
||||
{ "Price", price },
|
||||
{ "MCandleTimeType", (int)interval },
|
||||
{ "Candle", candleData_5 },
|
||||
{ "Candle", candleData_30 },
|
||||
{ "Size", size },
|
||||
{ "orderId", orderDic["orderId"] }
|
||||
};
|
||||
@@ -660,7 +660,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
var flag = (bool)buyItem["Flag"];
|
||||
if (interval < MCandleTimeType.H1)
|
||||
{
|
||||
var buyTime = ((DateTime)buyItem["BuyDate"]).AddMinutes(5);
|
||||
var buyTime = ((DateTime)buyItem["BuyDate"]).AddMinutes(30);
|
||||
|
||||
if (nowTime < buyTime)
|
||||
continue;
|
||||
@@ -685,11 +685,11 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
}
|
||||
else
|
||||
{
|
||||
if (저고점["전고가"] > 저고점["전전고가"] || 저고점["전고가"] < candleData_5_전봉.Close)
|
||||
if (저고점["전고가"] > 저고점["전전고가"] || 저고점["전고가"] < candleData_30_전봉.Close)
|
||||
sellFlag = true;
|
||||
}
|
||||
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_5_TempList, SMABandType.ShortSell, market, true) || sellFlag)
|
||||
if (sMABandConditionSetup.Calculate(candleDatas_30_TempList, SMABandType.ShortSell, market, true) || sellFlag)
|
||||
{
|
||||
BuyShortStep[market] = 0;
|
||||
double.TryParse(buyItem["Price"].ToString(), out var buyPrice);
|
||||
@@ -705,7 +705,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "BuyCandle", buyItem["Candle"] },
|
||||
{ "SellDate", nowTime},
|
||||
{ "SellPrice", price },
|
||||
{ "SellCandle", candleData_5 },
|
||||
{ "SellCandle", candleData_30 },
|
||||
{ "Rate", resultRate }
|
||||
};
|
||||
|
||||
@@ -747,7 +747,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{ "BuyCandle", buyItem["Candle"] },
|
||||
{ "SellDate", nowTime},
|
||||
{ "SellPrice", price },
|
||||
{ "SellCandle", candleData_5 },
|
||||
{ "SellCandle", candleData_30 },
|
||||
{ "Rate", resultRateData }
|
||||
};
|
||||
ResultList.Add(orderResult);
|
||||
@@ -890,13 +890,13 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-TIMESTAMP",timestamp}
|
||||
};
|
||||
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetPendingOrder_Future, BitgetURL_PendingOrders_Future, null, MCandleTimeType.M5, "", "", nvc);
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetPendingOrder_Future, BitgetURL_PendingOrders_Future, null, MCandleTimeType.M30, "", "", nvc);
|
||||
}
|
||||
|
||||
public long GetTimeStamp()
|
||||
{
|
||||
|
||||
var result = (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetGetTimeStamp, BitgetURL_GetTimestamp, null, MCandleTimeType.M5, "", "", null);
|
||||
var result = (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetGetTimeStamp, BitgetURL_GetTimestamp, null, MCandleTimeType.M30, "", "", null);
|
||||
if (result == null)
|
||||
{
|
||||
return 0;
|
||||
@@ -922,7 +922,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-TIMESTAMP",timestamp}
|
||||
};
|
||||
|
||||
return (List<Dictionary<string, object>>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetAccountList_Future, BitgetURL_AccountList_Future, null, MCandleTimeType.M5, "", "", nvc);
|
||||
return (List<Dictionary<string, object>>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetAccountList_Future, BitgetURL_AccountList_Future, null, MCandleTimeType.M30, "", "", nvc);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> CancelFutureOrder(string symbol, string orderId)
|
||||
@@ -940,7 +940,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-TIMESTAMP", timestamp}
|
||||
};
|
||||
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetCancelOrder_Future, BitgetURL_CancelOrder_Future, null, MCandleTimeType.M5, postStr, "", nvc);
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetCancelOrder_Future, BitgetURL_CancelOrder_Future, null, MCandleTimeType.M30, postStr, "", nvc);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ChangeFuturePositionMode(FuturePositionMode mode)
|
||||
@@ -959,7 +959,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-TIMESTAMP", timestamp}
|
||||
};
|
||||
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetChangePositionMode_Future, BitgetURL_ChangePositionMode_Future, null, MCandleTimeType.M5, postStr, "", nvc);
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetChangePositionMode_Future, BitgetURL_ChangePositionMode_Future, null, MCandleTimeType.M30, postStr, "", nvc);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetFutureOrderDetail(string symbol, string orderId)
|
||||
@@ -977,7 +977,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-TIMESTAMP",timestamp}
|
||||
};
|
||||
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetOrderDetail_Future, BitgetURL_OrderDetail_Future + "?symbol=" + symbol.ToString() + "&orderId=" + orderId.ToString() + "&productType=USDT-FUTURES", null, MCandleTimeType.M5, "", "", orderDetailnvc);
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetOrderDetail_Future, BitgetURL_OrderDetail_Future + "?symbol=" + symbol.ToString() + "&orderId=" + orderId.ToString() + "&productType=USDT-FUTURES", null, MCandleTimeType.M30, "", "", orderDetailnvc);
|
||||
|
||||
}
|
||||
|
||||
@@ -1030,7 +1030,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-PASSPHRASE", YHKIM_PassphraseKey },
|
||||
{"ACCESS-TIMESTAMP", timestamp}
|
||||
};
|
||||
var result = (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetChangeMarginMode_Future, BitgetURL_ChangeMarginMode_Future, null, MCandleTimeType.M5, changeMarginModeStr, "", nvcMargin);
|
||||
var result = (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetChangeMarginMode_Future, BitgetURL_ChangeMarginMode_Future, null, MCandleTimeType.M30, changeMarginModeStr, "", nvcMargin);
|
||||
if (result == null || result["msg"]?.ToString() != "success")
|
||||
{
|
||||
return null;
|
||||
@@ -1044,7 +1044,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-PASSPHRASE", YHKIM_PassphraseKey },
|
||||
{"ACCESS-TIMESTAMP", timestamp}
|
||||
};
|
||||
result = (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetChangeLeverage_Future, BitgetURL_ChangeLeverage_Future, null, MCandleTimeType.M5, leverageStr, "", nvcLeverage);
|
||||
result = (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetChangeLeverage_Future, BitgetURL_ChangeLeverage_Future, null, MCandleTimeType.M30, leverageStr, "", nvcLeverage);
|
||||
if (result == null || result["msg"]?.ToString() != "success")
|
||||
{
|
||||
return null;
|
||||
@@ -1069,7 +1069,7 @@ namespace BitgetAPI.IndicatorConditionSetup
|
||||
{"ACCESS-PASSPHRASE", YHKIM_PassphraseKey },
|
||||
{"ACCESS-TIMESTAMP", timestamp}
|
||||
};
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetOrder_Future, BitgetURL_BuySellOrder_Future, null, MCandleTimeType.M5, postStr, "", nvc);
|
||||
return (Dictionary<string, object>)WebConnection.SendWebServer(ExchangeWebReqType.BitgetOrder_Future, BitgetURL_BuySellOrder_Future, null, MCandleTimeType.M30, postStr, "", nvc);
|
||||
}
|
||||
|
||||
public string GenerateSignString(string timestamp, string method, string requestPath, string queryString, string body, string secretKey)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BitgetApi.IndicatorConditionSetup
|
||||
public class SMABandConditionSetup
|
||||
{
|
||||
private readonly int rangeLookback = 12;
|
||||
private double rangeThresholdPercent = 0.7;
|
||||
private double rangeThresholdPercent = 1;
|
||||
/// <summary>
|
||||
/// false 는 구매 전, true는 판매 후
|
||||
/// </summary>
|
||||
@@ -87,33 +87,23 @@ namespace BitgetApi.IndicatorConditionSetup
|
||||
|
||||
|
||||
var ichmok = GetIchimokuCloud(candles, i - 25);
|
||||
var ichmokCurrent = GetIchimokuCloud(candles, i);
|
||||
|
||||
var cloudTopNow = Math.Max(ichmok.SenkouSpanA, ichmok.SenkouSpanB);
|
||||
var cloudBottomNow = Math.Min(ichmok.SenkouSpanA, ichmok.SenkouSpanB);
|
||||
|
||||
bool isSma4BelowCloud = low[i] < cloudBottomNow;
|
||||
bool isSma4AboveCloud = high[i] > cloudTopNow;
|
||||
//bool cloudFlag = false;
|
||||
|
||||
//if (!firstCloudFlag)
|
||||
//{
|
||||
// if(isSma4BelowCloud)
|
||||
// cloudFlag = true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (!isSma4BelowCloud)
|
||||
// firstCloudFlag = false;
|
||||
//}
|
||||
|
||||
bool isSma4AboveCloud = high[i] > cloudTopNow;
|
||||
|
||||
bool greenCandle = open[i] < close[i];
|
||||
bool redCandle = open[i] > close[i];
|
||||
|
||||
// 진입/청산 조건
|
||||
bool rawNewLong = sma4 == sma4High && prevSma4 < sma4High && sma4Middle > sma72 && sma4 > cloudTopNow && ichmok.SenkouSpanA >= ichmok.SenkouSpanB; // sma4 > cloudBottomNow && IsSideways(high, low, i, true) && isSma4AboveCloud && (sma4 == sma4High && prevSma4 <= prevSma4High && prev2Sma4 <= prev2Sma4High) && (sma4 >= prevSma4 && prevSma4 >= prev2Sma4 && prev2Sma4 >= prev3Sma4);
|
||||
bool rawNewLong = greenCandle && sma4Low < sma72 && IsSideways(high, low, i, true) && sma4 > cloudTopNow && prevSma4 <= prevSma4High && sma4 == sma4High && prevSma4 < sma4 && sma4Middle > sma72 && sma4 > cloudTopNow && ichmok.SenkouSpanA >= ichmok.SenkouSpanB && ichmokCurrent.SenkouSpanA >= ichmokCurrent.SenkouSpanB;
|
||||
//sma4 == sma4High && prevSma4 < sma4High && sma4Middle > sma72 && sma4 > cloudTopNow && ichmokCurrent.SenkouSpanA > ichmokCurrent.SenkouSpanB && ichmok.SenkouSpanA >= ichmok.SenkouSpanB; // sma4 > cloudBottomNow && IsSideways(high, low, i, true) && isSma4AboveCloud && (sma4 == sma4High && prevSma4 <= prevSma4High && prev2Sma4 <= prev2Sma4High) && (sma4 >= prevSma4 && prevSma4 >= prev2Sma4 && prev2Sma4 >= prev3Sma4);
|
||||
|
||||
bool rawLongSell = (sma4Middle < sma72 && prevSma4Middle > prevSma72) || (sma4 < cloudBottomNow);// (sma4 <= prevSma4 && prevSma4 <= prev2Sma4 && sma4 < sma4Middle);
|
||||
bool rawLongSell = (sma4Middle < sma72 && prevSma4Middle > prevSma72) || (sma4 == sma4Low);
|
||||
//(sma4Middle < sma72 && prevSma4Middle > prevSma72) || (sma4 < cloudBottomNow);// (sma4 <= prevSma4 && prevSma4 <= prev2Sma4 && sma4 < sma4Middle);
|
||||
|
||||
//cloudFlag &&
|
||||
bool rawNewShort = sma4 == sma4Low && prevSma4 > sma4Low && sma4Middle < sma72 && sma4 < cloudBottomNow;// sma4High < sma72 && prevSma4High > prevSma72;//sma4 < cloudTopNow && IsSideways(high, low, i, false) && isSma4BelowCloud && (sma4 == sma4Low && prevSma4 >= prevSma4Low && prev2Sma4 >= prev2Sma4Low) && (sma4 <= prevSma4 && prevSma4 <= prev2Sma4 && prev2Sma4 <= prev3Sma4);
|
||||
@@ -180,20 +170,20 @@ namespace BitgetApi.IndicatorConditionSetup
|
||||
|
||||
private bool IsSideways(List<double> high, List<double> low, int index, bool type)
|
||||
{
|
||||
double highestHigh = high.Skip(index - rangeLookback).Take(rangeLookback + 1).Max();
|
||||
double lowestLow = low.Skip(index - rangeLookback).Take(rangeLookback + 1).Min();
|
||||
double highestHigh = Highest(high, index, rangeLookback, 1);
|
||||
double lowestLow = Lowest(low, index, rangeLookback, 1);
|
||||
|
||||
// long
|
||||
if (type)
|
||||
{
|
||||
double range = high[index] - lowestLow;
|
||||
return range > (lowestLow * rangeThresholdPercent / 100.0) && highestHigh == high[index];
|
||||
return range > (highestHigh * rangeThresholdPercent / 100.0);
|
||||
}
|
||||
//short
|
||||
else
|
||||
{
|
||||
double range = highestHigh - low[index];
|
||||
return range > (highestHigh * rangeThresholdPercent / 100.0) && lowestLow == low[index];
|
||||
return range > (lowestLow * rangeThresholdPercent / 100.0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user